//===========================================================================// // File: origin.cc // // Project: MUNGA Brick: Math Library // // Contents: Implementation details for the position class // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 11/19/94 JMA Initial coding. // // 11/29/94 JMA Added origin concatenation // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(ORIGIN_HPP) #include #endif #if !defined(MOTION_HPP) #include #endif #if !defined(LINMTRX_HPP) #include #endif const Origin Origin::Identity(Point3D::Identity, Quaternion::Identity); #if defined(USE_SIGNATURE) int Is_Signature_Bad(const volatile Origin *) { return False; } #endif // //########################################################################### //########################################################################### // Origin::Origin(const LinearMatrix &matrix) { Check(&matrix); linearPosition = matrix; angularPosition = matrix; } // //########################################################################### //########################################################################### // Origin& Origin::operator=(const Origin &origin) { Check_Pointer(this); Check(&origin); angularPosition = origin.angularPosition; linearPosition = origin.linearPosition; return *this; } // //########################################################################### //########################################################################### // Origin& Origin::operator=(const LinearMatrix &matrix) { Check_Pointer(this); Check(&matrix); angularPosition = matrix; linearPosition = matrix; return *this; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Logical Origin::operator==(const Origin &origin) const { Check(this); return (memcmp(this, &origin, sizeof(Origin)) == 0); } // //########################################################################### //########################################################################### // Origin& Origin::AddScaled( const Origin& source, const Motion& delta, Scalar t ) { Check_Pointer(this); Check(&source); Check(&delta); Verify(t >= 0.0f); linearPosition.AddScaled(source.linearPosition, delta.linearMotion, t); angularPosition.AddScaled(source.angularPosition, delta.angularMotion, t); return *this; } // //############################################################################# //############################################################################# // Origin& Origin::Lerp( const Origin &start, const Origin &end, Scalar t ) { Check_Pointer(this); Check(&start); Check(&end); linearPosition.Lerp(start.linearPosition, end.linearPosition, t); angularPosition.Lerp(start.angularPosition, end.angularPosition, t); Check(this); return *this; } // //########################################################################### //########################################################################### // ostream& operator<<( ostream& stream, const Origin& p ) { return stream << '{' << p.linearPosition << ',' << p.angularPosition << '}'; } // //########################################################################### //########################################################################### // Logical Origin::TestInstance() const { return angularPosition.TestInstance(); } #if defined(TEST_CLASS) # include "origin.tcp" #endif