SIBCVector.h

Go to the documentation of this file.
00001 //***************************************************************************************
00002 // File supervisor: Crosswalk team
00012 //***************************************************************************************
00013 
00014 //***************************************************************************************
00015 // Defines
00016 //***************************************************************************************
00017 #ifndef __CSIBCVector_H__
00018 #define __CSIBCVector_H__
00019 
00020 //***************************************************************************************
00021 // Includes
00022 //**************************************************************************************
00023 #include <math.h>
00024 #include <SIBCUtil.h>
00025 
00026 //***************************************************************************************
00027 // Macros
00028 //***************************************************************************************
00029 #define SIBCVECTOR_EPS 0.00001f     
00031 #ifdef _PSX2_ASM
00032 #include "libvu0.h"
00033 #endif
00034 
00035 
00036 //***************************************************************************************
00037 // CSIBCVector2D | General purpose 2D vector class.
00038 //***************************************************************************************
00039 
00052 class XSICOREEXPORT CSIBCVector2D
00053 {
00054     public:
00055 
00059         CSIBCVector2D();
00060 
00065         CSIBCVector2D(const CSIBCVector2D& i_vVector);
00066 
00072         CSIBCVector2D(const SI_Float i_fX, const SI_Float i_fY);
00073 
00074         ~CSIBCVector2D();
00075 
00076         // Comparison
00077 
00088         SI_Bool IsAlmostEqualTo(const CSIBCVector2D& i_vVector, const SI_Float i_fEpsilon);
00089 
00099         SI_Bool IsOrthogonalTo(const CSIBCVector2D& i_vVector);
00100 
00108         SI_Bool IsNull() const;
00109 
00110         // Computed Info
00111 
00117         SI_Float GetDot(const CSIBCVector2D& i_vVector) const;
00118 
00124         SI_Float GetDistanceFrom(const CSIBCVector2D& i_vVector) const;
00125 
00132         SI_Float GetLength() const;
00133 
00140         SI_Float GetSquaredLength() const;
00141 
00148         SI_Float GetMaxComponent(SI_Int * o_nIndex) const;
00149 
00156         SI_Float GetMinComponent(SI_Int * o_nIndex) const;
00157 
00158         // Components
00159 
00167         void Get(SI_Float* o_fX, SI_Float* o_fY) const;
00168 
00175         const SI_Float GetX() const { return m_fX; }
00176 
00183         const SI_Float GetY() const { return m_fY; }
00184 
00193         CSIBCVector2D& Set(SI_Float i_fX, SI_Float i_fY);
00194 
00201         const void SetX(const SI_Float i_fX) { m_fX = i_fX; }
00202 
00209         const void SetY(const SI_Float i_fY) { m_fY = i_fY; }
00210 
00211         // Operations
00212 
00219         CSIBCVector2D& Normalize();
00220 
00226         CSIBCVector2D& SetNull();
00227 
00235         CSIBCVector2D& SetLength(const SI_Float i_fLength);
00236 
00241         CSIBCVector2D& Negate();
00242 
00248         CSIBCVector2D& Add(const CSIBCVector2D& i_vVector);
00249 
00254         CSIBCVector2D& Sub(const CSIBCVector2D& );
00255 
00262         CSIBCVector2D& Scale(const SI_Float i_fScale);
00263 
00270         CSIBCVector2D& MulComp(const CSIBCVector2D& i_vVector);
00271 
00279         CSIBCVector2D& DivComp(const CSIBCVector2D& i_vVector);
00280 
00281         // overloaded operators
00282 
00292         SI_Bool operator == (const CSIBCVector2D& i_vVector) const;
00293 
00303         SI_Bool operator != (const CSIBCVector2D& i_vVector) const;
00304 
00311         CSIBCVector2D operator+(const CSIBCVector2D &i_vVector) const;
00312 
00319         CSIBCVector2D operator-(const CSIBCVector2D &i_vVector) const;
00320 
00326         CSIBCVector2D operator/(const CSIBCVector2D &i_vVector) const;
00327 
00334         CSIBCVector2D operator*(const SI_Float i_fFloat) const;
00335 
00336         // Debug functions
00337 
00342         void    Dump();
00343 
00345         float   m_fX;
00346 
00348         float   m_fY;
00349 
00350 
00351     protected:
00352 };
00353 
00354 //***************************************************************************************
00355 // CSIBCVector3D | General purpose 3D vector class.
00356 //***************************************************************************************
00357 
00370 class XSICOREEXPORT CSIBCVector3D
00371 {
00372     public:
00373 
00374         // Constructors and destructor
00378         CSIBCVector3D();
00379 
00384         CSIBCVector3D(const CSIBCVector3D& i_vVector);
00385 
00393         CSIBCVector3D(const SI_Float i_fX, const SI_Float i_fY, const SI_Float i_fZ);
00394 
00395         ~CSIBCVector3D() {;}
00396 
00397         // Comparison
00398 
00410         SI_Bool IsAlmostEqualTo(const CSIBCVector3D& i_vVector, const SI_Float i_fEpsilon);
00411 
00422         SI_Bool IsOrthogonalTo(const CSIBCVector3D& i_vVector);
00423 
00432         SI_Bool IsNull() const;
00433 
00434         // Computed Info
00435 
00441         SI_Float GetDot(const CSIBCVector3D& i_vVector) const;
00442 
00448         SI_Float GetDistanceFrom(const CSIBCVector3D& i_vVector) const;
00449 
00456         SI_Float GetLength() const;
00457 
00464         SI_Float GetSquaredLength() const;
00465 
00472         SI_Float GetMaxComponent(SI_Int * o_nIndex) const;
00473 
00480         SI_Float GetMinComponent(SI_Int * o_nIndex) const;
00481 
00482         // Components
00483 
00494         void Get(SI_Float* o_fX, SI_Float* o_fY, SI_Float* o_fZ) const;
00495 
00503         SI_Float GetX() const { return m_fX; }
00504 
00512         SI_Float GetY() const { return m_fY; }
00513 
00521         SI_Float GetZ() const { return m_fZ; }
00522 
00531         SI_Float GetW() const { return 1.0; }
00532 
00533 
00541         CSIBCVector3D& Set(SI_Float i_fX, SI_Float i_fY, SI_Float i_fZ);
00542 
00543         // Operations
00544 
00551         CSIBCVector3D& Normalize();
00552 
00558         CSIBCVector3D& SetNull();
00559 
00567         CSIBCVector3D& SetLength(const SI_Float i_fLength);
00568 
00574         CSIBCVector3D& SetCross(const CSIBCVector3D& i_vVector);
00575 
00580         CSIBCVector3D& Negate();
00581 
00587         CSIBCVector3D& Add(const CSIBCVector3D& i_vVector);
00588 
00594         CSIBCVector3D& Sub(const CSIBCVector3D& i_vVector);
00595 
00603         CSIBCVector3D& Scale(const SI_Float i_fScale);
00604 
00610         CSIBCVector3D& Scale(CSIBCVector3D& o_vDest, const SI_Float i_fScale);
00611 
00620         CSIBCVector3D& MulComp(const CSIBCVector3D& i_vVector);
00621 
00629         CSIBCVector3D& DivComp(const CSIBCVector3D& i_vVector);
00630 
00637         CSIBCVector3D  CrossProduct( const CSIBCVector3D& i_vVector)  const;
00638 
00646         void ScaleAndAdd(CSIBCVector3D& io_vDest, const SI_Float i_fScale);
00647 
00648         // overloaded operators
00649 
00659         SI_Bool operator == (const CSIBCVector3D& i_vVector) const;
00660 
00670         SI_Bool operator != (const CSIBCVector3D& i_vVector) const;
00671 
00680         CSIBCVector3D operator+(const CSIBCVector3D &i_vVector) const;
00681 
00691         CSIBCVector3D operator+(const SI_Float &i_fFloat) const;
00692 
00701         CSIBCVector3D operator-(const CSIBCVector3D &i_vVector) const;
00702 
00712         CSIBCVector3D operator-(const SI_Float &i_fFloat) const;
00713 
00719         CSIBCVector3D operator/(const CSIBCVector3D &i_vVector) const;
00720 
00727         CSIBCVector3D operator*(const SI_Float i_fFloat) const;
00728 
00732         void    Dump();
00733 
00735         float   m_fX;
00736 #ifdef _PSX2_ASM
00737             __attribute__((aligned (16)))   // XYZ components (W is just padding)
00738 #endif
00739 
00741         float   m_fY;
00742 
00744         float   m_fZ;
00745 
00746 
00747 };
00748 
00749 
00750 //***************************************************************************************
00751 // CSIBCVector4D | General purpose vector class.
00752 //***************************************************************************************
00753 
00766 class XSICOREEXPORT CSIBCVector4D
00767 {
00768     public:
00769 
00770         // Constructors and destructor
00771 
00775         CSIBCVector4D();
00776 
00781         CSIBCVector4D(const CSIBCVector4D& i_vVector);
00782 
00791         CSIBCVector4D(  const SI_Float i_fX, const SI_Float i_fY,
00792                         const SI_Float i_fZ, const SI_Float i_fW);
00793 
00800         CSIBCVector4D(  const CSIBCVector3D& i_vVct, const SI_Float i_fW = 1.0f);
00801 
00802         ~CSIBCVector4D();
00803 
00804         // Comparison
00805 
00816         SI_Bool IsAlmostEqualTo(const CSIBCVector4D& i_vVector, const SI_Float i_fEpsilon);
00817 
00828         SI_Bool IsOrthogonalTo(const CSIBCVector4D& i_vVector);
00829 
00837         SI_Bool IsNull() const;
00838 
00839         // Computed Info
00840 
00846         SI_Float GetDot(const CSIBCVector4D& i_vVector) const;
00847 
00853         SI_Float GetDistanceFrom(const CSIBCVector4D& i_vVector) const;
00854 
00861         SI_Float GetLength() const;
00862 
00869         SI_Float GetSquaredLength() const;
00870 
00877         SI_Float GetMaxComponent(SI_Int * o_nIndex) const;
00878 
00885         SI_Float GetMinComponent(SI_Int * o_nIndex) const;
00886 
00887         // Components
00888 
00896         void Get(SI_Float* o_fX, SI_Float* o_fY, SI_Float* o_fZ, SI_Float* o_fW) const;
00897 
00907         CSIBCVector4D& Set(SI_Float i_fX, SI_Float i_fY, SI_Float i_fZ, SI_Float i_fW);
00908 
00909         // Operations
00910 
00917         CSIBCVector4D& Normalize();
00918 
00924         CSIBCVector4D& SetNull();
00925 
00933         CSIBCVector4D& SetLength(const SI_Float i_fLength);
00934 
00939         CSIBCVector4D& Negate();
00940 
00946         CSIBCVector4D& Add(const CSIBCVector4D& i_vVector);
00947 
00953         CSIBCVector4D& Sub(const CSIBCVector4D& i_vVector);
00954 
00960         CSIBCVector4D& Scale(const SI_Float i_fScale);
00961 
00968         CSIBCVector4D& MulComp(const CSIBCVector4D& i_vVector);
00969 
00977         CSIBCVector4D& DivComp(const CSIBCVector4D& i_vVector);
00978 
00979         // overloaded operators
00980 
00990         SI_Bool operator == (const CSIBCVector4D& i_vVector) const;
00991 
01001         SI_Bool operator != (const CSIBCVector4D& i_vVector) const;
01002 
01009         CSIBCVector4D operator+(const CSIBCVector4D & i_vVector);
01010 
01017         CSIBCVector4D operator-(const CSIBCVector4D & i_vVector);
01018 
01024         CSIBCVector4D operator/(const CSIBCVector4D & i_vVector);
01025 
01031         CSIBCVector4D &operator = (const CSIBCVector3D & i_vVector);
01032 
01033         // Debug functions
01034 
01038         void    Dump();
01039 
01041         float   m_fX;
01042 #ifdef _PSX2_ASM
01043             __attribute__((aligned (16)))
01044 #endif
01045 
01046         float   m_fY;
01047 
01049         float   m_fZ;
01050 
01052         float   m_fW;
01053 
01054     protected:
01055 };
01056 
01057 //***************************************************************************************
01058 //
01059 // Author : Softimage Games Team
01060 // Date   :
01061 //
01062 // Constructor.
01063 // CSIBCVector2D::CSIBCVector2D();
01064 // CSIBCVector2D::CSIBCVector2D( const CSIBCVector2D& in_vct );
01065 // CSIBCVector2D::CSIBCVector2D( const SI_Float in_dX, const SI_Float in_dY );
01066 //
01067 //***************************************************************************************
01068 inline CSIBCVector2D::CSIBCVector2D()
01069 {
01070     m_fX = 0.0f;
01071     m_fY = 0.0f;
01072 }
01073 
01074 
01075 //***************************************************************************************
01076 //
01077 // Author : Softimage Games Team
01078 // Date   :
01079 //
01080 // Copy constructor.
01081 // CSIBCVector2D& | in_vct | 2D vector to copy.
01082 //
01083 //***************************************************************************************
01084 inline CSIBCVector2D::CSIBCVector2D
01085 (
01086     const CSIBCVector2D& in_vct
01087 )
01088 {
01089     m_fX = in_vct.m_fX;
01090     m_fY = in_vct.m_fY;
01091 }
01092 
01093 
01094 
01095 
01096 //***************************************************************************************
01097 //
01098 // Author : Softimage Games Team
01099 // Date   :
01100 //
01101 // Constructor with xy values.
01102 // SI_Float | in_dX | X value of 2D vector.
01103 // SI_Float | in_dY | Y value of 2D vector.
01104 //
01105 //***************************************************************************************
01106 inline CSIBCVector2D::CSIBCVector2D
01107 (
01108     const SI_Float in_dX,
01109     const SI_Float in_dY
01110 )
01111 {
01112     m_fX = (SI_Float) in_dX;
01113     m_fY = (SI_Float) in_dY;
01114 }
01115 
01116 
01117 
01118 //***************************************************************************************
01119 //
01120 // Author : Softimage Games Team
01121 // Date   :
01122 //
01123 // Destructor. No dynamic allocation is done so this is empty.
01124 //
01125 //
01126 //***************************************************************************************
01127 inline CSIBCVector2D::~CSIBCVector2D()
01128 {
01129 }
01130 
01131 
01132 //***************************************************************************************
01133 //
01134 // Author : Softimage Games Team
01135 // Date   :
01136 //
01137 // Tests if this vector is almost equal to the other vector.
01138 //
01139 // CSIBCVector2D& | in_vct | 2D vector to compare.
01140 // SI_Float | in_dEpsilon | Error tolerance.
01141 // Returns a bool.
01142 //
01143 //***************************************************************************************
01144 inline SI_Bool CSIBCVector2D::IsAlmostEqualTo
01145 (
01146     const CSIBCVector2D&    in_vct,
01147     const SI_Float          in_dEpsilon
01148 )
01149 {
01150     return( fabs( m_fX - in_vct.m_fX ) < in_dEpsilon &&
01151             fabs( m_fY - in_vct.m_fY ) < in_dEpsilon);
01152 }
01153 
01154 
01155 //***************************************************************************************
01156 //
01157 // Author : Softimage Games Team
01158 // Date   :
01159 //
01160 // Tests if this vector is orthogonal (90 degrees) to another.
01161 //
01162 // CSIBCVector2D& | in_vct | 2D vector to compare.
01163 // Returns a bool
01164 //
01165 //***************************************************************************************
01166 inline SI_Bool CSIBCVector2D::IsOrthogonalTo
01167 (
01168     const CSIBCVector2D& in_vct
01169 )
01170 {
01171     if( fabs( GetDot( in_vct ) ) < SIBCVECTOR_EPS)
01172         return TRUE;
01173     else
01174         return FALSE;
01175 }
01176 
01177 //***************************************************************************************
01178 //
01179 // Author : Softimage Games Team
01180 // Date   :
01181 //
01182 // Tests if this vector is the null vector.
01183 //
01184 //
01185 //***************************************************************************************
01186 inline SI_Bool CSIBCVector2D::IsNull() const
01187 {
01188     // No test is done on W
01189     const SI_Float l_dEpsilon = SIBCVECTOR_EPS;
01190     return ( fabs( m_fX ) < l_dEpsilon &&
01191         fabs( m_fY ) < l_dEpsilon );
01192 }
01193 
01194 //***************************************************************************************
01195 //
01196 // Author : Softimage Games Team
01197 // Date   :
01198 //
01199 // Returns the dot product of this vector with another vector.
01200 // CSIBCVector2D& | in_vct | Input vector.
01201 // Returns dot product.
01202 //
01203 //***************************************************************************************
01204 inline SI_Float CSIBCVector2D::GetDot
01205 (
01206     const CSIBCVector2D& in_vct
01207 ) const
01208 {
01209     return ( m_fX*in_vct.m_fX + m_fY*in_vct.m_fY);
01210 }
01211 
01212 
01213 //***************************************************************************************
01214 //
01215 // Author : Softimage Games Team
01216 // Date   :
01217 //
01218 // Returns the distance of this vector to another one.
01219 //
01220 // CSIBCVector2D& | in_vct | Input vector.
01221 // Distance of input vector from another vector.
01222 //
01223 //***************************************************************************************
01224 inline SI_Float CSIBCVector2D::GetDistanceFrom
01225 (
01226     const CSIBCVector2D& in_vct
01227 ) const
01228 {
01229     SI_Float rx, ry;
01230 
01231     rx = m_fX-in_vct.m_fX;
01232     ry = m_fY-in_vct.m_fY;
01233 
01234     return (SI_Float)sqrt( rx*rx + ry*ry );
01235 }
01236 
01237 //***************************************************************************************
01238 //
01239 // Author : Softimage Games Team
01240 // Date   :
01241 //
01242 // Gets the squared length of this vector.
01243 // Returns the squared length of this vector.
01244 //
01245 //***************************************************************************************
01246 inline SI_Float CSIBCVector2D::GetSquaredLength() const
01247 {
01248     return( m_fX*m_fX + m_fY*m_fY );
01249 }
01250 
01251 //***************************************************************************************
01252 //
01253 // Author : Softimage Games Team
01254 // Date   :
01255 //
01256 // Gets the length of this vector.
01257 // Returns the length of this vector.
01258 //
01259 //***************************************************************************************
01260 inline SI_Float CSIBCVector2D::GetLength() const
01261 {
01262     return (SI_Float)sqrt( GetSquaredLength() );
01263 }
01264 
01265 
01266 //***************************************************************************************
01267 //
01268 // Author : Softimage Games Team
01269 // Date   :
01270 //
01271 // Retuns the XY values of this vector.
01272 //
01273 // SI_Float* | out_dX | X value of the vector to be returned.
01274 // SI_Float* | out_dY | Y value of the vector to be returned.
01275 //
01276 //***************************************************************************************
01277 inline void CSIBCVector2D::Get
01278 (
01279     SI_Float* out_dX,
01280     SI_Float* out_dY
01281 ) const
01282 {
01283     *out_dX = m_fX;
01284     *out_dY = m_fY;
01285 }
01286 
01287 
01288 //***************************************************************************************
01289 //
01290 // Author : Softimage Games Team
01291 // Date   :
01292 //
01293 // Sets the length of the vector to in_dLength units.
01294 //
01295 // SI_Float | in_dLength | Length to set the vector to.
01296 // Returns a pointer to the CSIBCVector2D object.
01297 //
01298 //***************************************************************************************
01299 inline CSIBCVector2D& CSIBCVector2D::SetLength
01300 (
01301     const SI_Float in_dLength
01302 )
01303 {
01304     SI_Float  rLen = GetLength();
01305 
01306     if ( rLen > SIBCVECTOR_EPS )
01307     {
01308         Scale( in_dLength / rLen );
01309         return *this;
01310     }
01311     else
01312         return *this;
01313 }
01314 
01315 
01316 //***************************************************************************************
01317 //
01318 // Author : Softimage Games Team
01319 // Date   :
01320 //
01321 // Normalizes the vector. If the vector is null then we initialize to (1,0).
01322 // Returns the normalized vector.
01323 //
01324 //***************************************************************************************
01325 inline CSIBCVector2D& CSIBCVector2D::Normalize()
01326 {
01327     SI_Float  rLen = GetLength();
01328 
01329     if ( rLen > SIBCVECTOR_EPS )
01330     {
01331         m_fX /= (SI_Float) rLen ;
01332         m_fY /= (SI_Float) rLen ;
01333         return *this;
01334     }
01335     else
01336     {
01337         return Set(1.0f, 0.0f);
01338     }
01339 }
01340 
01341 
01342 
01343 
01344 
01345 //***************************************************************************************
01346 //
01347 // Author : Softimage Games Team
01348 // Date   :
01349 //
01350 // Returns TRUE if this vector is the same as the other.
01351 //
01352 // CSIBCVector2D& | in_v | Input vector.
01353 // Returns a bool.
01354 //
01355 //***************************************************************************************
01356 inline SI_Bool CSIBCVector2D::operator ==
01357 (
01358     const CSIBCVector2D& in_v
01359 ) const
01360 {
01361     return ( ( m_fX == in_v.m_fX ) && ( m_fY == in_v.m_fY ) );
01362 }
01363 
01364 //***************************************************************************************
01365 //
01366 // Author : Softimage Games Team
01367 // Date   :
01368 //
01369 // Returns TRUE if this vector is different from the other.
01370 // CSIBCVector2D& | in_vct | Input vector.
01371 // Returns a bool.
01372 //
01373 //***************************************************************************************
01374 inline SI_Bool CSIBCVector2D::operator !=
01375 (
01376     const CSIBCVector2D& in_vct
01377 ) const
01378 {
01379     return !( *this==in_vct ) ;
01380 }
01381 
01382 //***************************************************************************************
01383 //
01384 // Author : Softimage Games Team
01385 // Date   :
01386 //
01387 // Adds two vectors.
01388 // CSIBCVector2D& | in_vtx | Input vector.
01389 // Returns a new CSIBCVector2D.
01390 //
01391 //***************************************************************************************
01392 inline CSIBCVector2D CSIBCVector2D::operator+
01393 (
01394     const CSIBCVector2D &in_vtx
01395 )  const
01396 {
01397     CSIBCVector2D v2;
01398 
01399     v2.m_fX = m_fX + in_vtx.m_fX;
01400     v2.m_fY = m_fY + in_vtx.m_fY;
01401 
01402     return v2;
01403 }
01404 
01405 //***************************************************************************************
01406 //
01407 // Author : Softimage Games Team
01408 // Date   :
01409 //
01410 // Vector sub operator.
01411 // CSIBCVector2D& | in_vtx | Input vector.
01412 // Returns a new CSIBCVector2D.
01413 //
01414 //***************************************************************************************
01415 inline CSIBCVector2D CSIBCVector2D::operator-
01416 (
01417     const CSIBCVector2D &in_vtx
01418 ) const
01419 {
01420     CSIBCVector2D v2;
01421 
01422     v2.m_fX = m_fX - in_vtx.m_fX;
01423     v2.m_fY = m_fY - in_vtx.m_fY;
01424 
01425     return v2;
01426 }
01427 
01428 //***************************************************************************************
01429 //
01430 // Author : Softimage Games Team
01431 // Date   :
01432 //
01433 // Vector divide operator.
01434 // CSIBCVector2D& | in_vtx | Input vector.
01435 // Returns a new CSIBCVector2D.
01436 //
01437 //***************************************************************************************
01438 inline CSIBCVector2D CSIBCVector2D::operator/
01439 (
01440     const CSIBCVector2D &in_vtx
01441 ) const
01442 {
01443     CSIBCVector2D v2;
01444 
01445     if ((in_vtx.m_fX != 0.0f) &&
01446         (in_vtx.m_fY != 0.0f))
01447     {
01448         v2.m_fX = m_fX / in_vtx.m_fX;
01449         v2.m_fY = m_fY / in_vtx.m_fY;
01450     }
01451 
01452     return v2;
01453 }
01454 
01455 //***************************************************************************************
01456 //
01457 // Author : Softimage Games Team
01458 // Date   :
01459 //
01460 // Vector multiply operator.
01461 // CSIBCVector2D& | in_vtx | Input vector.
01462 // Returns a new CSIBCVector2D.
01463 //
01464 //***************************************************************************************
01465 inline CSIBCVector2D CSIBCVector2D::operator*
01466 (
01467     const SI_Float in_flt
01468 ) const
01469 {
01470     CSIBCVector2D v2;
01471 
01472     v2.m_fX = m_fX * in_flt;
01473     v2.m_fY = m_fY * in_flt;
01474 
01475     return v2;
01476 }
01477 
01478 //***************************************************************************************
01479 //
01480 // Author : Softimage Games Team
01481 // Date   :
01482 //
01483 // Sets the vector to the NULL vector.
01484 // Returns a NULL vector.
01485 //
01486 //***************************************************************************************
01487 inline CSIBCVector2D& CSIBCVector2D::SetNull()
01488 {
01489     m_fX = m_fY = 0.0f;
01490 
01491     return *this;
01492 }
01493 
01494 //***************************************************************************************
01495 //
01496 // Author : Softimage Games Team
01497 // Date   :
01498 //
01499 // Sets this vector to be the opposite vector.
01500 // Returns a vector which is the opposite.
01501 //
01502 //***************************************************************************************
01503 inline CSIBCVector2D& CSIBCVector2D::Negate()
01504 {
01505     m_fX = -m_fX;
01506     m_fY = -m_fY;
01507     return *this;
01508 }
01509 
01510 
01511 //***************************************************************************************
01512 //
01513 // Author : Softimage Games Team
01514 // Date   :
01515 //
01516 // Adds a vector to this vector.
01517 // CSIBCVector2D& | in_vct | Input vector.
01518 // Returns a pointer to a new CSIBCVector2D.
01519 //
01520 //***************************************************************************************
01521 inline CSIBCVector2D& CSIBCVector2D::Add
01522 (
01523     const CSIBCVector2D& in_vct
01524 )
01525 {
01526     m_fX += in_vct.m_fX;
01527     m_fY += in_vct.m_fY;
01528     return *this;
01529 }
01530 
01531 
01532 //***************************************************************************************
01533 //
01534 // Author : Softimage Games Team
01535 // Date   :
01536 //
01537 // Substracts a vector from this vector.
01538 // CSIBCVector2D& | in_vct | Input vector.
01539 // Returns a pointer to a new CSIBCVector2D.
01540 //
01541 //***************************************************************************************
01542 inline CSIBCVector2D& CSIBCVector2D::Sub
01543 (
01544     const CSIBCVector2D& in_vct
01545 )
01546 {
01547     m_fX -= in_vct.m_fX;
01548     m_fY -= in_vct.m_fY;
01549     return *this;
01550 }
01551 
01552 
01553 //***************************************************************************************
01554 //
01555 // Author : Softimage Games Team
01556 // Date   :
01557 //
01558 // Scales a vector by a given factor.
01559 // SI_Float | in_dFactor | Scale factor.
01560 // Returns a pointer to a new CSIBCVector2D.
01561 //
01562 //***************************************************************************************
01563 inline CSIBCVector2D& CSIBCVector2D::Scale
01564 (
01565     const SI_Float in_dFactor
01566 )
01567 {
01568     m_fX *= (SI_Float) in_dFactor;
01569     m_fY *= (SI_Float) in_dFactor;
01570     return *this;
01571 }
01572 
01573 
01574 //***************************************************************************************
01575 //
01576 // Author : Softimage Games Team
01577 // Date   :
01578 //
01579 // Does component-wise multiplication of the vector.
01580 // CSIBCVector2D& | in_vct | Input vector.
01581 // Returns a pointer to a new CSIBCVector2D.
01582 //
01583 //***************************************************************************************
01584 inline CSIBCVector2D& CSIBCVector2D::MulComp
01585 (
01586      const CSIBCVector2D& in_vct
01587 )
01588 {
01589     m_fX *= in_vct.m_fX;
01590     m_fY *= in_vct.m_fY;
01591     return *this;
01592 }
01593 
01594 
01595 //***************************************************************************************
01596 //
01597 // Author : Softimage Games Team
01598 // Date   :
01599 //
01600 // Does component-wise division of the vector.
01601 // CSIBCVector2D& | in_vct | Input vector.
01602 // Returns a pointer to a new CSIBCVector2D.
01603 //
01604 //***************************************************************************************
01605 inline CSIBCVector2D& CSIBCVector2D::DivComp
01606 (
01607     const CSIBCVector2D& in_vct
01608 )
01609 {
01610     if (in_vct.m_fX != 0.0f &&
01611         in_vct.m_fY != 0.0f)
01612     {
01613         m_fX /= in_vct.m_fX;
01614         m_fY /= in_vct.m_fY;
01615     }
01616 
01617     return *this;
01618 }
01619 
01620 
01621 //***************************************************************************************
01622 //
01623 // Author : Softimage Games Team
01624 // Date   :
01625 //
01626 // Sets the xy values of this vector.
01627 //
01628 // SI_Float | in_dX | x value of the vector.
01629 // SI_Float | in_dY | y value of the vector.
01630 // Returns a pointer to the new CSIBCVector2D object.
01631 //
01632 //***************************************************************************************
01633 inline CSIBCVector2D& CSIBCVector2D::Set
01634 (
01635     SI_Float in_dX,
01636     SI_Float in_dY
01637 )
01638 {
01639     m_fX = (SI_Float) in_dX;
01640     m_fY = (SI_Float) in_dY;
01641     return *this;
01642 }
01643 
01644 //***************************************************************************************
01645 //
01646 // Author : Softimage Games Team
01647 // Date   :
01648 //
01649 // Constructor.
01650 //
01651 // CSIBCVector3D::CSIBCVector3D();
01652 // CSIBCVector3D::CSIBCVector3D( const CSIBCVector3D& in_vct );
01653 // CSIBCVector3D::CSIBCVector3D( const SI_Float in_dX, const SI_Float in_dY, const SI_Float in_dZ );
01654 //
01655 //***************************************************************************************
01656 inline CSIBCVector3D::CSIBCVector3D()
01657 {
01658     m_fX = 0.0f;
01659     m_fY = 0.0f;
01660     m_fZ = 0.0f;
01661 }
01662 
01663 
01664 //***************************************************************************************
01665 //
01666 // Author : Softimage Games Team
01667 // Date   :
01668 //
01669 // Copy constructor.
01670 // CSIBCVector3D& | in_vct | Input vector to be copied.
01671 //
01672 //***************************************************************************************
01673 inline CSIBCVector3D::CSIBCVector3D
01674 (
01675     const CSIBCVector3D& in_vct
01676 )
01677 {
01678     m_fX = in_vct.m_fX;
01679     m_fY = in_vct.m_fY;
01680     m_fZ = in_vct.m_fZ;
01681 }
01682 
01683 
01684 
01685 
01686 //***************************************************************************************
01687 //
01688 // Author : Softimage Games Team
01689 // Date   :
01690 //
01691 // Constructor with xyz values. We assume w = 1.
01692 // SI_Float | in_dX | x value of the vector.
01693 // SI_Float | in_dY | y value of the vector.
01694 // SI_Float | in_dZ | z value of the vector.
01695 //
01696 //***************************************************************************************
01697 inline CSIBCVector3D::CSIBCVector3D
01698 (
01699     const SI_Float in_dX,
01700     const SI_Float in_dY,
01701     const SI_Float in_dZ
01702 )
01703 {
01704     m_fX = (SI_Float) in_dX;
01705     m_fY = (SI_Float) in_dY;
01706     m_fZ = (SI_Float) in_dZ;
01707 }
01708 
01709 
01710 
01711 
01712 //***************************************************************************************
01713 //
01714 // Author : Softimage Games Team
01715 // Date   :
01716 //
01717 // Tests if this vector is almost equal to the other vector.
01718 //
01719 // CSIBCVector3D& | in_vct | 3D vector to compare.
01720 // SI_Float | in_dEpsilon | Error tolerance.
01721 // Returns a boolean.
01722 //***************************************************************************************
01723 inline SI_Bool CSIBCVector3D::IsAlmostEqualTo
01724 (
01725     const CSIBCVector3D&    in_vct,
01726     const SI_Float          in_dEpsilon
01727 )
01728 {
01729     return( fabs( m_fX - in_vct.m_fX ) < in_dEpsilon &&
01730               fabs( m_fY - in_vct.m_fY ) < in_dEpsilon &&
01731               fabs( m_fZ - in_vct.m_fZ ) < in_dEpsilon ) ;
01732 }
01733 
01734 
01735 //***************************************************************************************
01736 //
01737 // Author : Softimage Games Team
01738 // Date   :
01739 //
01740 // Tests if this vector is orthogonal (90 degrees) to another.
01741 // CSIBCVector3D& | in_vct | 3D vector to compare.
01742 // Returns a boolean.
01743 //
01744 //***************************************************************************************
01745 inline SI_Bool CSIBCVector3D::IsOrthogonalTo
01746 (
01747     const CSIBCVector3D& in_vct
01748 )
01749 {
01750     if( fabs( GetDot( in_vct ) ) < SIBCVECTOR_EPS)
01751         return TRUE;
01752     else
01753         return FALSE;
01754 }
01755 
01756 
01757 //***************************************************************************************
01758 //
01759 // Author : Softimage Games Team
01760 // Date   :
01761 //
01762 // Tests if this vector is the null vector.
01763 // Returns a boolean.
01764 //
01765 //
01766 //***************************************************************************************
01767 inline SI_Bool CSIBCVector3D::IsNull() const
01768 {
01769     // No test is done on W
01770     const SI_Float l_dEpsilon = SIBCVECTOR_EPS;
01771     return ( fabs( m_fX ) < l_dEpsilon &&
01772             fabs( m_fY ) < l_dEpsilon &&
01773             fabs( m_fZ ) < l_dEpsilon );
01774 }
01775 
01776 //***************************************************************************************
01777 //
01778 // Author : Softimage Games Team
01779 // Date   :
01780 //
01781 // Gets the dot product of this vector with another vector.
01782 // CSIBCVector3D& | in_vct | 3D vector to compare.
01783 // Returns the dot product of this vector with another vector.
01784 //
01785 //***************************************************************************************
01786 inline SI_Float CSIBCVector3D::GetDot
01787 (
01788     const CSIBCVector3D& in_vct
01789 ) const
01790 {
01791 #ifdef _PSX2_ASM
01792     float fRet[4] __attribute__((aligned (16)));
01793     asm ("
01794         lqc2            vf4,0x0(%1)
01795         lqc2            vf5,0x0(%2)
01796         vmul.xyz        vf5,vf4,vf5
01797         vaddy.x         vf5,vf5,vf5
01798         vaddz.x         vf5,vf5,vf5
01799         sqc2            vf5,0x0(%0)
01800     ": : "=r" (fRet), "r" (&m_fX), "r" ( &(in_vct.m_fX)) );
01801 
01802     return fRet[0];
01803 #else
01804     return ( in_vct.m_fX * m_fX + in_vct.m_fY * m_fY + in_vct.m_fZ * m_fZ );
01805 #endif
01806 }
01807 
01808 
01809 //***************************************************************************************
01810 //
01811 // Author : Softimage Games Team
01812 // Date   :
01813 //
01814 // Gets the distance of this vector to another one.
01815 // Returns the dot product of this vector with another vector.
01816 // Returns the distance of this vector to another one.
01817 //***************************************************************************************
01818 inline SI_Float CSIBCVector3D::GetDistanceFrom
01819 (
01820     const CSIBCVector3D& in_vct
01821 ) const
01822 {
01823 #ifdef _PSX2_ASM
01824     float fRet[4] __attribute__((aligned (16)));
01825 
01826     asm ("
01827         lqc2            vf4,0x0(%1)
01828         lqc2            vf5,0x0(%2)
01829         vsub.xyz        vf5,vf4,vf5
01830         vmul.xyz        vf5,vf5,vf5
01831         vaddy.x         vf5,vf5,vf5
01832         vaddz.x         vf5,vf5,vf5
01833         sqc2            vf5,0x0(%0)
01834     ": : "=r" (fRet), "r" (&m_fX), "r" ( &(in_vct.m_fX)) );
01835 
01836     return (SI_Float)sqrt(fRet[0]);
01837 #else
01838     SI_Float rx, ry, rz;
01839 
01840     rx = m_fX-in_vct.m_fX;
01841     ry = m_fY-in_vct.m_fY;
01842     rz = m_fZ-in_vct.m_fZ;
01843 
01844     return (SI_Float)sqrt( rx*rx + ry*ry + rz*rz );
01845 #endif
01846 }
01847 
01848 //***************************************************************************************
01849 //
01850 // Author : Softimage Games Team
01851 // Date   :
01852 //
01853 // Gets the length of this vector.
01854 // Returns the length of this vector.
01855 //
01856 //***************************************************************************************
01857 inline SI_Float CSIBCVector3D::GetLength() const
01858 {
01859 #ifdef _PSX2_ASM
01860     SI_Float fRet[4] __attribute__((aligned (16)));
01861 
01862     asm ("
01863         lqc2            vf5,0x0(%1)
01864         vmul.xyz        vf5,vf5,vf5
01865         vaddy.x         vf5,vf5,vf5
01866         vaddz.x         vf5,vf5,vf5
01867         cop2            2425789
01868         vwaitq
01869         vaddq.x         vf5,vf0,Q
01870         sqc2            vf5,0x0(%0)
01871     ": : "=r" (fRet), "r" (&m_fX) );
01872 
01873     return fRet[0];
01874 #else
01875    return (SI_Float)sqrt( GetSquaredLength() );
01876 #endif
01877 }
01878 
01879 //***************************************************************************************
01880 //
01881 // Author : Softimage Games Team
01882 // Date   :
01883 //
01884 // Gets the squared length of this vector.
01885 // Returns the squared length of this vector.
01886 //
01887 //***************************************************************************************
01888 inline SI_Float CSIBCVector3D::GetSquaredLength() const
01889 {
01890 #ifdef _PSX2_ASM
01891     SI_Float fRet[4] __attribute__((aligned (16)));
01892 
01893     asm ("
01894         lqc2            vf4,0x0(%1)
01895         vmul.xyz        vf4,vf4,vf4
01896         vaddy.x         vf4,vf4,vf4
01897         vaddz.x         vf4,vf4,vf4
01898         sqc2            vf4,0x0(%0)
01899     ": : "=r" (fRet), "r" (&m_fX) );
01900 
01901     return fRet[0];
01902 #else
01903     return( m_fX*m_fX + m_fY*m_fY + m_fZ*m_fZ );
01904 #endif
01905 }
01906 
01907 //***************************************************************************************
01908 //
01909 // Author : Softimage Games Team
01910 // Date   :
01911 //
01912 // Returns the XYZ values of this vector.
01913 //
01914 // SI_Float* | out_dX | x component of the vector.
01915 // SI_Float* | out_dY | y component of the vector.
01916 // SI_Float* | out_dZ | z component of the vector.
01917 //
01918 //***************************************************************************************
01919 inline void CSIBCVector3D::Get
01920 (
01921     SI_Float* out_dX,
01922     SI_Float* out_dY,
01923     SI_Float* out_dZ
01924 ) const
01925 {
01926     *out_dX = m_fX;
01927     *out_dY = m_fY;
01928     *out_dZ = m_fZ;
01929 }
01930 
01931 
01932 //***************************************************************************************
01933 //
01934 // Author : Softimage Games Team
01935 // Date   :
01936 //
01937 // Sets the length of the vector to in_dLength units.
01938 //
01939 // SI_Float | in_dLength | length to set the vector to.
01940 // Returns a pointer to the new vector.
01941 //
01942 //***************************************************************************************
01943 inline CSIBCVector3D& CSIBCVector3D::SetLength
01944 (
01945     const SI_Float in_dLength
01946 )
01947 {
01948     SI_Float  rLen = GetLength();
01949 
01950     if ( rLen > SIBCVECTOR_EPS )
01951     {
01952         Scale( in_dLength / rLen );
01953         return *this;
01954     }
01955     else
01956         return *this;
01957 }
01958 
01959 
01960 //***************************************************************************************
01961 //
01962 // Author : Softimage Games Team
01963 // Date   :
01964 //
01965 // Normalizes the vector. If the vector is null then we initialize to (1,0,0,0).
01966 // Returns the normalized vector.
01967 //
01968 //***************************************************************************************
01969 inline CSIBCVector3D& CSIBCVector3D::Normalize()
01970 {
01971 #ifdef _PSX2_ASM
01972     sceVu0Normalize( &m_fX, &m_fX );
01973 
01974     return *this;
01975 #else
01976     SI_Float  rLen = GetLength();
01977 
01978     if ( rLen > SIBCVECTOR_EPS )
01979     {
01980         m_fX /= (SI_Float) rLen ;
01981         m_fY /= (SI_Float) rLen ;
01982         m_fZ /= (SI_Float) rLen ;
01983         return *this;
01984     }
01985     else
01986     {
01987         return Set(1.0f, 0.0f, 0.0f);
01988     }
01989 #endif
01990 }
01991 
01992 
01993 
01994 
01995 
01996 //***************************************************************************************
01997 //
01998 // Author : Softimage Games Team
01999 // Date   :
02000 //
02001 // Returns TRUE if this vector is the same as the other.
02002 // CSIBCVector3D& | in_v | Input vector.
02003 // Returns a boolean.
02004 //
02005 //***************************************************************************************
02006 inline SI_Bool CSIBCVector3D::operator ==
02007 (
02008     const CSIBCVector3D& in_v
02009 ) const
02010 {
02011     return ( ( m_fX == in_v.m_fX ) && ( m_fY == in_v.m_fY ) && ( m_fZ == in_v.m_fZ ) );
02012 }
02013 
02014 //***************************************************************************************
02015 //
02016 // Author : Softimage Games Team
02017 // Date   :
02018 //
02019 // Returns TRUE if this vector is different from the other.
02020 // CSIBCVector3D& | in_v | Input vector.
02021 // Returns a boolean.
02022 //
02023 //***************************************************************************************
02024 inline SI_Bool CSIBCVector3D::operator !=
02025 (
02026     const CSIBCVector3D& in_vct
02027 ) const
02028 {
02029     return !( *this==in_vct ) ;
02030 }
02031 
02032 //***************************************************************************************
02033 //
02034 // Author : Softimage Games Team
02035 // Date   :
02036 //
02037 // Vector add operator.
02038 //
02039 // CSIBCVector3D& | in_vtx | Input vector.
02040 // Returns a new vector.
02041 //***************************************************************************************
02042 inline CSIBCVector3D CSIBCVector3D::operator+
02043 (
02044     const CSIBCVector3D &in_vtx
02045 ) const
02046 {
02047     CSIBCVector3D v2;
02048 
02049     v2.m_fX = m_fX + in_vtx.m_fX;
02050     v2.m_fY = m_fY + in_vtx.m_fY;
02051     v2.m_fZ = m_fZ + in_vtx.m_fZ;
02052 
02053     return v2;
02054 }
02055 
02056 inline CSIBCVector3D CSIBCVector3D::operator+
02057 (
02058     const SI_Float &in_flt
02059 ) const
02060 {
02061     CSIBCVector3D v2;
02062 
02063     v2.m_fX = m_fX + in_flt;
02064     v2.m_fY = m_fY + in_flt;
02065     v2.m_fZ = m_fZ + in_flt;
02066 
02067     return v2;
02068 }
02069 
02070 //***************************************************************************************
02071 //
02072 // Author : Softimage Games Team
02073 // Date   :
02074 //
02075 // Vector subtract operator.
02076 //
02077 // CSIBCVector3D& | in_vtx | Input vector.
02078 // Returns a new vector.
02079 //
02080 //***************************************************************************************
02081 inline CSIBCVector3D CSIBCVector3D::operator-
02082 (
02083     const CSIBCVector3D &in_vtx
02084 ) const
02085 {
02086     CSIBCVector3D v2;
02087 
02088     v2.m_fX = m_fX - in_vtx.m_fX;
02089     v2.m_fY = m_fY - in_vtx.m_fY;
02090     v2.m_fZ = m_fZ - in_vtx.m_fZ;
02091 
02092     return v2;
02093 }
02094 //***************************************************************************************
02095 //
02096 // Author : Softimage Games Team
02097 // Date   :
02098 //
02099 // Vector subtract operator.
02100 //
02101 // CSIBCVector3D& | in_flt | Input vector.
02102 // Returns a new vector.
02103 //
02104 //***************************************************************************************
02105 
02106 inline CSIBCVector3D CSIBCVector3D::operator-
02107 (
02108     const SI_Float &in_flt
02109 ) const
02110 {
02111     CSIBCVector3D v2;
02112 
02113     v2.m_fX = m_fX - in_flt;
02114     v2.m_fY = m_fY - in_flt;
02115     v2.m_fZ = m_fZ - in_flt;
02116 
02117     return v2;
02118 }
02119 
02120 //***************************************************************************************
02121 //
02122 // Author : Softimage Games Team
02123 // Date   :
02124 //
02125 // Vector divide operator.
02126 // CSIBCVector3D& | in_vtx | Iinput vector.
02127 // Returns a new vector.
02128 //
02129 //***************************************************************************************
02130 inline CSIBCVector3D CSIBCVector3D::operator/
02131 (
02132     const CSIBCVector3D &in_vtx
02133 ) const
02134 {
02135     CSIBCVector3D v2;
02136 
02137     if ((in_vtx.m_fX != 0.0f) &&
02138         (in_vtx.m_fY != 0.0f) &&
02139         (in_vtx.m_fZ != 0.0f))
02140     {
02141         v2.m_fX = m_fX / in_vtx.m_fX;
02142         v2.m_fY = m_fY / in_vtx.m_fY;
02143         v2.m_fZ = m_fZ / in_vtx.m_fZ;
02144     }
02145 
02146     return v2;
02147 }
02148 
02149 //***************************************************************************************
02150 //
02151 // Author : Softimage Games Team
02152 // Date   :
02153 //
02154 // Vector multiply operator.
02155 // SI_Float| factor | Multiplication factor.
02156 // Returns a new vector.
02157 //
02158 //***************************************************************************************
02159 inline CSIBCVector3D CSIBCVector3D::operator*
02160 (
02161     const SI_Float factor
02162 ) const
02163 {
02164     CSIBCVector3D v2;
02165 
02166     v2.m_fX = m_fX * factor;
02167     v2.m_fY = m_fY * factor;
02168     v2.m_fZ = m_fZ * factor;
02169 
02170     return v2;
02171 }
02172 //***************************************************************************************
02173 //
02174 // Author : Softimage Games Team
02175 // Date   :
02176 //
02177 // Sets the vector to the NULL vector.
02178 // Returns a pointer to the vector.
02179 //
02180 //***************************************************************************************
02181 inline CSIBCVector3D& CSIBCVector3D::SetNull()
02182 {
02183     m_fX = m_fY = m_fZ = 0.0f;
02184 
02185     return *this;
02186 }
02187 
02188 //***************************************************************************************
02189 //
02190 // Author : Softimage Games Team
02191 // Date   :
02192 //
02193 // Sets this vector to be the opposite vector.
02194 // Returns a pointer to the vector.
02195 //
02196 //***************************************************************************************
02197 inline CSIBCVector3D& CSIBCVector3D::Negate()
02198 {
02199     m_fX = -m_fX;
02200     m_fY = -m_fY;
02201     m_fZ = -m_fZ;
02202     return *this;
02203 }
02204 
02205 
02206 //***************************************************************************************
02207 //
02208 // Author : Softimage Games Team
02209 // Date   :
02210 //
02211 // Adds a vector to this vector.
02212 //
02213 // CSIBCVector3D& | in_vct | Input vector.
02214 // Returns a pointer to the vector.
02215 //***************************************************************************************
02216 inline CSIBCVector3D& CSIBCVector3D::Add
02217 (
02218     const CSIBCVector3D& in_vct
02219 )
02220 {
02221     m_fX += in_vct.m_fX;
02222     m_fY += in_vct.m_fY;
02223     m_fZ += in_vct.m_fZ;
02224     return *this;
02225 }
02226 
02227 
02228 //***************************************************************************************
02229 //
02230 // Author : Softimage Games Team
02231 // Date   :
02232 //
02233 // Substracts a vector from this vector.
02234 // CSIBCVector3D& | in_vct | Input vector.
02235 // Returns a pointer to the vector.
02236 //
02237 //***************************************************************************************
02238 inline CSIBCVector3D& CSIBCVector3D::Sub
02239 (
02240     const CSIBCVector3D& in_vct
02241 )
02242 {
02243     m_fX -= in_vct.m_fX;
02244     m_fY -= in_vct.m_fY;
02245     m_fZ -= in_vct.m_fZ;
02246     return *this;
02247 }
02248 
02249 
02250 //***************************************************************************************
02251 //
02252 // Author : Softimage Games Team
02253 // Date   :
02254 //
02255 // Scales a vector by a given factor.
02256 // SIFloat | in_dFactor | Scale factor.
02257 // Returns a pointer to the vector.
02258 //
02259 //***************************************************************************************
02260 inline CSIBCVector3D& CSIBCVector3D::Scale
02261 (
02262     const SI_Float in_dFactor
02263 )
02264 {
02265     m_fX *= (SI_Float) in_dFactor;
02266     m_fY *= (SI_Float) in_dFactor;
02267     m_fZ *= (SI_Float) in_dFactor;
02268     return *this;
02269 }
02270 
02271 
02272 //***************************************************************************************
02273 //
02274 // Author : Softimage Games Team
02275 // Date   :
02276 //
02277 // Scales a vector by a given factor.
02278 //
02279 // CSIBCVector3D& | o_V | Vector to apply scaling to.
02280 // SI_Float | in_dFactor | Scaling factor.
02281 // Returns a pointer to the vector.
02282 //
02283 //***************************************************************************************
02284 inline CSIBCVector3D& CSIBCVector3D::Scale
02285 (
02286     CSIBCVector3D &o_V,
02287     const SI_Float in_dFactor
02288 )
02289 {
02290     o_V.m_fX = m_fX * in_dFactor;
02291     o_V.m_fY = m_fY * in_dFactor;
02292     o_V.m_fZ = m_fZ * in_dFactor;
02293 
02294     return *this;
02295 }
02296 //***************************************************************************************
02297 //
02298 // Author : Softimage Games Team
02299 // Date   :
02300 //
02301 // Scales a vector by a given factor.
02302 //
02303 // CSIBCVector3D& | o_V | Vector to apply scaling to.
02304 // SI_Float | in_dFactor | Scaling factor.
02305 // Returns a pointer to the vector.
02306 //
02307 //***************************************************************************************
02308 inline void CSIBCVector3D::ScaleAndAdd
02309 (
02310     CSIBCVector3D &o_V,
02311     const SI_Float in_dFactor
02312 )
02313 {
02314     o_V.m_fX += (m_fX * in_dFactor);
02315     o_V.m_fY += (m_fY * in_dFactor);
02316     o_V.m_fZ += (m_fZ * in_dFactor);
02317 }
02318 
02319 //***************************************************************************************
02320 //
02321 // Author : Softimage Games Team
02322 // Date   :
02323 //
02324 // Does component wise multiplication of the vector.
02325 // CSIBCVector3D& | in_vct | Input vector.
02326 // Returns a pointer to the vector.
02327 //
02328 //***************************************************************************************
02329 inline CSIBCVector3D& CSIBCVector3D::MulComp
02330 (
02331      const CSIBCVector3D& in_vct
02332 )
02333 {
02334     m_fX *= in_vct.m_fX;
02335     m_fY *= in_vct.m_fY;
02336     m_fZ *= in_vct.m_fZ;
02337     return *this;
02338 }
02339 
02340 
02341 //***************************************************************************************
02342 //
02343 // Author : Softimage Games Team
02344 // Date   :
02345 //
02346 // Does component wise division of the vector.
02347 // CSIBCVector3D& | in_vct | Input vector.
02348 // Returns a pointer to the vector.
02349 //
02350 //***************************************************************************************
02351 inline CSIBCVector3D& CSIBCVector3D::DivComp
02352 (
02353     const CSIBCVector3D& in_vct
02354 )
02355 {
02356     if (in_vct.m_fX != 0.0f &&
02357         in_vct.m_fY != 0.0f &&
02358         in_vct.m_fZ != 0.0f)
02359     {
02360         m_fX /= in_vct.m_fX;
02361         m_fY /= in_vct.m_fY;
02362         m_fZ /= in_vct.m_fZ;
02363     }
02364 
02365     return *this;
02366 }
02367 
02368 //***************************************************************************************
02369 //
02370 // Author : Softimage Games Team
02371 // Date   :
02372 //
02373 // Sets this vector to be the cross product of this and the other vector.
02374 // CSIBCVector3D& | in_vct | Input vector.
02375 // Returns a pointer to the vector.
02376 //
02377 //***************************************************************************************
02378 inline CSIBCVector3D& CSIBCVector3D::SetCross
02379 (
02380     const CSIBCVector3D& in_vct
02381 )
02382 {
02383     SI_Float dX, dY, dZ;
02384 
02385     dX =  m_fY * in_vct.m_fZ - m_fZ * in_vct.m_fY ;
02386     dY = -m_fX * in_vct.m_fZ + m_fZ * in_vct.m_fX ;
02387     dZ =  m_fX * in_vct.m_fY - m_fY * in_vct.m_fX ;
02388 
02389    return( Set( dX, dY, dZ ) );
02390 }
02391 
02392 //***************************************************************************************
02393 //
02394 // Author : Softimage Games Team
02395 // Date   :
02396 //
02397 // Returns a cross product.
02398 // CSIBCVector3D& | in_vct | Input vector.
02399 // Returns the new.
02400 //
02401 //***************************************************************************************
02402 inline CSIBCVector3D  CSIBCVector3D::CrossProduct( const CSIBCVector3D &in_vct )  const
02403 {
02404     CSIBCVector3D tmp;
02405 #ifdef _PSX2_ASM
02406     sceVu0OuterProduct( &tmp.m_fX, (float*)&m_fX, (float*)&in_vct.m_fX );
02407 #else
02408     tmp.m_fX =  m_fY * in_vct.m_fZ - m_fZ * in_vct.m_fY ;
02409     tmp.m_fY = -m_fX * in_vct.m_fZ + m_fZ * in_vct.m_fX ;
02410     tmp.m_fZ =  m_fX * in_vct.m_fY - m_fY * in_vct.m_fX ;
02411 #endif
02412     return tmp;
02413 }
02414 
02415 //***************************************************************************************
02416 //
02417 // Author : Softimage Games Team
02418 // Date   :
02419 //
02420 // Sets the xyz values of this vector.
02421 //
02422 // SI_Float | in_dX | x component of the vector.
02423 // SI_Float | in_dY | y component of the vector.
02424 // SI_Float | in_dZ | z component of the vector.
02425 // Returns a pointer to the vector.
02426 //***************************************************************************************
02427 inline CSIBCVector3D& CSIBCVector3D::Set
02428 (
02429     SI_Float in_dX,
02430     SI_Float in_dY,
02431     SI_Float in_dZ
02432 )
02433 {
02434     m_fX = (SI_Float) in_dX;
02435     m_fY = (SI_Float) in_dY;
02436     m_fZ = (SI_Float) in_dZ;
02437 
02438     return *this;
02439 }
02440 
02441 //***************************************************************************************
02442 //
02443 // Author : Softimage Games Team
02444 // Date   :
02445 //
02446 // Constructor.
02447 //
02448 // CSIBCVector4D::CSIBCVector4D();
02449 // CSIBCVector4D::CSIBCVector4D( const CSIBCVector4D& in_vct );
02450 // inline CSIBCVector4D::CSIBCVector4D( const SI_Float in_dX, const SI_Float in_dY, const SI_Float in_dZ, const SI_Float in_dW );
02451 //
02452 //***************************************************************************************
02453 inline CSIBCVector4D::CSIBCVector4D()
02454 {
02455     m_fX = 0.0f;
02456     m_fY = 0.0f;
02457     m_fZ = 0.0f;
02458     m_fW = 0.0f;
02459 }
02460 
02461 
02462 //***************************************************************************************
02463 //
02464 // Author : Softimage Games Team
02465 // Date   :
02466 //
02467 // Copy constructor.
02468 // CSIBCVector4D& | in_vct | Input vector.
02469 //
02470 //
02471 //***************************************************************************************
02472 inline CSIBCVector4D::CSIBCVector4D
02473 (
02474     const CSIBCVector4D& in_vct
02475 )
02476 {
02477     m_fX = in_vct.m_fX;
02478     m_fY = in_vct.m_fY;
02479     m_fZ = in_vct.m_fZ;
02480     m_fW = in_vct.m_fW;
02481 }
02482 
02483 
02484 
02485 
02486 //***************************************************************************************
02487 //
02488 // Author : Softimage Games Team
02489 // Date   :
02490 //
02491 // Constructor with xyzw values.
02492 // SI_Float | in_dX | x component of the vector.
02493 // SI_Float | in_dY | y component of the vector.
02494 // SI_Float | in_dZ | z component of the vector.
02495 // SI_Float | in_dW | w component of the vector.
02496 //***************************************************************************************
02497 inline CSIBCVector4D::CSIBCVector4D
02498 (
02499     const SI_Float in_dX,
02500     const SI_Float in_dY,
02501     const SI_Float in_dZ,
02502     const SI_Float in_dW
02503 )
02504 {
02505     m_fX = (SI_Float) in_dX;
02506     m_fY = (SI_Float) in_dY;
02507     m_fZ = (SI_Float) in_dZ;
02508     m_fW = (SI_Float) in_dW;
02509 }
02510 
02511 //***************************************************************************************
02512 //
02513 // Author : Softimage Games Team
02514 // Date   :
02515 //
02516 // Constructor with xyzw values.
02517 // SIBCVector3D& | in_vVct | xyz component of the vector.
02518 // SI_Float | in_dW | w component of the vector.
02519 //***************************************************************************************
02520 inline CSIBCVector4D::CSIBCVector4D
02521 (
02522     const CSIBCVector3D& in_vVct, const SI_Float in_dW
02523 )
02524 {
02525     m_fX = in_vVct.m_fX;
02526     m_fY = in_vVct.m_fY;
02527     m_fZ = in_vVct.m_fZ;
02528     m_fW = in_dW;
02529 }
02530 
02531 //***************************************************************************************
02532 //
02533 // Author : Softimage Games Team
02534 // Date   :
02535 //
02536 // Destructor. No dynamic allocation is done so this is empty.
02537 //
02538 //
02539 //***************************************************************************************
02540 inline CSIBCVector4D::~CSIBCVector4D()
02541 {
02542 }
02543 
02544 
02545 //***************************************************************************************
02546 //
02547 // Author : Softimage Games Team
02548 // Date   :
02549 //
02550 // Tests if this vector is almost equal to the other vector.
02551 //
02552 // CSIBCVector4D& | in_vct | Input vector.
02553 // SI_Float | in_dEpsilon | Error tolerance.
02554 // Returns a boolean.
02555 //
02556 //***************************************************************************************
02557 inline SI_Bool CSIBCVector4D::IsAlmostEqualTo
02558 (
02559     const CSIBCVector4D&    in_vct,
02560     const SI_Float          in_dEpsilon
02561 )
02562 {
02563     return( fabs( m_fX - in_vct.m_fX ) < in_dEpsilon &&
02564         fabs( m_fY - in_vct.m_fY ) < in_dEpsilon &&
02565         fabs( m_fZ - in_vct.m_fZ ) < in_dEpsilon &&
02566         fabs( m_fW - in_vct.m_fW ) < in_dEpsilon ) ;
02567 }
02568 
02569 
02570 //***************************************************************************************
02571 //
02572 // Author : Softimage Games Team
02573 // Date   :
02574 //
02575 // Tests if this vector is orthogonal (90 degrees) to another.
02576 // CSIBCVector4D& | in_vct | Input vector.
02577 // Returns a boolean.
02578 //
02579 //***************************************************************************************
02580 inline SI_Bool CSIBCVector4D::IsOrthogonalTo
02581 (
02582     const CSIBCVector4D& in_vct
02583 )
02584 {
02585     if( fabs( GetDot( in_vct ) ) < SIBCVECTOR_EPS)
02586         return TRUE;
02587     else
02588         return FALSE;
02589 }
02590 
02591 
02592 //***************************************************************************************
02593 //
02594 // Author : Softimage Games Team
02595 // Date   :
02596 //
02597 // Tests if this vector is the null vector.
02598 // Returns a boolean.
02599 //
02600 //***************************************************************************************
02601 inline SI_Bool CSIBCVector4D::IsNull() const
02602 {
02603     // No test is done on W
02604     const SI_Float l_dEpsilon = SIBCVECTOR_EPS;
02605     return ( fabs( m_fX ) < l_dEpsilon &&
02606         fabs( m_fY ) < l_dEpsilon &&
02607         fabs( m_fZ ) < l_dEpsilon &&
02608         fabs( m_fW ) < l_dEpsilon );
02609 }
02610 
02611 //***************************************************************************************
02612 //
02613 // Author : Softimage Games Team
02614 // Date   :
02615 //
02616 // Gets the dot product of this vector with another vector.
02617 //
02618 // CSIBCVector4D& | in_vct | Input vector.
02619 // Returns the dot product of this vector with another vector.
02620 //
02621 //***************************************************************************************
02622 inline SI_Float CSIBCVector4D::GetDot
02623 (
02624     const CSIBCVector4D& in_vct
02625 ) const
02626 {
02627     return ( m_fX*in_vct.m_fX + m_fY*in_vct.m_fY + m_fZ*in_vct.m_fZ + m_fW*in_vct.m_fW);
02628 }
02629 
02630 
02631 //***************************************************************************************
02632 //
02633 // Author : Softimage Games Team
02634 // Date   :
02635 //
02636 // Gets the distance of this vector to another one.
02637 //
02638 // CSIBCVector4D& | in_vct | Input vector.
02639 // Returns the distance of this vector to another one.
02640 //
02641 //***************************************************************************************
02642 inline SI_Float CSIBCVector4D::GetDistanceFrom
02643 (
02644     const CSIBCVector4D& in_vct
02645 ) const
02646 {
02647     SI_Float rx, ry, rz, rw;
02648 
02649     rx = m_fX-in_vct.m_fX;
02650     ry = m_fY-in_vct.m_fY;
02651     rz = m_fZ-in_vct.m_fZ;
02652     rw = m_fW-in_vct.m_fW;
02653 
02654     return (SI_Float)sqrt( rx*rx + ry*ry + rz*rz + rw*rw );
02655 }
02656 
02657 //***************************************************************************************
02658 //
02659 // Author : Softimage Games Team
02660 // Date   :
02661 //
02662 // Returns the length of this vector.
02663 //
02664 //***************************************************************************************
02665 inline SI_Float CSIBCVector4D::GetLength() const
02666 {
02667     return (SI_Float)sqrt( GetSquaredLength() );
02668 }
02669 
02670 //***************************************************************************************
02671 //
02672 // Author : Softimage Games Team
02673 // Date   :
02674 //
02675 // Gets the squared length of this vector.
02676 // Returns the suqared length of this vector.
02677 //
02678 //***************************************************************************************
02679 inline SI_Float CSIBCVector4D::GetSquaredLength() const
02680 {
02681     return( m_fX*m_fX + m_fY*m_fY + m_fZ*m_fZ + m_fW*m_fW);
02682 }
02683 
02684 //***************************************************************************************
02685 //
02686 // Author : Softimage Games Team
02687 // Date   :
02688 //
02689 // Gets the XYZW values of this vector.
02690 //
02691 // SI_Float* | out_dX | the x component of the vector.
02692 // SI_Float* | out_dY | the y component of the vector.
02693 // SI_Float* | out_dZ | the z component of the vector.
02694 // SI_Float* | out_dW | the w component of the vector.
02695 //***************************************************************************************
02696 inline void CSIBCVector4D::Get
02697 (
02698     SI_Float* out_dX,
02699     SI_Float* out_dY,
02700     SI_Float* out_dZ,
02701     SI_Float* out_dW
02702 ) const
02703 {
02704     *out_dX = m_fX;
02705     *out_dY = m_fY;
02706     *out_dZ = m_fZ;
02707     *out_dW = m_fW;
02708 }
02709 
02710 //***************************************************************************************
02711 //
02712 // Author : Softimage Games Team
02713 // Date   :
02714 //
02715 // Sets the length of the vector to in_dLength units.
02716 //
02717 // SI_Float | in_dLength | Length of the vector.
02718 // Returns a pointer to a vector object.
02719 //
02720 //***************************************************************************************
02721 inline CSIBCVector4D& CSIBCVector4D::SetLength
02722 (
02723     const SI_Float in_dLength
02724 )
02725 {
02726     SI_Float  rLen = GetLength();
02727 
02728     if ( rLen > SIBCVECTOR_EPS )
02729     {
02730         Scale( in_dLength / rLen );
02731         return *this;
02732     }
02733     else
02734         return *this;
02735 }
02736 
02737 
02738 //***************************************************************************************
02739 //
02740 // Author : Softimage Games Team
02741 // Date   :
02742 //
02743 // Normalizes the vector. If the vector is null then we initialize to (1,0,0,0).
02744 // Returns a pointer to a vector object.
02745 //
02746 //***************************************************************************************
02747 inline CSIBCVector4D& CSIBCVector4D::Normalize()
02748 {
02749     SI_Float  rLen = GetLength();
02750 
02751     if ( rLen > SIBCVECTOR_EPS )
02752     {
02753         m_fX /= (SI_Float) rLen ;
02754         m_fY /= (SI_Float) rLen ;
02755         m_fZ /= (SI_Float) rLen ;
02756         m_fW /= (SI_Float) rLen ;
02757         return *this;
02758     }
02759     else
02760     {
02761         return Set(1.0f, 0.0f, 0.0f, 0.0f);
02762     }
02763 }
02764 
02765 //***************************************************************************************
02766 //
02767 // Author : Softimage Games Team
02768 // Date   :
02769 //
02770 // Returns TRUE if this vector is the same as the other.
02771 //
02772 // CSIBCVector4D& | in_v | Input vector.
02773 // Returns a boolean.
02774 //***************************************************************************************
02775 inline SI_Bool CSIBCVector4D::operator ==
02776 (
02777     const CSIBCVector4D& in_v
02778 ) const
02779 {
02780     return ( ( m_fX == in_v.m_fX ) && ( m_fY == in_v.m_fY )
02781         && ( m_fZ == in_v.m_fZ ) && ( m_fW == in_v.m_fW ) );
02782 }
02783 
02784 //***************************************************************************************
02785 //
02786 // Author : Softimage Games Team
02787 // Date   :
02788 //
02789 // Returns TRUE if this vector is different from the other.
02790 // CSIBCVector4D& | in_vct | Input vector.
02791 //
02792 //***************************************************************************************
02793 inline SI_Bool CSIBCVector4D::operator !=
02794 (
02795     const CSIBCVector4D& in_vct
02796 ) const
02797 {
02798     return !( *this==in_vct ) ;
02799 }
02800 
02801 //***************************************************************************************
02802 //
02803 // Author : Softimage Games Team
02804 // Date   :
02805 //
02806 // Vector add operator.
02807 // CSIBCVector4D& | in_vtx | Input vector.
02808 // Returns a vector.
02809 //
02810 //***************************************************************************************
02811 inline CSIBCVector4D CSIBCVector4D::operator+
02812 (
02813     const CSIBCVector4D &in_vtx
02814 )
02815 {
02816     CSIBCVector4D v2;
02817 
02818     v2.m_fX = m_fX + in_vtx.m_fX;
02819     v2.m_fY = m_fY + in_vtx.m_fY;
02820     v2.m_fZ = m_fZ + in_vtx.m_fZ;
02821     v2.m_fW = m_fW + in_vtx.m_fW;
02822 
02823     return v2;
02824 }
02825 
02826 //***************************************************************************************
02827 //
02828 // Author : Softimage Games Team
02829 // Date   :
02830 //
02831 // Vector sub operator.
02832 // CSIBCVector4D& | in_vtx | Input vector.
02833 // Returns a vector.
02834 //
02835 //***************************************************************************************
02836 inline CSIBCVector4D CSIBCVector4D::operator-
02837 (
02838     const CSIBCVector4D &in_vtx
02839 )
02840 {
02841     CSIBCVector4D v2;
02842 
02843     v2.m_fX = m_fX - in_vtx.m_fX;
02844     v2.m_fY = m_fY - in_vtx.m_fY;
02845     v2.m_fZ = m_fZ - in_vtx.m_fZ;
02846     v2.m_fW = m_fW - in_vtx.m_fW;
02847 
02848     return v2;
02849 }
02850 
02851 //***************************************************************************************
02852 //
02853 // Author : Softimage Games Team
02854 // Date   :
02855 //
02856 // Vector divide operator.
02857 // CSIBCVector4D& | in_vtx | Input vector.
02858 // Returns a vector.
02859 //
02860 //***************************************************************************************
02861 inline CSIBCVector4D CSIBCVector4D::operator/
02862 (
02863     const CSIBCVector4D &in_vtx
02864 )
02865 {
02866     CSIBCVector4D v2;
02867 
02868     if ((in_vtx.m_fX != 0.0f) &&
02869         (in_vtx.m_fY != 0.0f) &&
02870         (in_vtx.m_fZ != 0.0f) &&
02871         (in_vtx.m_fW != 0.0f))
02872     {
02873         v2.m_fX = m_fX / in_vtx.m_fX;
02874         v2.m_fY = m_fY / in_vtx.m_fY;
02875         v2.m_fZ = m_fZ / in_vtx.m_fZ;
02876         v2.m_fW = m_fW / in_vtx.m_fW;
02877     }
02878 
02879     return v2;
02880 }
02881 
02882 //***************************************************************************************
02883 //
02884 // Author : Softimage Games Team
02885 // Date   :
02886 //
02887 // Assignment operator.
02888 // CSIBCVector4D& | in_vtx | Input vector.
02889 // Returns a pointer to a vector.
02890 //
02891 //***************************************************************************************
02892 inline CSIBCVector4D &CSIBCVector4D::operator = (const CSIBCVector3D &in_vtx )
02893 {
02894     m_fX = in_vtx.m_fX;
02895     m_fY = in_vtx.m_fY;
02896     m_fZ = in_vtx.m_fZ;
02897     return *this;
02898 }
02899 
02900 //***************************************************************************************
02901 //
02902 // Author : Softimage Games Team
02903 // Date   :
02904 //
02905 // Sets the vector to the NULL vector.
02906 // Returns a pointer to a vector.
02907 //
02908 //***************************************************************************************
02909 inline CSIBCVector4D& CSIBCVector4D::SetNull()
02910 {
02911     m_fX = m_fY = m_fZ = m_fW = 0.0f;
02912 
02913     return *this;
02914 }
02915 
02916 //***************************************************************************************
02917 //
02918 // Author : Softimage Games Team
02919 // Date   :
02920 //
02921 // Sets this vector to be the opposite vector.
02922 // Returns a pointer to a vector.
02923 //
02924 //***************************************************************************************
02925 inline CSIBCVector4D& CSIBCVector4D::Negate()
02926 {
02927     m_fX = -m_fX;
02928     m_fY = -m_fY;
02929     m_fZ = -m_fZ;
02930     m_fW = -m_fW;
02931     return *this;
02932 }
02933 
02934 
02935 //***************************************************************************************
02936 //
02937 // Author : Softimage Games Team
02938 // Date   :
02939 //
02940 // Adds a vector to this vector.
02941 // CSIBCVector4D& | in_vct | Input vector.
02942 // Returns a pointer to a vector.
02943 //
02944 //***************************************************************************************
02945 inline CSIBCVector4D& CSIBCVector4D::Add
02946 (
02947     const CSIBCVector4D& in_vct
02948 )
02949 {
02950     m_fX += in_vct.m_fX;
02951     m_fY += in_vct.m_fY;
02952     m_fZ += in_vct.m_fZ;
02953     m_fW += in_vct.m_fW;
02954     return *this;
02955 }
02956 
02957 
02958 //***************************************************************************************
02959 //
02960 // Author : Softimage Games Team
02961 // Date   :
02962 //
02963 // Substracts a vector from this vector.
02964 // CSIBCVector4D& | in_vct | Input vector.
02965 // Returns a pointer to a vector.
02966 //
02967 //***************************************************************************************
02968 inline CSIBCVector4D& CSIBCVector4D::Sub
02969 (
02970     const CSIBCVector4D& in_vct
02971 )
02972 {
02973     m_fX -= in_vct.m_fX;
02974     m_fY -= in_vct.m_fY;
02975     m_fZ -= in_vct.m_fZ;
02976     m_fW -= in_vct.m_fW;
02977     return *this;
02978 }
02979 
02980 
02981 //***************************************************************************************
02982 //
02983 // Author : Softimage Games Team
02984 // Date   :
02985 //
02986 // Scales a vector by a given factor.
02987 //
02988 // SI_Float | in_dFactor | Scale factor.
02989 // Returns a pointer to a vector object.
02990 //
02991 //***************************************************************************************
02992 inline CSIBCVector4D& CSIBCVector4D::Scale
02993 (
02994     const SI_Float in_dFactor
02995 )
02996 {
02997     m_fX *= (SI_Float) in_dFactor;
02998     m_fY *= (SI_Float) in_dFactor;
02999     m_fZ *= (SI_Float) in_dFactor;
03000     m_fW *= (SI_Float) in_dFactor;
03001     return *this;
03002 }
03003 
03004 
03005 //***************************************************************************************
03006 //
03007 // Author : Softimage Games Team
03008 // Date   :
03009 //
03010 // Does component-wise multiplication of the vector.
03011 //
03012 // CSIBCVector4D& | in_vct | Input vector.
03013 // Returns a pointer to a vector.
03014 //
03015 //***************************************************************************************
03016 inline CSIBCVector4D& CSIBCVector4D::MulComp
03017 (
03018      const CSIBCVector4D& in_vct
03019 )
03020 {
03021     m_fX *= in_vct.m_fX;
03022     m_fY *= in_vct.m_fY;
03023     m_fZ *= in_vct.m_fZ;
03024     return *this;
03025 }
03026 
03027 
03028 //***************************************************************************************
03029 //
03030 // Author : Softimage Games Team
03031 // Date   :
03032 //
03033 // Does component wise division of the vector.
03034 // CSIBCVector4D& | in_vct | Input vector.
03035 // Returns a pointer to a vector.
03036 //
03037 //***************************************************************************************
03038 inline CSIBCVector4D& CSIBCVector4D::DivComp
03039 (
03040     const CSIBCVector4D& in_vct
03041 )
03042 {
03043     if (in_vct.m_fX != 0.0f &&
03044         in_vct.m_fY != 0.0f &&
03045         in_vct.m_fZ != 0.0f &&
03046         in_vct.m_fW != 0.0f)
03047     {
03048         m_fX /= in_vct.m_fX;
03049         m_fY /= in_vct.m_fY;
03050         m_fZ /= in_vct.m_fZ;
03051         m_fW /= in_vct.m_fW;
03052     }
03053 
03054     return *this;
03055 }
03056 
03057 //***************************************************************************************
03058 //
03059 // Author : Softimage Games Team
03060 // Date   :
03061 //
03062 // Sets the xyzw values of this vector.
03063 //
03064 // SI_Float | in_dX | x component of vector.
03065 // SI_Float | in_dY | y component of vector.
03066 // SI_Float | in_dZ | z component of vector.
03067 // SI_Float | in_dW | w component of vector.
03068 // Returns a pointer to a vector.
03069 //***************************************************************************************
03070 inline CSIBCVector4D& CSIBCVector4D::Set
03071 (
03072     SI_Float in_dX,
03073     SI_Float in_dY,
03074     SI_Float in_dZ,
03075     SI_Float in_dW
03076 )
03077 {
03078     m_fX = (SI_Float) in_dX;
03079     m_fY = (SI_Float) in_dY;
03080     m_fZ = (SI_Float) in_dZ;
03081     m_fW = (SI_Float) in_dW;
03082     return *this;
03083 }
03084 
03085 
03086 #endif // CSIBCVector