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