SIBCVector.h

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