00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __CSIBCVector_H__
00029 #define __CSIBCVector_H__
00030
00031
00032
00033
00034 #include <math.h>
00035 #include <SIBCUtil.h>
00036
00037
00038
00039
00040 #define SIBCVECTOR_EPS 0.00001f
00041
00042 #ifdef _PSX2_ASM
00043 #include "libvu0.h"
00044 #endif
00045
00046
00047
00048
00049
00050
00052
00062 class XSICOREEXPORT CSIBCVector2D
00063 {
00064 public:
00065
00069 CSIBCVector2D();
00070
00075 CSIBCVector2D(const CSIBCVector2D& i_vVector);
00076
00082 CSIBCVector2D(const SI_Float i_fX, const SI_Float i_fY);
00083
00084 ~CSIBCVector2D();
00085
00086
00087
00097 SI_Bool IsAlmostEqualTo(const CSIBCVector2D& i_vVector, const SI_Float i_fEpsilon);
00098
00108 SI_Bool IsOrthogonalTo(const CSIBCVector2D& i_vVector);
00109
00117 SI_Bool IsNull() const;
00118
00119
00120
00126 SI_Float GetDot(const CSIBCVector2D& i_vVector) const;
00127
00133 SI_Float GetDistanceFrom(const CSIBCVector2D& i_vVector) const;
00134
00141 SI_Float GetLength() const;
00142
00149 SI_Float GetSquaredLength() const;
00150
00157 SI_Float GetMaxComponent(SI_Int * o_nIndex) const;
00158
00165 SI_Float GetMinComponent(SI_Int * o_nIndex) const;
00166
00167
00168
00176 void Get(SI_Float* o_fX, SI_Float* o_fY) const;
00177
00184 const SI_Float GetX() const { return m_fX; }
00185
00192 const SI_Float GetY() const { return m_fY; }
00193
00202 CSIBCVector2D& Set(SI_Float i_fX, SI_Float i_fY);
00203
00210 const void SetX(const SI_Float i_fX) { m_fX = i_fX; }
00211
00218 const void SetY(const SI_Float i_fY) { m_fY = i_fY; }
00219
00220
00221
00228 CSIBCVector2D& Normalize();
00229
00235 CSIBCVector2D& SetNull();
00236
00244 CSIBCVector2D& SetLength(const SI_Float i_fLength);
00245
00250 CSIBCVector2D& Negate();
00251
00257 CSIBCVector2D& Add(const CSIBCVector2D& i_vVector);
00258
00264 CSIBCVector2D& Sub(const CSIBCVector2D&);
00265
00272 CSIBCVector2D& Scale(const SI_Float i_fScale);
00273
00280 CSIBCVector2D& MulComp(const CSIBCVector2D& i_vVector);
00281
00289 CSIBCVector2D& DivComp(const CSIBCVector2D& i_vVector);
00290
00291
00292
00301 SI_Bool operator == (const CSIBCVector2D& i_vVector) const;
00302
00311 SI_Bool operator != (const CSIBCVector2D& i_vVector) const;
00312
00319 CSIBCVector2D operator+(const CSIBCVector2D &i_vVector) const;
00320
00327 CSIBCVector2D operator-(const CSIBCVector2D &i_vVector) const;
00328
00334 CSIBCVector2D operator/(const CSIBCVector2D &i_vVector) const;
00335
00342 CSIBCVector2D operator*(const SI_Float i_fFloat) const;
00343
00344
00345
00350 void Dump();
00351
00353 float m_fX;
00354
00356 float m_fY;
00357
00358
00359 protected:
00360 };
00361
00362
00363
00364
00365
00367
00377 class XSICOREEXPORT CSIBCVector3D
00378 {
00379 public:
00380
00381
00385 CSIBCVector3D();
00386
00391 CSIBCVector3D(const CSIBCVector3D& i_vVector);
00392
00400 CSIBCVector3D(const SI_Float i_fX, const SI_Float i_fY, const SI_Float i_fZ);
00401
00402 ~CSIBCVector3D() {;}
00403
00404
00405
00416 SI_Bool IsAlmostEqualTo(const CSIBCVector3D& i_vVector, const SI_Float i_fEpsilon);
00417
00427 SI_Bool IsOrthogonalTo(const CSIBCVector3D& i_vVector);
00428
00436 SI_Bool IsNull() const;
00437
00438
00439
00445 SI_Float GetDot(const CSIBCVector3D& i_vVector) const;
00446
00452 SI_Float GetDistanceFrom(const CSIBCVector3D& i_vVector) const;
00453
00460 SI_Float GetLength() const;
00461
00468 SI_Float GetSquaredLength() const;
00469
00476 SI_Float GetMaxComponent(SI_Int * o_nIndex) const;
00477
00484 SI_Float GetMinComponent(SI_Int * o_nIndex) const;
00485
00486
00487
00498 void Get(SI_Float* o_fX, SI_Float* o_fY, SI_Float* o_fZ) const;
00499
00507 SI_Float GetX() const { return m_fX; }
00508
00516 SI_Float GetY() const { return m_fY; }
00517
00525 SI_Float GetZ() const { return m_fZ; }
00526
00535 SI_Float GetW() const { return 1.0; }
00536
00537
00545 CSIBCVector3D& Set(SI_Float i_fX, SI_Float i_fY, SI_Float i_fZ);
00546
00547
00548
00555 CSIBCVector3D& Normalize();
00556
00562 CSIBCVector3D& SetNull();
00563
00571 CSIBCVector3D& SetLength(const SI_Float i_fLength);
00572
00578 CSIBCVector3D& SetCross(const CSIBCVector3D& i_vVector);
00579
00584 CSIBCVector3D& Negate();
00585
00591 CSIBCVector3D& Add(const CSIBCVector3D& i_vVector);
00592
00598 CSIBCVector3D& Sub(const CSIBCVector3D& i_vVector);
00599
00607 CSIBCVector3D& Scale(const SI_Float i_fScale);
00608
00614 CSIBCVector3D& Scale(CSIBCVector3D& o_vDest, const SI_Float i_fScale);
00615
00624 CSIBCVector3D& MulComp(const CSIBCVector3D& i_vVector);
00625
00633 CSIBCVector3D& DivComp(const CSIBCVector3D& i_vVector);
00634
00642 CSIBCVector3D CrossProduct( const CSIBCVector3D& i_vVector) const;
00643
00652 void ScaleAndAdd(CSIBCVector3D& io_vDest, const SI_Float i_fScale);
00653
00654
00655
00664 SI_Bool operator == (const CSIBCVector3D& i_vVector) const;
00665
00674 SI_Bool operator != (const CSIBCVector3D& i_vVector) const;
00675
00684 CSIBCVector3D operator+(const CSIBCVector3D &i_vVector) const;
00685
00695 CSIBCVector3D operator+(const SI_Float &i_fFloat) const;
00696
00705 CSIBCVector3D operator-(const CSIBCVector3D &i_vVector) const;
00706
00716 CSIBCVector3D operator-(const SI_Float &i_fFloat) const;
00717
00723 CSIBCVector3D operator/(const CSIBCVector3D &i_vVector) const;
00724
00731 CSIBCVector3D operator*(const SI_Float i_fFloat) const;
00732
00737 void Dump();
00738
00740 float m_fX;
00741 #ifdef _PSX2_ASM
00742 __attribute__((aligned (16)))
00743 #endif
00744
00746 float m_fY;
00747
00749 float m_fZ;
00750
00751
00752 };
00753
00754
00755
00756
00757
00758
00760
00770 class XSICOREEXPORT CSIBCVector4D
00771 {
00772 public:
00773
00774
00775
00779 CSIBCVector4D();
00780
00785 CSIBCVector4D(const CSIBCVector4D& i_vVector);
00786
00795 CSIBCVector4D( const SI_Float i_fX, const SI_Float i_fY,
00796 const SI_Float i_fZ, const SI_Float i_fW);
00797
00804 CSIBCVector4D( const CSIBCVector3D& i_vVct, const SI_Float i_fW = 1.0f);
00805
00806 ~CSIBCVector4D();
00807
00808
00809
00819 SI_Bool IsAlmostEqualTo(const CSIBCVector4D& i_vVector, const SI_Float i_fEpsilon);
00820
00830 SI_Bool IsOrthogonalTo(const CSIBCVector4D& i_vVector);
00831
00839 SI_Bool IsNull() const;
00840
00841
00842
00848 SI_Float GetDot(const CSIBCVector4D& i_vVector) const;
00849
00855 SI_Float GetDistanceFrom(const CSIBCVector4D& i_vVector) const;
00856
00863 SI_Float GetLength() const;
00864
00871 SI_Float GetSquaredLength() const;
00872
00879 SI_Float GetMaxComponent(SI_Int * o_nIndex) const;
00880
00887 SI_Float GetMinComponent(SI_Int * o_nIndex) const;
00888
00889
00890
00898 void Get(SI_Float* o_fX, SI_Float* o_fY, SI_Float* o_fZ, SI_Float* o_fW) const;
00899
00909 CSIBCVector4D& Set(SI_Float i_fX, SI_Float i_fY, SI_Float i_fZ, SI_Float i_fW);
00910
00911
00912
00919 CSIBCVector4D& Normalize();
00920
00926 CSIBCVector4D& SetNull();
00927
00935 CSIBCVector4D& SetLength(const SI_Float i_fLength);
00936
00941 CSIBCVector4D& Negate();
00942
00948 CSIBCVector4D& Add(const CSIBCVector4D& i_vVector);
00949
00955 CSIBCVector4D& Sub(const CSIBCVector4D& i_vVector);
00956
00962 CSIBCVector4D& Scale(const SI_Float i_fScale);
00963
00970 CSIBCVector4D& MulComp(const CSIBCVector4D& i_vVector);
00971
00979 CSIBCVector4D& DivComp(const CSIBCVector4D& i_vVector);
00980
00981
00982
00991 SI_Bool operator == (const CSIBCVector4D& i_vVector) const;
00992
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
01034
01039 void Dump();
01040
01042 float m_fX;
01043 #ifdef _PSX2_ASM
01044 __attribute__((aligned (16)))
01045 #endif
01046
01047 float m_fY;
01048
01050 float m_fZ;
01051
01053 float m_fW;
01054
01055 protected:
01056 };
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069 inline CSIBCVector2D::CSIBCVector2D()
01070 {
01071 m_fX = 0.0f;
01072 m_fY = 0.0f;
01073 }
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085 inline CSIBCVector2D::CSIBCVector2D
01086 (
01087 const CSIBCVector2D& in_vct
01088 )
01089 {
01090 m_fX = in_vct.m_fX;
01091 m_fY = in_vct.m_fY;
01092 }
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107 inline CSIBCVector2D::CSIBCVector2D
01108 (
01109 const SI_Float in_dX,
01110 const SI_Float in_dY
01111 )
01112 {
01113 m_fX = (SI_Float) in_dX;
01114 m_fY = (SI_Float) in_dY;
01115 }
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128 inline CSIBCVector2D::~CSIBCVector2D()
01129 {
01130 }
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145 inline SI_Bool CSIBCVector2D::IsAlmostEqualTo
01146 (
01147 const CSIBCVector2D& in_vct,
01148 const SI_Float in_dEpsilon
01149 )
01150 {
01151 return( fabs( m_fX - in_vct.m_fX ) < in_dEpsilon &&
01152 fabs( m_fY - in_vct.m_fY ) < in_dEpsilon);
01153 }
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167 inline SI_Bool CSIBCVector2D::IsOrthogonalTo
01168 (
01169 const CSIBCVector2D& in_vct
01170 )
01171 {
01172 if( fabs( GetDot( in_vct ) ) < SIBCVECTOR_EPS)
01173 return TRUE;
01174 else
01175 return FALSE;
01176 }
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187 inline SI_Bool CSIBCVector2D::IsNull() const
01188 {
01189
01190 const SI_Float l_dEpsilon = SIBCVECTOR_EPS;
01191 return ( fabs( m_fX ) < l_dEpsilon &&
01192 fabs( m_fY ) < l_dEpsilon );
01193 }
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205 inline SI_Float CSIBCVector2D::GetDot
01206 (
01207 const CSIBCVector2D& in_vct
01208 ) const
01209 {
01210 return ( m_fX*in_vct.m_fX + m_fY*in_vct.m_fY);
01211 }
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225 inline SI_Float CSIBCVector2D::GetDistanceFrom
01226 (
01227 const CSIBCVector2D& in_vct
01228 ) const
01229 {
01230 SI_Float rx, ry;
01231
01232 rx = m_fX-in_vct.m_fX;
01233 ry = m_fY-in_vct.m_fY;
01234
01235 return (SI_Float)sqrt( rx*rx + ry*ry );
01236 }
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247 inline SI_Float CSIBCVector2D::GetSquaredLength() const
01248 {
01249 return( m_fX*m_fX + m_fY*m_fY );
01250 }
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261 inline SI_Float CSIBCVector2D::GetLength() const
01262 {
01263 return (SI_Float)sqrt( GetSquaredLength() );
01264 }
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278 inline void CSIBCVector2D::Get
01279 (
01280 SI_Float* out_dX,
01281 SI_Float* out_dY
01282 ) const
01283 {
01284 *out_dX = m_fX;
01285 *out_dY = m_fY;
01286 }
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300 inline CSIBCVector2D& CSIBCVector2D::SetLength
01301 (
01302 const SI_Float in_dLength
01303 )
01304 {
01305 SI_Float rLen = GetLength();
01306
01307 if ( rLen > SIBCVECTOR_EPS )
01308 {
01309 Scale( in_dLength / rLen );
01310 return *this;
01311 }
01312 else
01313 return *this;
01314 }
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326 inline CSIBCVector2D& CSIBCVector2D::Normalize()
01327 {
01328 SI_Float rLen = GetLength();
01329
01330 if ( rLen > SIBCVECTOR_EPS )
01331 {
01332 m_fX /= (SI_Float) rLen ;
01333 m_fY /= (SI_Float) rLen ;
01334 return *this;
01335 }
01336 else
01337 {
01338 return Set(1.0f, 0.0f);
01339 }
01340 }
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357 inline SI_Bool CSIBCVector2D::operator ==
01358 (
01359 const CSIBCVector2D& in_v
01360 ) const
01361 {
01362 return ( ( m_fX == in_v.m_fX ) && ( m_fY == in_v.m_fY ) );
01363 }
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375 inline SI_Bool CSIBCVector2D::operator !=
01376 (
01377 const CSIBCVector2D& in_vct
01378 ) const
01379 {
01380 return !( *this==in_vct ) ;
01381 }
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393 inline CSIBCVector2D CSIBCVector2D::operator+
01394 (
01395 const CSIBCVector2D &in_vtx
01396 ) const
01397 {
01398 CSIBCVector2D v2;
01399
01400 v2.m_fX = m_fX + in_vtx.m_fX;
01401 v2.m_fY = m_fY + in_vtx.m_fY;
01402
01403 return v2;
01404 }
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416 inline CSIBCVector2D CSIBCVector2D::operator-
01417 (
01418 const CSIBCVector2D &in_vtx
01419 ) const
01420 {
01421 CSIBCVector2D v2;
01422
01423 v2.m_fX = m_fX - in_vtx.m_fX;
01424 v2.m_fY = m_fY - in_vtx.m_fY;
01425
01426 return v2;
01427 }
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439 inline CSIBCVector2D CSIBCVector2D::operator/
01440 (
01441 const CSIBCVector2D &in_vtx
01442 ) const
01443 {
01444 CSIBCVector2D v2;
01445
01446 if ((in_vtx.m_fX != 0.0f) &&
01447 (in_vtx.m_fY != 0.0f))
01448 {
01449 v2.m_fX = m_fX / in_vtx.m_fX;
01450 v2.m_fY = m_fY / in_vtx.m_fY;
01451 }
01452
01453 return v2;
01454 }
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466 inline CSIBCVector2D CSIBCVector2D::operator*
01467 (
01468 const SI_Float in_flt
01469 ) const
01470 {
01471 CSIBCVector2D v2;
01472
01473 v2.m_fX = m_fX * in_flt;
01474 v2.m_fY = m_fY * in_flt;
01475
01476 return v2;
01477 }
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488 inline CSIBCVector2D& CSIBCVector2D::SetNull()
01489 {
01490 m_fX = m_fY = 0.0f;
01491
01492 return *this;
01493 }
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504 inline CSIBCVector2D& CSIBCVector2D::Negate()
01505 {
01506 m_fX = -m_fX;
01507 m_fY = -m_fY;
01508 return *this;
01509 }
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522 inline CSIBCVector2D& CSIBCVector2D::Add
01523 (
01524 const CSIBCVector2D& in_vct
01525 )
01526 {
01527 m_fX += in_vct.m_fX;
01528 m_fY += in_vct.m_fY;
01529 return *this;
01530 }
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543 inline CSIBCVector2D& CSIBCVector2D::Sub
01544 (
01545 const CSIBCVector2D& in_vct
01546 )
01547 {
01548 m_fX -= in_vct.m_fX;
01549 m_fY -= in_vct.m_fY;
01550 return *this;
01551 }
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564 inline CSIBCVector2D& CSIBCVector2D::Scale
01565 (
01566 const SI_Float in_dFactor
01567 )
01568 {
01569 m_fX *= (SI_Float) in_dFactor;
01570 m_fY *= (SI_Float) in_dFactor;
01571 return *this;
01572 }
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585 inline CSIBCVector2D& CSIBCVector2D::MulComp
01586 (
01587 const CSIBCVector2D& in_vct
01588 )
01589 {
01590 m_fX *= in_vct.m_fX;
01591 m_fY *= in_vct.m_fY;
01592 return *this;
01593 }
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606 inline CSIBCVector2D& CSIBCVector2D::DivComp
01607 (
01608 const CSIBCVector2D& in_vct
01609 )
01610 {
01611 if (in_vct.m_fX != 0.0f &&
01612 in_vct.m_fY != 0.0f)
01613 {
01614 m_fX /= in_vct.m_fX;
01615 m_fY /= in_vct.m_fY;
01616 }
01617
01618 return *this;
01619 }
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634 inline CSIBCVector2D& CSIBCVector2D::Set
01635 (
01636 SI_Float in_dX,
01637 SI_Float in_dY
01638 )
01639 {
01640 m_fX = (SI_Float) in_dX;
01641 m_fY = (SI_Float) in_dY;
01642 return *this;
01643 }
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657 inline CSIBCVector3D::CSIBCVector3D()
01658 {
01659 m_fX = 0.0f;
01660 m_fY = 0.0f;
01661 m_fZ = 0.0f;
01662 }
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674 inline CSIBCVector3D::CSIBCVector3D
01675 (
01676 const CSIBCVector3D& in_vct
01677 )
01678 {
01679 m_fX = in_vct.m_fX;
01680 m_fY = in_vct.m_fY;
01681 m_fZ = in_vct.m_fZ;
01682 }
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698 inline CSIBCVector3D::CSIBCVector3D
01699 (
01700 const SI_Float in_dX,
01701 const SI_Float in_dY,
01702 const SI_Float in_dZ
01703 )
01704 {
01705 m_fX = (SI_Float) in_dX;
01706 m_fY = (SI_Float) in_dY;
01707 m_fZ = (SI_Float) in_dZ;
01708 }
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724 inline SI_Bool CSIBCVector3D::IsAlmostEqualTo
01725 (
01726 const CSIBCVector3D& in_vct,
01727 const SI_Float in_dEpsilon
01728 )
01729 {
01730 return( fabs( m_fX - in_vct.m_fX ) < in_dEpsilon &&
01731 fabs( m_fY - in_vct.m_fY ) < in_dEpsilon &&
01732 fabs( m_fZ - in_vct.m_fZ ) < in_dEpsilon ) ;
01733 }
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746 inline SI_Bool CSIBCVector3D::IsOrthogonalTo
01747 (
01748 const CSIBCVector3D& in_vct
01749 )
01750 {
01751 if( fabs( GetDot( in_vct ) ) < SIBCVECTOR_EPS)
01752 return TRUE;
01753 else
01754 return FALSE;
01755 }
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768 inline SI_Bool CSIBCVector3D::IsNull() const
01769 {
01770
01771 const SI_Float l_dEpsilon = SIBCVECTOR_EPS;
01772 return ( fabs( m_fX ) < l_dEpsilon &&
01773 fabs( m_fY ) < l_dEpsilon &&
01774 fabs( m_fZ ) < l_dEpsilon );
01775 }
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787 inline SI_Float CSIBCVector3D::GetDot
01788 (
01789 const CSIBCVector3D& in_vct
01790 ) const
01791 {
01792 #ifdef _PSX2_ASM
01793 float fRet[4] __attribute__((aligned (16)));
01794 asm ("
01795 lqc2 vf4,0x0(%1)
01796 lqc2 vf5,0x0(%2)
01797 vmul.xyz vf5,vf4,vf5
01798 vaddy.x vf5,vf5,vf5
01799 vaddz.x vf5,vf5,vf5
01800 sqc2 vf5,0x0(%0)
01801 ": : "=r" (fRet), "r" (&m_fX), "r" ( &(in_vct.m_fX)) );
01802
01803 return fRet[0];
01804 #else
01805 return ( in_vct.m_fX * m_fX + in_vct.m_fY * m_fY + in_vct.m_fZ * m_fZ );
01806 #endif
01807 }
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819 inline SI_Float CSIBCVector3D::GetDistanceFrom
01820 (
01821 const CSIBCVector3D& in_vct
01822 ) const
01823 {
01824 #ifdef _PSX2_ASM
01825 float fRet[4] __attribute__((aligned (16)));
01826
01827 asm ("
01828 lqc2 vf4,0x0(%1)
01829 lqc2 vf5,0x0(%2)
01830 vsub.xyz vf5,vf4,vf5
01831 vmul.xyz vf5,vf5,vf5
01832 vaddy.x vf5,vf5,vf5
01833 vaddz.x vf5,vf5,vf5
01834 sqc2 vf5,0x0(%0)
01835 ": : "=r" (fRet), "r" (&m_fX), "r" ( &(in_vct.m_fX)) );
01836
01837 return (SI_Float)sqrt(fRet[0]);
01838 #else
01839 SI_Float rx, ry, rz;
01840
01841 rx = m_fX-in_vct.m_fX;
01842 ry = m_fY-in_vct.m_fY;
01843 rz = m_fZ-in_vct.m_fZ;
01844
01845 return (SI_Float)sqrt( rx*rx + ry*ry + rz*rz );
01846 #endif
01847 }
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858 inline SI_Float CSIBCVector3D::GetLength() const
01859 {
01860 #ifdef _PSX2_ASM
01861 SI_Float fRet[4] __attribute__((aligned (16)));
01862
01863 asm ("
01864 lqc2 vf5,0x0(%1)
01865 vmul.xyz vf5,vf5,vf5
01866 vaddy.x vf5,vf5,vf5
01867 vaddz.x vf5,vf5,vf5
01868 cop2 2425789
01869 vwaitq
01870 vaddq.x vf5,vf0,Q
01871 sqc2 vf5,0x0(%0)
01872 ": : "=r" (fRet), "r" (&m_fX) );
01873
01874 return fRet[0];
01875 #else
01876 return (SI_Float)sqrt( GetSquaredLength() );
01877 #endif
01878 }
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889 inline SI_Float CSIBCVector3D::GetSquaredLength() const
01890 {
01891 #ifdef _PSX2_ASM
01892 SI_Float fRet[4] __attribute__((aligned (16)));
01893
01894 asm ("
01895 lqc2 vf4,0x0(%1)
01896 vmul.xyz vf4,vf4,vf4
01897 vaddy.x vf4,vf4,vf4
01898 vaddz.x vf4,vf4,vf4
01899 sqc2 vf4,0x0(%0)
01900 ": : "=r" (fRet), "r" (&m_fX) );
01901
01902 return fRet[0];
01903 #else
01904 return( m_fX*m_fX + m_fY*m_fY + m_fZ*m_fZ );
01905 #endif
01906 }
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920 inline void CSIBCVector3D::Get
01921 (
01922 SI_Float* out_dX,
01923 SI_Float* out_dY,
01924 SI_Float* out_dZ
01925 ) const
01926 {
01927 *out_dX = m_fX;
01928 *out_dY = m_fY;
01929 *out_dZ = m_fZ;
01930 }
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944 inline CSIBCVector3D& CSIBCVector3D::SetLength
01945 (
01946 const SI_Float in_dLength
01947 )
01948 {
01949 SI_Float rLen = GetLength();
01950
01951 if ( rLen > SIBCVECTOR_EPS )
01952 {
01953 Scale( in_dLength / rLen );
01954 return *this;
01955 }
01956 else
01957 return *this;
01958 }
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970 inline CSIBCVector3D& CSIBCVector3D::Normalize()
01971 {
01972 #ifdef _PSX2_ASM
01973 sceVu0Normalize( &m_fX, &m_fX );
01974
01975 return *this;
01976 #else
01977 SI_Float rLen = GetLength();
01978
01979 if ( rLen > SIBCVECTOR_EPS )
01980 {
01981 m_fX /= (SI_Float) rLen ;
01982 m_fY /= (SI_Float) rLen ;
01983 m_fZ /= (SI_Float) rLen ;
01984 return *this;
01985 }
01986 else
01987 {
01988 return Set(1.0f, 0.0f, 0.0f);
01989 }
01990 #endif
01991 }
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007 inline SI_Bool CSIBCVector3D::operator ==
02008 (
02009 const CSIBCVector3D& in_v
02010 ) const
02011 {
02012 return ( ( m_fX == in_v.m_fX ) && ( m_fY == in_v.m_fY ) && ( m_fZ == in_v.m_fZ ) );
02013 }
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025 inline SI_Bool CSIBCVector3D::operator !=
02026 (
02027 const CSIBCVector3D& in_vct
02028 ) const
02029 {
02030 return !( *this==in_vct ) ;
02031 }
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043 inline CSIBCVector3D CSIBCVector3D::operator+
02044 (
02045 const CSIBCVector3D &in_vtx
02046 ) const
02047 {
02048 CSIBCVector3D v2;
02049
02050 v2.m_fX = m_fX + in_vtx.m_fX;
02051 v2.m_fY = m_fY + in_vtx.m_fY;
02052 v2.m_fZ = m_fZ + in_vtx.m_fZ;
02053
02054 return v2;
02055 }
02056
02057 inline CSIBCVector3D CSIBCVector3D::operator+
02058 (
02059 const SI_Float &in_flt
02060 ) const
02061 {
02062 CSIBCVector3D v2;
02063
02064 v2.m_fX = m_fX + in_flt;
02065 v2.m_fY = m_fY + in_flt;
02066 v2.m_fZ = m_fZ + in_flt;
02067
02068 return v2;
02069 }
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082 inline CSIBCVector3D CSIBCVector3D::operator-
02083 (
02084 const CSIBCVector3D &in_vtx
02085 ) const
02086 {
02087 CSIBCVector3D v2;
02088
02089 v2.m_fX = m_fX - in_vtx.m_fX;
02090 v2.m_fY = m_fY - in_vtx.m_fY;
02091 v2.m_fZ = m_fZ - in_vtx.m_fZ;
02092
02093 return v2;
02094 }
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107 inline CSIBCVector3D CSIBCVector3D::operator-
02108 (
02109 const SI_Float &in_flt
02110 ) const
02111 {
02112 CSIBCVector3D v2;
02113
02114 v2.m_fX = m_fX - in_flt;
02115 v2.m_fY = m_fY - in_flt;
02116 v2.m_fZ = m_fZ - in_flt;
02117
02118 return v2;
02119 }
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131 inline CSIBCVector3D CSIBCVector3D::operator/
02132 (
02133 const CSIBCVector3D &in_vtx
02134 ) const
02135 {
02136 CSIBCVector3D v2;
02137
02138 if ((in_vtx.m_fX != 0.0f) &&
02139 (in_vtx.m_fY != 0.0f) &&
02140 (in_vtx.m_fZ != 0.0f))
02141 {
02142 v2.m_fX = m_fX / in_vtx.m_fX;
02143 v2.m_fY = m_fY / in_vtx.m_fY;
02144 v2.m_fZ = m_fZ / in_vtx.m_fZ;
02145 }
02146
02147 return v2;
02148 }
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160 inline CSIBCVector3D CSIBCVector3D::operator*
02161 (
02162 const SI_Float factor
02163 ) const
02164 {
02165 CSIBCVector3D v2;
02166
02167 v2.m_fX = m_fX * factor;
02168 v2.m_fY = m_fY * factor;
02169 v2.m_fZ = m_fZ * factor;
02170
02171 return v2;
02172 }
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182 inline CSIBCVector3D& CSIBCVector3D::SetNull()
02183 {
02184 m_fX = m_fY = m_fZ = 0.0f;
02185
02186 return *this;
02187 }
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198 inline CSIBCVector3D& CSIBCVector3D::Negate()
02199 {
02200 m_fX = -m_fX;
02201 m_fY = -m_fY;
02202 m_fZ = -m_fZ;
02203 return *this;
02204 }
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217 inline CSIBCVector3D& CSIBCVector3D::Add
02218 (
02219 const CSIBCVector3D& in_vct
02220 )
02221 {
02222 m_fX += in_vct.m_fX;
02223 m_fY += in_vct.m_fY;
02224 m_fZ += in_vct.m_fZ;
02225 return *this;
02226 }
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238
02239 inline CSIBCVector3D& CSIBCVector3D::Sub
02240 (
02241 const CSIBCVector3D& in_vct
02242 )
02243 {
02244 m_fX -= in_vct.m_fX;
02245 m_fY -= in_vct.m_fY;
02246 m_fZ -= in_vct.m_fZ;
02247 return *this;
02248 }
02249
02250
02251
02252
02253
02254
02255
02256
02257
02258
02259
02260
02261 inline CSIBCVector3D& CSIBCVector3D::Scale
02262 (
02263 const SI_Float in_dFactor
02264 )
02265 {
02266 m_fX *= (SI_Float) in_dFactor;
02267 m_fY *= (SI_Float) in_dFactor;
02268 m_fZ *= (SI_Float) in_dFactor;
02269 return *this;
02270 }
02271
02272
02273
02274
02275
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285 inline CSIBCVector3D& CSIBCVector3D::Scale
02286 (
02287 CSIBCVector3D &o_V,
02288 const SI_Float in_dFactor
02289 )
02290 {
02291 o_V.m_fX = m_fX * in_dFactor;
02292 o_V.m_fY = m_fY * in_dFactor;
02293 o_V.m_fZ = m_fZ * in_dFactor;
02294
02295 return *this;
02296 }
02297
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307
02308
02309 inline void CSIBCVector3D::ScaleAndAdd
02310 (
02311 CSIBCVector3D &o_V,
02312 const SI_Float in_dFactor
02313 )
02314 {
02315 o_V.m_fX += (m_fX * in_dFactor);
02316 o_V.m_fY += (m_fY * in_dFactor);
02317 o_V.m_fZ += (m_fZ * in_dFactor);
02318 }
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329
02330 inline CSIBCVector3D& CSIBCVector3D::MulComp
02331 (
02332 const CSIBCVector3D& in_vct
02333 )
02334 {
02335 m_fX *= in_vct.m_fX;
02336 m_fY *= in_vct.m_fY;
02337 m_fZ *= in_vct.m_fZ;
02338 return *this;
02339 }
02340
02341
02342
02343
02344
02345
02346
02347
02348
02349
02350
02351
02352 inline CSIBCVector3D& CSIBCVector3D::DivComp
02353 (
02354 const CSIBCVector3D& in_vct
02355 )
02356 {
02357 if (in_vct.m_fX != 0.0f &&
02358 in_vct.m_fY != 0.0f &&
02359 in_vct.m_fZ != 0.0f)
02360 {
02361 m_fX /= in_vct.m_fX;
02362 m_fY /= in_vct.m_fY;
02363 m_fZ /= in_vct.m_fZ;
02364 }
02365
02366 return *this;
02367 }
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379 inline CSIBCVector3D& CSIBCVector3D::SetCross
02380 (
02381 const CSIBCVector3D& in_vct
02382 )
02383 {
02384 SI_Float dX, dY, dZ;
02385
02386 dX = m_fY * in_vct.m_fZ - m_fZ * in_vct.m_fY ;
02387 dY = -m_fX * in_vct.m_fZ + m_fZ * in_vct.m_fX ;
02388 dZ = m_fX * in_vct.m_fY - m_fY * in_vct.m_fX ;
02389
02390 return( Set( dX, dY, dZ ) );
02391 }
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403 inline CSIBCVector3D CSIBCVector3D::CrossProduct( const CSIBCVector3D &in_vct ) const
02404 {
02405 CSIBCVector3D tmp;
02406 #ifdef _PSX2_ASM
02407 sceVu0OuterProduct( &tmp.m_fX, (float*)&m_fX, (float*)&in_vct.m_fX );
02408 #else
02409 tmp.m_fX = m_fY * in_vct.m_fZ - m_fZ * in_vct.m_fY ;
02410 tmp.m_fY = -m_fX * in_vct.m_fZ + m_fZ * in_vct.m_fX ;
02411 tmp.m_fZ = m_fX * in_vct.m_fY - m_fY * in_vct.m_fX ;
02412 #endif
02413 return tmp;
02414 }
02415
02416
02417
02418
02419
02420
02421
02422
02423
02424
02425
02426
02427
02428 inline CSIBCVector3D& CSIBCVector3D::Set
02429 (
02430 SI_Float in_dX,
02431 SI_Float in_dY,
02432 SI_Float in_dZ
02433 )
02434 {
02435 m_fX = (SI_Float) in_dX;
02436 m_fY = (SI_Float) in_dY;
02437 m_fZ = (SI_Float) in_dZ;
02438
02439 return *this;
02440 }
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452
02453
02454 inline CSIBCVector4D::CSIBCVector4D()
02455 {
02456 m_fX = 0.0f;
02457 m_fY = 0.0f;
02458 m_fZ = 0.0f;
02459 m_fW = 0.0f;
02460 }
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473 inline CSIBCVector4D::CSIBCVector4D
02474 (
02475 const CSIBCVector4D& in_vct
02476 )
02477 {
02478 m_fX = in_vct.m_fX;
02479 m_fY = in_vct.m_fY;
02480 m_fZ = in_vct.m_fZ;
02481 m_fW = in_vct.m_fW;
02482 }
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
02495
02496
02497
02498 inline CSIBCVector4D::CSIBCVector4D
02499 (
02500 const SI_Float in_dX,
02501 const SI_Float in_dY,
02502 const SI_Float in_dZ,
02503 const SI_Float in_dW
02504 )
02505 {
02506 m_fX = (SI_Float) in_dX;
02507 m_fY = (SI_Float) in_dY;
02508 m_fZ = (SI_Float) in_dZ;
02509 m_fW = (SI_Float) in_dW;
02510 }
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521 inline CSIBCVector4D::CSIBCVector4D
02522 (
02523 const CSIBCVector3D& in_vVct, const SI_Float in_dW
02524 )
02525 {
02526 m_fX = in_vVct.m_fX;
02527 m_fY = in_vVct.m_fY;
02528 m_fZ = in_vVct.m_fZ;
02529 m_fW = in_dW;
02530 }
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541 inline CSIBCVector4D::~CSIBCVector4D()
02542 {
02543 }
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558 inline SI_Bool CSIBCVector4D::IsAlmostEqualTo
02559 (
02560 const CSIBCVector4D& in_vct,
02561 const SI_Float in_dEpsilon
02562 )
02563 {
02564 return( fabs( m_fX - in_vct.m_fX ) < in_dEpsilon &&
02565 fabs( m_fY - in_vct.m_fY ) < in_dEpsilon &&
02566 fabs( m_fZ - in_vct.m_fZ ) < in_dEpsilon &&
02567 fabs( m_fW - in_vct.m_fW ) < in_dEpsilon ) ;
02568 }
02569
02570
02571
02572
02573
02574
02575
02576
02577
02578
02579
02580
02581 inline SI_Bool CSIBCVector4D::IsOrthogonalTo
02582 (
02583 const CSIBCVector4D& in_vct
02584 )
02585 {
02586 if( fabs( GetDot( in_vct ) ) < SIBCVECTOR_EPS)
02587 return TRUE;
02588 else
02589 return FALSE;
02590 }
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602 inline SI_Bool CSIBCVector4D::IsNull() const
02603 {
02604
02605 const SI_Float l_dEpsilon = SIBCVECTOR_EPS;
02606 return ( fabs( m_fX ) < l_dEpsilon &&
02607 fabs( m_fY ) < l_dEpsilon &&
02608 fabs( m_fZ ) < l_dEpsilon &&
02609 fabs( m_fW ) < l_dEpsilon );
02610 }
02611
02612
02613
02614
02615
02616
02617
02618
02619
02620
02621
02622
02623 inline SI_Float CSIBCVector4D::GetDot
02624 (
02625 const CSIBCVector4D& in_vct
02626 ) const
02627 {
02628 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);
02629 }
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642
02643 inline SI_Float CSIBCVector4D::GetDistanceFrom
02644 (
02645 const CSIBCVector4D& in_vct
02646 ) const
02647 {
02648 SI_Float rx, ry, rz, rw;
02649
02650 rx = m_fX-in_vct.m_fX;
02651 ry = m_fY-in_vct.m_fY;
02652 rz = m_fZ-in_vct.m_fZ;
02653 rw = m_fW-in_vct.m_fW;
02654
02655 return (SI_Float)sqrt( rx*rx + ry*ry + rz*rz + rw*rw );
02656 }
02657
02658
02659
02660
02661
02662
02663
02664
02665
02666 inline SI_Float CSIBCVector4D::GetLength() const
02667 {
02668 return (SI_Float)sqrt( GetSquaredLength() );
02669 }
02670
02671
02672
02673
02674
02675
02676
02677
02678
02679
02680 inline SI_Float CSIBCVector4D::GetSquaredLength() const
02681 {
02682 return( m_fX*m_fX + m_fY*m_fY + m_fZ*m_fZ + m_fW*m_fW);
02683 }
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694
02695
02696
02697 inline void CSIBCVector4D::Get
02698 (
02699 SI_Float* out_dX,
02700 SI_Float* out_dY,
02701 SI_Float* out_dZ,
02702 SI_Float* out_dW
02703 ) const
02704 {
02705 *out_dX = m_fX;
02706 *out_dY = m_fY;
02707 *out_dZ = m_fZ;
02708 *out_dW = m_fW;
02709 }
02710
02711
02712
02713
02714
02715
02716
02717
02718
02719
02720
02721
02722 inline CSIBCVector4D& CSIBCVector4D::SetLength
02723 (
02724 const SI_Float in_dLength
02725 )
02726 {
02727 SI_Float rLen = GetLength();
02728
02729 if ( rLen > SIBCVECTOR_EPS )
02730 {
02731 Scale( in_dLength / rLen );
02732 return *this;
02733 }
02734 else
02735 return *this;
02736 }
02737
02738
02739
02740
02741
02742
02743
02744
02745
02746
02747
02748 inline CSIBCVector4D& CSIBCVector4D::Normalize()
02749 {
02750 SI_Float rLen = GetLength();
02751
02752 if ( rLen > SIBCVECTOR_EPS )
02753 {
02754 m_fX /= (SI_Float) rLen ;
02755 m_fY /= (SI_Float) rLen ;
02756 m_fZ /= (SI_Float) rLen ;
02757 m_fW /= (SI_Float) rLen ;
02758 return *this;
02759 }
02760 else
02761 {
02762 return Set(1.0f, 0.0f, 0.0f, 0.0f);
02763 }
02764 }
02765
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776 inline SI_Bool CSIBCVector4D::operator ==
02777 (
02778 const CSIBCVector4D& in_v
02779 ) const
02780 {
02781 return ( ( m_fX == in_v.m_fX ) && ( m_fY == in_v.m_fY )
02782 && ( m_fZ == in_v.m_fZ ) && ( m_fW == in_v.m_fW ) );
02783 }
02784
02785
02786
02787
02788
02789
02790
02791
02792
02793
02794 inline SI_Bool CSIBCVector4D::operator !=
02795 (
02796 const CSIBCVector4D& in_vct
02797 ) const
02798 {
02799 return !( *this==in_vct ) ;
02800 }
02801
02802
02803
02804
02805
02806
02807
02808
02809
02810
02811
02812 inline CSIBCVector4D CSIBCVector4D::operator+
02813 (
02814 const CSIBCVector4D &in_vtx
02815 )
02816 {
02817 CSIBCVector4D v2;
02818
02819 v2.m_fX = m_fX + in_vtx.m_fX;
02820 v2.m_fY = m_fY + in_vtx.m_fY;
02821 v2.m_fZ = m_fZ + in_vtx.m_fZ;
02822 v2.m_fW = m_fW + in_vtx.m_fW;
02823
02824 return v2;
02825 }
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836
02837 inline CSIBCVector4D CSIBCVector4D::operator-
02838 (
02839 const CSIBCVector4D &in_vtx
02840 )
02841 {
02842 CSIBCVector4D v2;
02843
02844 v2.m_fX = m_fX - in_vtx.m_fX;
02845 v2.m_fY = m_fY - in_vtx.m_fY;
02846 v2.m_fZ = m_fZ - in_vtx.m_fZ;
02847 v2.m_fW = m_fW - in_vtx.m_fW;
02848
02849 return v2;
02850 }
02851
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861
02862 inline CSIBCVector4D CSIBCVector4D::operator/
02863 (
02864 const CSIBCVector4D &in_vtx
02865 )
02866 {
02867 CSIBCVector4D v2;
02868
02869 if ((in_vtx.m_fX != 0.0f) &&
02870 (in_vtx.m_fY != 0.0f) &&
02871 (in_vtx.m_fZ != 0.0f) &&
02872 (in_vtx.m_fW != 0.0f))
02873 {
02874 v2.m_fX = m_fX / in_vtx.m_fX;
02875 v2.m_fY = m_fY / in_vtx.m_fY;
02876 v2.m_fZ = m_fZ / in_vtx.m_fZ;
02877 v2.m_fW = m_fW / in_vtx.m_fW;
02878 }
02879
02880 return v2;
02881 }
02882
02883
02884
02885
02886
02887
02888
02889
02890
02891
02892
02893 inline CSIBCVector4D &CSIBCVector4D::operator = (const CSIBCVector3D &in_vtx )
02894 {
02895 m_fX = in_vtx.m_fX;
02896 m_fY = in_vtx.m_fY;
02897 m_fZ = in_vtx.m_fZ;
02898 return *this;
02899 }
02900
02901
02902
02903
02904
02905
02906
02907
02908
02909
02910 inline CSIBCVector4D& CSIBCVector4D::SetNull()
02911 {
02912 m_fX = m_fY = m_fZ = m_fW = 0.0f;
02913
02914 return *this;
02915 }
02916
02917
02918
02919
02920
02921
02922
02923
02924
02925
02926 inline CSIBCVector4D& CSIBCVector4D::Negate()
02927 {
02928 m_fX = -m_fX;
02929 m_fY = -m_fY;
02930 m_fZ = -m_fZ;
02931 m_fW = -m_fW;
02932 return *this;
02933 }
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946 inline CSIBCVector4D& CSIBCVector4D::Add
02947 (
02948 const CSIBCVector4D& in_vct
02949 )
02950 {
02951 m_fX += in_vct.m_fX;
02952 m_fY += in_vct.m_fY;
02953 m_fZ += in_vct.m_fZ;
02954 m_fW += in_vct.m_fW;
02955 return *this;
02956 }
02957
02958
02959
02960
02961
02962
02963
02964
02965
02966
02967
02968
02969 inline CSIBCVector4D& CSIBCVector4D::Sub
02970 (
02971 const CSIBCVector4D& in_vct
02972 )
02973 {
02974 m_fX -= in_vct.m_fX;
02975 m_fY -= in_vct.m_fY;
02976 m_fZ -= in_vct.m_fZ;
02977 m_fW -= in_vct.m_fW;
02978 return *this;
02979 }
02980
02981
02982
02983
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993 inline CSIBCVector4D& CSIBCVector4D::Scale
02994 (
02995 const SI_Float in_dFactor
02996 )
02997 {
02998 m_fX *= (SI_Float) in_dFactor;
02999 m_fY *= (SI_Float) in_dFactor;
03000 m_fZ *= (SI_Float) in_dFactor;
03001 m_fW *= (SI_Float) in_dFactor;
03002 return *this;
03003 }
03004
03005
03006
03007
03008
03009
03010
03011
03012
03013
03014
03015
03016
03017 inline CSIBCVector4D& CSIBCVector4D::MulComp
03018 (
03019 const CSIBCVector4D& in_vct
03020 )
03021 {
03022 m_fX *= in_vct.m_fX;
03023 m_fY *= in_vct.m_fY;
03024 m_fZ *= in_vct.m_fZ;
03025 return *this;
03026 }
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037
03038
03039 inline CSIBCVector4D& CSIBCVector4D::DivComp
03040 (
03041 const CSIBCVector4D& in_vct
03042 )
03043 {
03044 if (in_vct.m_fX != 0.0f &&
03045 in_vct.m_fY != 0.0f &&
03046 in_vct.m_fZ != 0.0f &&
03047 in_vct.m_fW != 0.0f)
03048 {
03049 m_fX /= in_vct.m_fX;
03050 m_fY /= in_vct.m_fY;
03051 m_fZ /= in_vct.m_fZ;
03052 m_fW /= in_vct.m_fW;
03053 }
03054
03055 return *this;
03056 }
03057
03058
03059
03060
03061
03062
03063
03064
03065
03066
03067
03068
03069
03070
03071 inline CSIBCVector4D& CSIBCVector4D::Set
03072 (
03073 SI_Float in_dX,
03074 SI_Float in_dY,
03075 SI_Float in_dZ,
03076 SI_Float in_dW
03077 )
03078 {
03079 m_fX = (SI_Float) in_dX;
03080 m_fY = (SI_Float) in_dY;
03081 m_fZ = (SI_Float) in_dZ;
03082 m_fW = (SI_Float) in_dW;
03083 return *this;
03084 }
03085
03086
03087 #endif // CSIBCVector