/*******************************************************************************
** Copyright (c) 1992-2026 MAK Technologies, Inc
** All rights reserved.
*******************************************************************************/


#ifdef _3dPoint_inl
#include <matrix/vlVector.h>
#include <matrix/4dPoint.h>
#include <math.h>

#ifdef DtUSE_UTILITIES_NAMESPACE
namespace DtUSE_UTILITIES_NAMESPACE
{
#endif

inline Dt3dPoint::Dt3dPoint(const double& x, const double& y, const double& z):
myX( x ), myY( y ), myZ( z ) { }

inline Dt3dPoint::Dt3dPoint(): myX( 0 ), myY( 0 ), myZ( 0 ) { }

inline Dt3dPoint::Dt3dPoint(const Dt3dPoint& orig): myX( orig.myX ), myY( orig.myY ), myZ( orig.myZ ) { }

inline Dt3dPoint::~Dt3dPoint() { }

inline bool Dt3dPoint::operator!=(const Dt3dPoint& rhs) const
{ return !operator==(rhs); }

inline Dt3dPoint Dt3dPoint::operator*(const double& rhs) const
{ return ( Dt3dPoint( myX*rhs, myY*rhs, myZ*rhs)); }

inline Dt3dPoint& Dt3dPoint::operator*=(const double& rhs)
{ myX *= rhs; myY *= rhs; myZ *= rhs; return *this; }

inline Dt3dPoint Dt3dPoint::operator/(const double& rhs) const
{ return ( Dt3dPoint( myX/rhs, myY/rhs, myZ/rhs)); }

inline Dt3dPoint& Dt3dPoint::operator/=(const double& rhs)
{ myX /= rhs; myY /= rhs; myZ /= rhs; return *this; }

inline Dt3dPoint& Dt3dPoint::operator+=(const DtVector& rhs)
{ myX += rhs[DtX]; myY += rhs[DtY]; myZ += rhs[DtZ]; return *this; }

inline Dt3dPoint Dt3dPoint::operator+(const DtVector& rhs) const
{ return ( Dt3dPoint ( myX + rhs[DtX], myY + rhs[DtY], myZ + rhs[DtZ])); }


inline Dt3dPoint Dt3dPoint::operator-(const DtVector& rhs) const
{ return ( Dt3dPoint ( myX - rhs[DtX], myY - rhs[DtY], myZ - rhs[DtZ])); }


inline Dt3dPoint& Dt3dPoint::operator-=(const DtVector& rhs)
{ myX -= rhs[DtX]; myY -= rhs[DtY]; myZ -= rhs[DtZ]; return *this; }

inline bool Dt3dPoint::operator==(const Dt3dPoint& rhs) const
{ return ( myX == rhs.myX && myY == rhs.myY && myZ == rhs.myZ); }


inline void Dt3dPoint::set( const double& x, const double& y, const double& z)
{ myX = x; myY = y; myZ = z; } 

inline void Dt3dPoint::setFromVector( const DtVector & vector )
{ myX = vector.x(); myY = vector.y(); myZ = vector.z(); } 

inline void Dt3dPoint::setFrom4dPoint( const Dt4dPoint & point)
{ set( point.x(), point.y(), point.z() ); } 


inline const double& Dt3dPoint::x() const { return myX; }

inline const double& Dt3dPoint::y() const { return myY; }

inline const double& Dt3dPoint::z() const { return myZ; }

inline void Dt3dPoint::setX(const double& x) { myX = x; }

inline void Dt3dPoint::setY(const double& y) { myY = y; }

inline void Dt3dPoint::setZ(const double& z) { myZ = z; }

inline double Dt3dPoint::distanceSquaredTo( const Dt3dPoint & end ) const
{ return (end.x()-x())*(end.x()-x()) + (end.y()-y())*(end.y()-y()) + (end.z()-z())*(end.z()-z()) ; }

inline double Dt3dPoint::distanceTo( const Dt3dPoint & end ) const
{ return sqrt( distanceSquaredTo(end) ); }

inline double Dt3dPoint::xyDistanceSquaredTo( const Dt3dPoint & end ) const
{ return  (end.x()-x())*(end.x()-x()) + (end.y()-y())*(end.y()-y()) ; }

inline double Dt3dPoint::xyDistanceTo( const Dt3dPoint & end ) const
{ return sqrt( xyDistanceSquaredTo(end) ); }

inline double Dt3dPoint::magnitudeSquared() const
{ return ( (myX*myX) + (myY*myY) + (myZ*myZ) ); }

#ifdef DtUSE_UTILITIES_NAMESPACE
}
#endif

#endif

