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>
93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
//===========================================================================//
|
|
// File: point3d.cc //
|
|
// Project: MUNGA Brick: Math Library //
|
|
// Contents: Implementation details for the point 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 //
|
|
//===========================================================================//
|
|
|
|
#include <munga.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(POINT3D_HPP)
|
|
#include <point3d.hpp>
|
|
#endif
|
|
|
|
#if !defined(LINMTRX_HPP)
|
|
#include <linmtrx.hpp>
|
|
#endif
|
|
|
|
#if !defined(VECTOR4D_HPP)
|
|
#include <vector4d.hpp>
|
|
#endif
|
|
|
|
const Point3D
|
|
Point3D::Identity(0.0f,0.0f,0.0f);
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Point3D&
|
|
Point3D::operator=(const Vector4D& v)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&v);
|
|
Verify(v.w);
|
|
|
|
x = v.x/v.w;
|
|
y = v.y/v.w;
|
|
z = v.z/v.w;
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Point3D&
|
|
Point3D::Multiply(const Point3D& p,const AffineMatrix& m)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&p);
|
|
Check(&m);
|
|
|
|
x = p.x*m(0,0) + p.y*m(1,0) + p.z*m(2,0) + m(3,0);
|
|
y = p.x*m(0,1) + p.y*m(1,1) + p.z*m(2,1) + m(3,1);
|
|
z = p.x*m(0,2) + p.y*m(1,2) + p.z*m(2,2) + m(3,2);
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Point3D&
|
|
Point3D::MultiplyByInverse(
|
|
const Point3D &p,
|
|
const LinearMatrix &m
|
|
)
|
|
{
|
|
x =
|
|
p.x*m(0,0) + p.y*m(0,1) + p.z*m(0,2)
|
|
- m(3,0)*m(0,0) - m(3,1)*m(0,1) - m(3,2)*m(0,2);
|
|
y =
|
|
p.x*m(1,0) + p.y*m(1,1) + p.z*m(1,2)
|
|
- m(3,0)*m(1,0) - m(3,1)*m(1,1) - m(3,2)*m(1,2);
|
|
z =
|
|
p.x*m(2,0) + p.y*m(2,1) + p.z*m(2,2)
|
|
- m(3,0)*m(2,0) - m(3,1)*m(2,1) - m(3,2)*m(2,2);
|
|
return *this;
|
|
}
|
|
|
|
#if defined(TEST_CLASS)
|
|
# include "point3d.tcp"
|
|
#endif
|
|
|