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>
78 lines
2.3 KiB
Plaintext
78 lines
2.3 KiB
Plaintext
//===========================================================================//
|
|
// File: unitvec.tst //
|
|
// Project: MUNGA Brick: Math Library //
|
|
// Contents: Implementation details for unit vector class //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 11/19/94 JMA Initial coding. //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(LINMTRX_HPP)
|
|
#include <linmtrx.hpp>
|
|
#endif
|
|
|
|
#if !defined(ROTATION_HPP)
|
|
#include<rotation.hpp>
|
|
#endif
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Logical
|
|
UnitVector::TestClass()
|
|
{
|
|
DEBUG_STREAM << "Starting UnitVector test...\n";
|
|
|
|
UnitVector
|
|
b;
|
|
const UnitVector
|
|
c(0.6f,0.0f,0.8f);
|
|
UnitVector
|
|
d(0.8f,-0.6f,0.0f);
|
|
|
|
Test(c.x == 0.6f && c.y == 0.0f && c.z == 0.8f);
|
|
|
|
Test(c[2] == c.z);
|
|
|
|
b = c;
|
|
Test(b.x == c.x && b.y == c.y && b.z == c.z);
|
|
Test(Close_Enough(b,c));
|
|
Test(b == c);
|
|
|
|
b.Negate(c);
|
|
Test(b == UnitVector(-c.x,-c.y,-c.z));
|
|
|
|
Scalar f = c*d;
|
|
Test(Close_Enough(f,c.x*d.x + c.y*d.y + c.z*d.z));
|
|
|
|
LinearMatrix
|
|
m;
|
|
EulerAngles
|
|
r(PI_OVER_4,0.0f,0.0f);
|
|
m = r;
|
|
b.Multiply(c,m);
|
|
Test(b == UnitVector(c.x,c.y*m(1,1)+c.z*m(2,1),c.y*m(1,2)+c.z*m(2,2)));
|
|
b = c;
|
|
b *= m;
|
|
Test(b == UnitVector(c.x,c.y*m(1,1)+c.z*m(2,1),c.y*m(1,2)+c.z*m(2,2)));
|
|
|
|
f = c.LengthSquared();
|
|
Test(f == 1.0f);
|
|
f = c.Length();
|
|
Test(f == 1.0f);
|
|
|
|
Vector3D v(0.0f,1.2f,1.6f);
|
|
f = v.Length();
|
|
b = v;
|
|
Test(b == UnitVector(v.x/f, v.y/f, v.z/f));
|
|
|
|
return True;
|
|
}
|
|
|