# xsi_vector3.h

Go to the documentation of this file.

    00001 //*****************************************************************************
    00011 //*****************************************************************************
    00012
    00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
    00014 #pragma once
    00015 #endif
    00016
    00017 #ifndef __XSIVECTOR3_H__
    00018 #define __XSIVECTOR3_H__
    00019
    00020 #include "sicppsdk.h"
    00021 #include "xsi_status.h"
    00022 #include "xsi_matrix3.h"
    00023 #include "xsi_matrix4.h"
    00024 #include <math.h>
    00025
    00026 // uncomment this if you want the debug version of your plugin to catch uninitialized CVector3
    00027 // #define _DEBUG_NonInitialized_CVector3
    00028
    00029 #ifdef _DEBUG_NonInitialized_CVector3
    00030 #define MAGIC_DEBUG_VALUE ((double)0x5555555555555555)
    00031 #define XSI_DEBUG_VECTOR3 SelfDebug();
    00032 #else
    00033 #define XSI_DEBUG_VECTOR3
    00034 #endif
    00035
    00036
    00037 namespace XSI {
    00038
    00039 namespace MATH {
    00040
    00041 class CTransformation;
    00042 class CMatrix3;
    00043 class CMatrix4;
    00044
    00045 //*****************************************************************************
    00099 //*****************************************************************************
    00100 class SICPPSDKDECL CVector3
    00101 {
    00102 public:
    00104     SICPPSDK_INLINE CVector3();
    00105
    00111     SICPPSDK_INLINE CVector3(double in_dX, double in_dY, double in_dZ);
    00112
    00116     SICPPSDK_INLINE CVector3( const CVector3& in_vector3);
    00117
    00119     SICPPSDK_INLINE ~CVector3();
    00120
    00125     SICPPSDK_INLINE CVector3 & operator=( const CVector3 & in_vector3 );
    00126
    00132     SICPPSDK_INLINE bool operator ==(const CVector3 & in_vector3 )const;
    00133
    00139     SICPPSDK_INLINE bool operator !=(const CVector3 & in_vector3 )const;
    00140
    00145     SICPPSDK_INLINE CVector3& operator ~();
    00146
    00152     SICPPSDK_INLINE CVector3& operator +=(const CVector3& in_vector3);
    00153
    00159     SICPPSDK_INLINE CVector3& operator -=(const CVector3 & in_vector3);
    00160
    00161
    00167     SICPPSDK_INLINE CVector3& operator *=(const CMatrix3& in_matrix3);
    00168
    00174     SICPPSDK_INLINE CVector3& operator *=(const CMatrix4& in_matrix4);
    00175
    00181     SICPPSDK_INLINE CVector3& operator *=(const CTransformation& in_transformation);
    00182
    00188     SICPPSDK_INLINE CVector3& operator *=(const double& in_dAlpha);
    00189
    00195     SICPPSDK_INLINE double operator[](const short& in_sIndex);
    00196
    00201     SICPPSDK_INLINE CVector3& MulByMatrix3InPlace(const CMatrix3& in_matrix3);
    00202
    00208     SICPPSDK_INLINE CVector3& MulByMatrix3
    00209     (
    00210         const CVector3& in_vector3,
    00211         const CMatrix3& in_matrix3
    00212     );
    00213
    00218     SICPPSDK_INLINE CVector3& MulByMatrix4InPlace(const CMatrix4& in_matrix4);
    00219
    00225     SICPPSDK_INLINE CVector3& MulByMatrix4
    00226     (
    00227         const CVector3& in_vector3,
    00228         const CMatrix4& in_matrix4
    00229     );
    00230
    00235     SICPPSDK_INLINE CVector3& MulByTransformationInPlace
    00236     (
    00237         const CTransformation& in_transformation
    00238     );
    00239
    00245     CVector3& MulByTransformation
    00246     (
    00247         const CVector3&         in_vector3,
    00248         const CTransformation&  in_transformation
    00249     );
    00250
    00254     SICPPSDK_INLINE CVector3& PutNull();
    00255
    00259     SICPPSDK_INLINE short GetMaxComponentIndex()const;
    00260
    00264     SICPPSDK_INLINE double GetMaxComponent()const;
    00265
    00269     SICPPSDK_INLINE short GetMinComponentIndex()const;
    00270
    00274     SICPPSDK_INLINE double GetMinComponent()const;
    00275
    00279     SICPPSDK_INLINE double GetLength()const;
    00280
    00284     SICPPSDK_INLINE double GetLengthSquared()const;
    00285
    00289     CStatus NormalizeInPlace();
    00290
    00295     CStatus Normalize(const CVector3& in_vector3);
    00296
    00301     SICPPSDK_INLINE double Dot(const CVector3& in_vector3)const;
    00302
    00303
    00309     SICPPSDK_INLINE CVector3& Cross(const CVector3& in_vector3A, const CVector3& in_vector3B);
    00310
    00315     double GetAngle(const CVector3& in_vector3 )const;
    00316
    00325     SICPPSDK_INLINE CVector3& LinearlyInterpolate
    00326     (
    00327         const CVector3& in_vector3A,
    00328         const CVector3& in_vector3B,
    00329         double in_dAlpha
    00330     );
    00331
    00335     CVector3& AbsoluteInPlace();
    00336
    00342     CVector3& Absolute(const CVector3& in_vector3);
    00343
    00349     CVector3& ClampInPlace(double in_dMinValue, double in_dMaxValue);
    00350
    00358     SICPPSDK_INLINE CVector3& Clamp
    00359     (
    00360         double          in_dMinValue,
    00361         double          in_dMaxValue,
    00362         const CVector3& in_vector3
    00363     );
    00364
    00371     SICPPSDK_INLINE bool EpsilonEquals
    00372     (
    00373         const CVector3& in_vector3,
    00374         double in_dEpsilon
    00375     )const;
    00376
    00381     SICPPSDK_INLINE bool Equals(const CVector3& in_vector3)const;
    00382
    00383
    00390     SICPPSDK_INLINE CVector3& ScaleAddInPlace(double in_dS,const CVector3& in_vector3);
    00391
    00399     SICPPSDK_INLINE CVector3& ScaleAdd
    00400     (
    00401         double          in_dS,
    00402         const CVector3& in_vector3A,
    00403         const CVector3& in_vector3B
    00404     );
    00405
    00410     SICPPSDK_INLINE CVector3& ScaleInPlace(double in_dAlpha);
    00411
    00417     SICPPSDK_INLINE CVector3& Scale(double in_dAlpha, const CVector3& in_vector3);
    00418
    00422     SICPPSDK_INLINE CVector3& NegateInPlace();
    00423
    00428     SICPPSDK_INLINE CVector3& Negate(const CVector3& in_vector3);
    00429
    00434     SICPPSDK_INLINE CVector3& SubInPlace(const CVector3&in_vector3);
    00435
    00442     SICPPSDK_INLINE CVector3& Sub(const CVector3& in_vector3A, const CVector3& in_vector3B);
    00443
    00448     SICPPSDK_INLINE CVector3& AddInPlace(const CVector3& in_vector3);
    00449
    00455     SICPPSDK_INLINE CVector3& Add(const CVector3& in_vector3A,const CVector3& in_vector3B);
    00456
    00462     void Get(double& io_dX, double& io_dY, double& io_dZ)const;
    00463
    00470     SICPPSDK_INLINE CVector3& Set(double in_dX, double in_dY, double in_dZ);
    00471
    00475     SICPPSDK_INLINE double GetZ()const;
    00476
    00481     SICPPSDK_INLINE CVector3& PutZ(double in_dZ);
    00482
    00486     SICPPSDK_INLINE double GetY()const;
    00487
    00492     SICPPSDK_INLINE CVector3& PutY(double in_dY);
    00493
    00497     SICPPSDK_INLINE double GetX()const;
    00498
    00503     SICPPSDK_INLINE CVector3& PutX(double in_dX);
    00504
    00505 #ifdef _DEBUG_NonInitialized_CVector3
    00506     void DoDebugInit()
    00507     {
    00508         m_dX = MAGIC_DEBUG_VALUE;  // 64 bits of alternating 010101010101...
    00509         m_dY = MAGIC_DEBUG_VALUE;  // 64 bits of alternating 010101010101...
    00510         m_dZ = MAGIC_DEBUG_VALUE;  // 64 bits of alternating 010101010101...
    00511     }
    00512
    00513
    00514     void SelfDebug() const
    00515     {
    00516         assert( m_dX != MAGIC_DEBUG_VALUE && m_dY != MAGIC_DEBUG_VALUE && m_dZ != MAGIC_DEBUG_VALUE );
    00517     }
    00518 #endif
    00519
    00520 private:
    00521     double m_dX,m_dY,m_dZ;
    00522 };
    00523
    00524 //inline functions
    00525 SICPPSDK_INLINE CVector3::CVector3()
    00526 {
    00527 #ifdef _DEBUG_NonInitialized_CVector3
    00528     DoDebugInit(); // This method sets the debug values
    00529 #else
    00530     m_dX = 0;
    00531     m_dY = 0;
    00532     m_dZ = 0;
    00533 #endif
    00534 }
    00535
    00536 SICPPSDK_INLINE CVector3::CVector3( const CVector3& in_vct )
    00537 {
    00538     in_vct.Get(m_dX,m_dY,m_dZ);
    00539 }
    00540
    00541 SICPPSDK_INLINE CVector3::CVector3
    00542 (
    00543  double in_dX, double in_dY, double in_dZ
    00544 ):m_dX(in_dX),m_dY(in_dY),m_dZ(in_dZ)
    00545 {}
    00546
    00547 SICPPSDK_INLINE CVector3::~CVector3()
    00548 {}
    00549
    00550 SICPPSDK_INLINE CVector3& CVector3::operator=( const CVector3 & in_vct )
    00551 {
    00552     in_vct.Get(m_dX,m_dY,m_dZ);
    00553     return (*this);
    00554 }
    00555
    00556 SICPPSDK_INLINE bool CVector3::operator ==(const CVector3 & in_vector3 )const
    00557 {
    00558     return Equals(in_vector3);
    00559 }
    00560
    00561
    00562 SICPPSDK_INLINE bool CVector3::operator !=(const CVector3 & in_vector3 )const
    00563 {
    00564     return ! Equals(in_vector3);
    00565 }
    00566
    00567 SICPPSDK_INLINE CVector3& CVector3::operator ~()
    00568 {
    00569     return NegateInPlace();
    00570 }
    00571
    00572 SICPPSDK_INLINE CVector3& CVector3::operator +=(const CVector3& in_vector3)
    00573 {
    00574     return AddInPlace(in_vector3);
    00575 }
    00576
    00577 SICPPSDK_INLINE CVector3& CVector3::operator -=(const CVector3& in_vector3)
    00578 {
    00579     return SubInPlace(in_vector3);
    00580 }
    00581
    00582 SICPPSDK_INLINE CVector3& CVector3::operator *=(const CMatrix3& in_matrix3)
    00583 {
    00584     return MulByMatrix3InPlace(in_matrix3);
    00585 }
    00586
    00587 SICPPSDK_INLINE CVector3& CVector3::operator *=(const CMatrix4& in_matrix4)
    00588 {
    00589     return MulByMatrix4InPlace(in_matrix4);
    00590 }
    00591
    00592 SICPPSDK_INLINE CVector3& CVector3::operator *=(const CTransformation& in_transformation)
    00593 {
    00594     return MulByTransformationInPlace(in_transformation);
    00595 }
    00596
    00597 SICPPSDK_INLINE CVector3& CVector3::operator *=(const double& in_dAlpha)
    00598 {
    00599     return ScaleInPlace(in_dAlpha);
    00600 }
    00601
    00602 SICPPSDK_INLINE double CVector3::operator[](const short& in_sIndex)
    00603 {
    00604     XSI_DEBUG_VECTOR3;
    00605     assert(in_sIndex >= 0 && in_sIndex < 3);
    00606     switch(in_sIndex)
    00607     {
    00608     case 0:
    00609         return m_dX;
    00610         break;
    00611     case 1:
    00612         return m_dY;
    00613         break;
    00614     case 2:
    00615         return m_dZ;
    00616         break;
    00617     }
    00618     return DBL_MAX;
    00619 }
    00620
    00621 SICPPSDK_INLINE CVector3& CVector3::MulByMatrix3InPlace
    00622 (
    00623     const CMatrix3& in_matrix3
    00624 )
    00625 {
    00626     XSI_DEBUG_VECTOR3;
    00627     return MulByMatrix3((*this),in_matrix3);
    00628 }
    00629
    00630 SICPPSDK_INLINE CVector3& CVector3::MulByMatrix3
    00631 (
    00632     const CVector3& in_vector3,
    00633     const CMatrix3& in_matrix3
    00634 )
    00635 {
    00636     double l_dX, l_dY,l_dZ;
    00637     l_dX = in_vector3.GetX() * in_matrix3.GetValue(0,0) +
    00638            in_vector3.GetY() * in_matrix3.GetValue(1,0) +
    00639            in_vector3.GetZ() * in_matrix3.GetValue(2,0);
    00640     l_dY = in_vector3.GetX() * in_matrix3.GetValue(0,1) +
    00641            in_vector3.GetY() * in_matrix3.GetValue(1,1) +
    00642            in_vector3.GetZ() * in_matrix3.GetValue(2,1);
    00643     l_dZ = in_vector3.GetX() * in_matrix3.GetValue(0,2) +
    00644            in_vector3.GetY() * in_matrix3.GetValue(1,2) +
    00645            in_vector3.GetZ() * in_matrix3.GetValue(2,2);
    00646
    00647     return Set(l_dX,l_dY,l_dZ);
    00648 }
    00649
    00650 SICPPSDK_INLINE CVector3& CVector3::MulByMatrix4InPlace
    00651 (
    00652     const CMatrix4& in_matrix4
    00653 )
    00654 {
    00655     XSI_DEBUG_VECTOR3;
    00656     return MulByMatrix4((*this),in_matrix4);
    00657 }
    00658
    00659
    00660 SICPPSDK_INLINE CVector3& CVector3::MulByMatrix4
    00661 (
    00662     const CVector3& in_vector3,
    00663     const CMatrix4& in_matrix4
    00664 )
    00665 {
    00666     double l_dX, l_dY, l_dZ, l_dW;
    00667
    00668     l_dX =  in_vector3.GetX() * in_matrix4.GetValue( 0, 0 ) +
    00669             in_vector3.GetY() * in_matrix4.GetValue( 1, 0 ) +
    00670             in_vector3.GetZ() * in_matrix4.GetValue( 2, 0 ) +
    00671             in_matrix4.GetValue( 3, 0 );
    00672     l_dY =  in_vector3.GetX() * in_matrix4.GetValue( 0, 1 ) +
    00673             in_vector3.GetY() * in_matrix4.GetValue( 1, 1 ) +
    00674             in_vector3.GetZ() * in_matrix4.GetValue( 2, 1 ) +
    00675             in_matrix4.GetValue( 3, 1 );
    00676     l_dZ =  in_vector3.GetX() * in_matrix4.GetValue( 0, 2 ) +
    00677             in_vector3.GetY() * in_matrix4.GetValue( 1, 2 ) +
    00678             in_vector3.GetZ() * in_matrix4.GetValue( 2, 2 ) +
    00679             in_matrix4.GetValue( 3, 2 );
    00680     l_dW =  in_vector3.GetX() * in_matrix4.GetValue( 0, 3 ) +
    00681             in_vector3.GetY() * in_matrix4.GetValue( 1, 3 ) +
    00682             in_vector3.GetZ() * in_matrix4.GetValue( 2, 3 ) +
    00683             in_matrix4.GetValue( 3, 3 );
    00684
    00685     return Set(l_dX/l_dW, l_dY/l_dW, l_dZ/l_dW);
    00686 }
    00687
    00688
    00689 SICPPSDK_INLINE CVector3& CVector3::MulByTransformationInPlace
    00690 (
    00691     const CTransformation& in_crTrans
    00692 )
    00693 {
    00694     XSI_DEBUG_VECTOR3;
    00695     return MulByTransformation((*this), in_crTrans);;
    00696 }
    00697
    00698
    00699 SICPPSDK_INLINE CVector3& CVector3::PutNull()
    00700 {
    00701     m_dX = m_dY = m_dZ = 0.0;
    00702     return (*this);
    00703 }
    00704
    00705 SICPPSDK_INLINE short CVector3::GetMaxComponentIndex()const
    00706 {
    00707     XSI_DEBUG_VECTOR3;
    00708     if( m_dX > m_dY )
    00709     {
    00710         return (short)(( m_dX > m_dZ ) ? 0 : 2);
    00711     }
    00712     else
    00713     {
    00714         return (short)(( m_dY > m_dZ ) ? 1 : 2);
    00715     }
    00716 }
    00717
    00718 SICPPSDK_INLINE double CVector3::GetMaxComponent()const
    00719 {
    00720     XSI_DEBUG_VECTOR3;
    00721     if( m_dX > m_dY )
    00722     {
    00723         return ( m_dX > m_dZ ) ? m_dX : m_dZ;
    00724     }
    00725     else
    00726     {
    00727         return ( m_dY > m_dZ ) ? m_dY : m_dZ;
    00728     }
    00729 }
    00730
    00731 SICPPSDK_INLINE short CVector3::GetMinComponentIndex()const
    00732 {
    00733     XSI_DEBUG_VECTOR3;
    00734     if( m_dX < m_dY )
    00735     {
    00736         return (short)(( m_dX < m_dZ ) ? 0 : 2);
    00737     }
    00738     else
    00739     {
    00740         return (short)(( m_dY < m_dZ ) ? 1 : 2);
    00741     }
    00742 }
    00743
    00744 SICPPSDK_INLINE double CVector3::GetMinComponent()const
    00745 {
    00746     XSI_DEBUG_VECTOR3;
    00747     if( m_dX < m_dY )
    00748     {
    00749         return ( m_dX < m_dZ ) ? m_dX : m_dZ;
    00750     }
    00751     else
    00752     {
    00753         return ( m_dY < m_dZ ) ? m_dY : m_dZ;
    00754     }
    00755 }
    00756
    00757 SICPPSDK_INLINE double CVector3::GetLength()const
    00758 {
    00759     XSI_DEBUG_VECTOR3;
    00760     return sqrt( GetLengthSquared() );
    00761 }
    00762
    00763 SICPPSDK_INLINE double CVector3::GetLengthSquared()const
    00764 {
    00765     XSI_DEBUG_VECTOR3;
    00766     return(m_dX*m_dX + m_dY*m_dY + m_dZ*m_dZ );
    00767 }
    00768
    00769 SICPPSDK_INLINE double  CVector3::Dot(const CVector3& io_vec3)const
    00770 {
    00771     XSI_DEBUG_VECTOR3;
    00772     return ( m_dX*io_vec3.GetX() + m_dY*io_vec3.GetY() + m_dZ*io_vec3.GetZ() );
    00773 }
    00774
    00775 SICPPSDK_INLINE CVector3& CVector3::Cross
    00776 (
    00777     const CVector3& in_vec3A,
    00778     const CVector3& in_vec3B
    00779 )
    00780 {
    00781     double dX, dY, dZ;
    00782
    00783     dX =    in_vec3A.GetY() * in_vec3B.GetZ() -
    00784             in_vec3A.GetZ() * in_vec3B.GetY();
    00785     dY =   -in_vec3A.GetX() * in_vec3B.GetZ() +
    00786             in_vec3A.GetZ() * in_vec3B.GetX();
    00787     dZ =    in_vec3A.GetX() * in_vec3B.GetY() -
    00788             in_vec3A.GetY() * in_vec3B.GetX();
    00789
    00790    return( Set( dX, dY, dZ ) );
    00791 }
    00792
    00793 SICPPSDK_INLINE CVector3& CVector3::LinearlyInterpolate
    00794 (
    00795  const CVector3&    in_vec3A,
    00796  const CVector3&    in_vec3B,
    00797  const double       in_dAlpha
    00798 )
    00799 {
    00800     m_dX = (1 - in_dAlpha) * in_vec3A.GetX() + in_dAlpha * in_vec3B.GetX();
    00801     m_dY = (1 - in_dAlpha) * in_vec3A.GetY() + in_dAlpha * in_vec3B.GetY();
    00802     m_dZ = (1 - in_dAlpha) * in_vec3A.GetZ() + in_dAlpha * in_vec3B.GetZ();
    00803
    00804     return (*this);
    00805 }
    00806
    00807 SICPPSDK_INLINE bool CVector3::EpsilonEquals
    00808 (
    00809     const CVector3& in_cVec3,
    00810     double in_dEpsilon
    00811 )const
    00812 {
    00813     XSI_DEBUG_VECTOR3;
    00814     return (this == &in_cVec3) ? true :
    00815         (fabs( m_dX - in_cVec3.GetX() ) < ::fabs(in_dEpsilon) &&
    00816            fabs( m_dY - in_cVec3.GetY() ) < ::fabs(in_dEpsilon) &&
    00817            fabs( m_dZ - in_cVec3.GetZ() ) < ::fabs(in_dEpsilon) );
    00818 }
    00819
    00820
    00821 SICPPSDK_INLINE bool CVector3::Equals(const CVector3& in_vec3)const
    00822 {
    00823     XSI_DEBUG_VECTOR3;
    00824     return (this == &in_vec3) ? true :
    00825         ( ( m_dX == in_vec3.GetX() ) &&
    00826           ( m_dY == in_vec3.GetY() ) &&
    00827           ( m_dZ == in_vec3.GetZ() ) );
    00828 }
    00829
    00830 SICPPSDK_INLINE CVector3& CVector3::ScaleAddInPlace
    00831 (
    00832     double in_dScalingFactor,
    00833     const CVector3& in_vec3
    00834 )
    00835 {
    00836     ScaleInPlace(in_dScalingFactor);
    00837     return AddInPlace(in_vec3);
    00838 }
    00839
    00840
    00841 SICPPSDK_INLINE CVector3& CVector3::ScaleAdd
    00842 (
    00843     const double in_dScalingFactor,
    00844     const CVector3& in_vec3A,
    00845     const CVector3& in_vec3B
    00846 )
    00847 {
    00848     Scale(in_dScalingFactor, in_vec3A);
    00849     return AddInPlace(in_vec3B);
    00850 }
    00851
    00852 SICPPSDK_INLINE CVector3& CVector3::ScaleInPlace(double in_dScalingFactor)
    00853 {
    00854     XSI_DEBUG_VECTOR3;
    00855     m_dX *= in_dScalingFactor;
    00856     m_dY *= in_dScalingFactor;
    00857     m_dZ *= in_dScalingFactor;
    00858     return (*this);
    00859 }
    00860
    00861 SICPPSDK_INLINE CVector3& CVector3::Scale
    00862 (
    00863  double in_dScalingFactor,
    00864  const CVector3& in_vec3
    00865 )
    00866 {
    00867     m_dX = in_vec3.GetX() * in_dScalingFactor;
    00868     m_dY = in_vec3.GetY() * in_dScalingFactor;
    00869     m_dZ = in_vec3.GetZ() * in_dScalingFactor;
    00870     return (*this);
    00871 }
    00872
    00873 SICPPSDK_INLINE CVector3& CVector3::NegateInPlace()
    00874 {
    00875     XSI_DEBUG_VECTOR3;
    00876     m_dX = -m_dX;
    00877     m_dY = -m_dY;
    00878     m_dZ = -m_dZ;
    00879     return (*this);
    00880 }
    00881
    00882 SICPPSDK_INLINE CVector3& CVector3::Negate(const CVector3& in_vec3 )
    00883 {
    00884     m_dX = -in_vec3.GetX();
    00885     m_dY = -in_vec3.GetY();
    00886     m_dZ = -in_vec3.GetZ();
    00887     return (*this);
    00888 }
    00889
    00890 SICPPSDK_INLINE CVector3& CVector3::SubInPlace(const CVector3& in_vec3)
    00891 {
    00892     XSI_DEBUG_VECTOR3;
    00893     m_dX -= in_vec3.GetX();
    00894     m_dY -= in_vec3.GetY();
    00895     m_dZ -= in_vec3.GetZ();
    00896     return (*this);
    00897 }
    00898
    00899 SICPPSDK_INLINE CVector3& CVector3::Sub
    00900 (
    00901     const CVector3& in_vec3A,
    00902     const CVector3& in_vec3B
    00903 )
    00904 {
    00905     m_dX = in_vec3A.GetX() - in_vec3B.GetX();
    00906     m_dY = in_vec3A.GetY() - in_vec3B.GetY();
    00907     m_dZ = in_vec3A.GetZ() - in_vec3B.GetZ();
    00908     return (*this);
    00909 }
    00910
    00911 SICPPSDK_INLINE CVector3& CVector3::AddInPlace(const CVector3& in_vec3)
    00912 {
    00913     XSI_DEBUG_VECTOR3;
    00914     m_dX += in_vec3.GetX();
    00915     m_dY += in_vec3.GetY();
    00916     m_dZ += in_vec3.GetZ();
    00917     return (*this);
    00918 }
    00919
    00920 SICPPSDK_INLINE CVector3& CVector3::Add
    00921 (
    00922     const CVector3& in_vec3A,
    00923     const CVector3& in_vec3B
    00924 )
    00925 {
    00926     m_dX = in_vec3A.GetX() + in_vec3B.GetX();
    00927     m_dY = in_vec3A.GetY() + in_vec3B.GetY();
    00928     m_dZ = in_vec3A.GetZ() + in_vec3B.GetZ();
    00929     return (*this);
    00930 }
    00931
    00932
    00933 SICPPSDK_INLINE void CVector3::Get(double& io_rdX, double& io_rdY, double& io_rdZ)const
    00934 {
    00935     XSI_DEBUG_VECTOR3;
    00936     io_rdX = m_dX;
    00937     io_rdY = m_dY;
    00938     io_rdZ = m_dZ;
    00939 }
    00940
    00941 SICPPSDK_INLINE CVector3& CVector3::Set(double in_dX, double in_dY, double in_dZ)
    00942 {
    00943     m_dX = in_dX;
    00944     m_dY = in_dY;
    00945     m_dZ = in_dZ;
    00946     return (*this);
    00947 }
    00948
    00949 SICPPSDK_INLINE double CVector3::GetZ()const
    00950 {
    00951     XSI_DEBUG_VECTOR3;
    00952     return m_dZ;
    00953 }
    00954
    00955 SICPPSDK_INLINE CVector3&   CVector3::PutZ(double in_dZ)
    00956 {
    00957     m_dZ = in_dZ;
    00958     return (*this);
    00959 }
    00960
    00961 SICPPSDK_INLINE double CVector3::GetY()const
    00962 {
    00963     XSI_DEBUG_VECTOR3;
    00964     return m_dY;
    00965 }
    00966
    00967 SICPPSDK_INLINE CVector3& CVector3::PutY(double in_dY)
    00968 {
    00969     m_dY = in_dY;
    00970     return (*this);
    00971 }
    00972
    00973 SICPPSDK_INLINE double CVector3::GetX()const
    00974 {
    00975     XSI_DEBUG_VECTOR3;
    00976     return m_dX;
    00977 }
    00978
    00979 SICPPSDK_INLINE CVector3& CVector3::PutX(double in_dX)
    00980 {
    00981     m_dX = in_dX;
    00982     return (*this);
    00983 }
    00984
    00985 //*************************************************************************
    00999 //*************************************************************************
    01000 class SICPPSDKDECL CVector3Array
    01001 {
    01002 public:
    01006     CVector3Array( LONG in_size=0);
    01007
    01011     CVector3Array(const CVector3Array& in_Array);
    01012
    01014     ~CVector3Array();
    01015
    01020     CVector3Array& operator=( const CVector3Array& in_array );
    01021
    01025     LONG GetCount() const;
    01026
    01031     CStatus Add( const CVector3& in_item );
    01032
    01036     CStatus Clear();
    01037
    01043     CStatus Resize( LONG in_size);
    01044
    01051     const CVector3& operator[]( LONG in_index ) const;
    01052
    01058     CVector3& operator[]( LONG in_index );
    01059
    01065     bool operator==(const CVector3Array& in_array) const;
    01066
    01072     bool operator!=(const CVector3Array& in_array) const;
    01073
    01074
    01075 private:
    01076
    01077     void* m_ptr;
    01078 };
    01079
    01080 };
    01081 };
    01082
    01083 #endif // __XSIVECTOR3_H__