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>
88 lines
2.1 KiB
C++
88 lines
2.1 KiB
C++
//=======================================================================//
|
|
// File: line.cpp //
|
|
// Project: Architecture //
|
|
// Author: J.M. Albertson //
|
|
//-----------------------------------------------------------------------//
|
|
// Copyright (C) 1994, Virtual World Entertainments, All Rights reserved //
|
|
// PROPRIETARY AND CONFIDENTIAL //
|
|
//=======================================================================//
|
|
|
|
#include <munga.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(LINE_HPP)
|
|
# include <line.hpp>
|
|
#endif
|
|
|
|
#if !defined(PLANE_HPP)
|
|
# include <plane.hpp>
|
|
#endif
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Line&
|
|
Line::operator=(const Vector3D &vector)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&vector);
|
|
//
|
|
// Make sure length of vector is non-zero
|
|
//
|
|
length = vector.Length();
|
|
Verify(length);
|
|
//
|
|
// Normalize the vector and put it into the line
|
|
//
|
|
direction.x = vector.x/length;
|
|
direction.y = vector.y/length;
|
|
direction.z = vector.z/length;
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Line&
|
|
Line::operator=(const Point3D &point)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&point);
|
|
//
|
|
// Copy the point over into the line.
|
|
//
|
|
origin.x = point.x;
|
|
origin.y = point.y;
|
|
origin.z = point.z;
|
|
return *this;
|
|
}
|
|
|
|
Scalar
|
|
Line::DistanceTo(
|
|
const Plane &plane,
|
|
Scalar *product
|
|
) const
|
|
{
|
|
*product = direction * plane.normal;
|
|
if (Small_Enough(*product))
|
|
{
|
|
Check_Fpu();
|
|
return -1.0f;
|
|
}
|
|
Scalar result = -plane.DistanceTo(origin) / *product;
|
|
Check_Fpu();
|
|
return result;
|
|
}
|
|
|
|
Scalar
|
|
Line::DistanceTo(
|
|
const Sphere &,//sphere,
|
|
Scalar *//penetration
|
|
) const
|
|
{
|
|
return -1.0f; // HACK
|
|
}
|
|
|