//===========================================================================// // 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 #pragma hdrstop #if !defined(POINT3D_HPP) #include #endif #if !defined(LINMTRX_HPP) #include #endif #if !defined(VECTOR4D_HPP) #include #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