Files
TeslaRel410/CODE/RP/MUNGA/RECT2D.TCP
T
CydandClaude Fable 5 fdd9ac9d97 Initial import: Tesla Release 4.10 (Tesla:BattleTech & Tesla:Red Planet)
Archival snapshot of the Virtual World Entertainment Tesla cockpit
software, 1994-1996: MUNGA engine and L4 pod layer source (Borland
C++ 5.0), BT/RP game code, and game content (models, audio, maps,
gauges, Division renderer data). Includes third-party libraries:
Division dVS/DPL graphics, HMI SOS audio, WATTCP networking.

Files are preserved byte-for-byte (.gitattributes disables all
line-ending conversion). README.md documents the layout, target
hardware, and toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 13:21:58 -05:00

129 lines
3.5 KiB
Plaintext

//===========================================================================//
// File: rect2d.tst //
// Project: MUNGA Brick: Math Library //
// Contents: Test code for two-dimensional rectangle class //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 2/01/94 CPB Initial coding (copied from vector3d.tst) //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
//
//###########################################################################
//###########################################################################
//
Logical
Rectangle2D::TestClass()
{
DEBUG_STREAM << "Starting Rectangle2D test...\n";
//
//-------------------------------------------------------------------
// Constructors (and IsEmpty())
//-------------------------------------------------------------------
//
{
Vector2DOf<int> v1(0,0), v2(1,1);
Rectangle2D a;
Check(&a);
Test(a.IsEmpty());
Rectangle2D b(v1,v2);
Check(&b);
Test(!b.IsEmpty());
Test(b.bottomLeft == v1);
Test(b.topRight == v2);
Rectangle2D c(0,1,2,3);
Check(&c);
Test(!c.IsEmpty());
Test(c.bottomLeft.x == 0);
Test(c.bottomLeft.y == 1);
Test(c.topRight.x == 2);
Test(c.topRight.y == 3);
}
//
//-------------------------------------------------------------------
// Union
//-------------------------------------------------------------------
//
{
Rectangle2D a;
Rectangle2D b(0,0,2,2);
Rectangle2D c(1,1,3,3);
Rectangle2D d(10,10,11,11);
Rectangle2D e(2,3,4,5);
e.Union(a,a);
Test(e.IsEmpty());
e.Union(a,b);
Test(e.bottomLeft == b.bottomLeft);
Test(e.topRight == b.topRight);
e.Union(b,a);
Test(e.bottomLeft == b.bottomLeft);
Test(e.topRight == b.topRight);
e.Union(b,c);
Test(e.bottomLeft == b.bottomLeft);
Test(e.topRight == c.topRight);
e.Union(c,b);
Test(e.bottomLeft == b.bottomLeft);
Test(e.topRight == c.topRight);
e.Union(b,d);
Test(e.bottomLeft == b.bottomLeft);
Test(e.topRight == d.topRight);
e.Union(d,b);
Test(e.bottomLeft == b.bottomLeft);
Test(e.topRight == d.topRight);
}
//
//-------------------------------------------------------------------
// Intersection
//-------------------------------------------------------------------
//
{
Rectangle2D a;
Rectangle2D b(0,0,2,2);
Rectangle2D c(1,1,3,3);
Rectangle2D d(10,10,11,11);
Rectangle2D e(2,3,4,5);
e.Intersection(a,a);
Test(e.IsEmpty());
e.Intersection(a,b);
Test(e.IsEmpty());
e.Intersection(b,a);
Test(e.IsEmpty());
e.Intersection(b,c);
Test(e.bottomLeft == c.bottomLeft);
Test(e.topRight == b.topRight);
e.Intersection(c,b);
Test(e.bottomLeft == c.bottomLeft);
Test(e.topRight == b.topRight);
e.Intersection(b,d);
Test(e.IsEmpty());
e.Intersection(d,b);
Test(e.IsEmpty());
}
return True;
}