00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __CSIBCVector_H__
00016 #define __CSIBCVector_H__
00017
00018
00019
00020
00021 #include <math.h>
00022 #include <SIBCUtil.h>
00023
00024
00025
00026
00027 #define SIBCVECTOR_EPS 0.00001f
00028
00029 #ifdef _PSX2_ASM
00030 #include "libvu0.h"
00031 #endif
00032
00033
00034
00035
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
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
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
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
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
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
00332
00337 void Dump();
00338
00340 float m_fX;
00341
00343 float m_fY;
00344
00345
00346 protected:
00347 };
00348
00349
00350
00351
00352
00354
00364 class XSICOREEXPORT CSIBCVector3D
00365 {
00366 public:
00367
00368
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
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
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
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
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
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)))
00730 #endif
00731
00733 float m_fY;
00734
00736 float m_fZ;
00737
00738
00739 };
00740
00741
00742
00743
00744
00745
00747
00757 class XSICOREEXPORT CSIBCVector4D
00758 {
00759 public:
00760
00761
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
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
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
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
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
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
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
01048
01049
01050
01051
01052
01053
01054
01055
01056 inline CSIBCVector2D::CSIBCVector2D()
01057 {
01058 m_fX = 0.0f;
01059 m_fY = 0.0f;
01060 }
01061
01062
01063
01064
01065
01066
01067
01068
01069
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
01087
01088
01089
01090
01091
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
01109
01110
01111
01112
01113
01114
01115 inline CSIBCVector2D::~CSIBCVector2D()
01116 {
01117 }
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
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
01146
01147
01148
01149
01150
01151
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
01168
01169
01170
01171
01172
01173
01174 inline SI_Bool CSIBCVector2D::IsNull() const
01175 {
01176
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
01185
01186
01187
01188
01189
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
01204
01205
01206
01207
01208
01209
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
01228
01229
01230
01231
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
01242
01243
01244
01245
01246
01247
01248 inline SI_Float CSIBCVector2D::GetLength() const
01249 {
01250 return (SI_Float)sqrt( GetSquaredLength() );
01251 }
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
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
01279
01280
01281
01282
01283
01284
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
01307
01308
01309
01310
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
01336
01337
01338
01339
01340
01341
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
01355
01356
01357
01358
01359
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
01373
01374
01375
01376
01377
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
01396
01397
01398
01399
01400
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
01419
01420
01421
01422
01423
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
01446
01447
01448
01449
01450
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
01469
01470
01471
01472
01473
01474
01475 inline CSIBCVector2D& CSIBCVector2D::SetNull()
01476 {
01477 m_fX = m_fY = 0.0f;
01478
01479 return *this;
01480 }
01481
01482
01483
01484
01485
01486
01487
01488
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
01502
01503
01504
01505
01506
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
01523
01524
01525
01526
01527
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
01544
01545
01546
01547
01548
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
01565
01566
01567
01568
01569
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
01586
01587
01588
01589
01590
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
01612
01613
01614
01615
01616
01617
01618
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
01635
01636
01637
01638
01639
01640
01641
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
01655
01656
01657
01658
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
01677
01678
01679
01680
01681
01682
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
01703
01704
01705
01706
01707
01708
01709
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
01726
01727
01728
01729
01730
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
01748
01749
01750
01751
01752
01753
01754
01755 inline SI_Bool CSIBCVector3D::IsNull() const
01756 {
01757
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
01767
01768
01769
01770
01771
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
01800
01801
01802
01803
01804
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
01839
01840
01841
01842
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
01870
01871
01872
01873
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
01898
01899
01900
01901
01902
01903
01904
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
01923
01924
01925
01926
01927
01928
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
01951
01952
01953
01954
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
01987
01988
01989
01990
01991
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
02005
02006
02007
02008
02009
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
02023
02024
02025
02026
02027
02028
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
02061
02062
02063
02064
02065
02066
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
02085
02086
02087
02088
02089
02090
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
02111
02112
02113
02114
02115
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
02140
02141
02142
02143
02144
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
02163
02164
02165
02166
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
02179
02180
02181
02182
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
02197
02198
02199
02200
02201
02202
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
02219
02220
02221
02222
02223
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
02241
02242
02243
02244
02245
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
02263
02264
02265
02266
02267
02268
02269
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
02287
02288
02289
02290
02291
02292
02293
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
02310
02311
02312
02313
02314
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
02332
02333
02334
02335
02336
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
02359
02360
02361
02362
02363
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
02383
02384
02385
02386
02387
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
02406
02407
02408
02409
02410
02411
02412
02413
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
02432
02433
02434
02435
02436
02437
02438
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
02453
02454
02455
02456
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
02477
02478
02479
02480
02481
02482
02483
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
02502
02503
02504
02505
02506
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
02522
02523
02524
02525
02526
02527
02528 inline CSIBCVector4D::~CSIBCVector4D()
02529 {
02530 }
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
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
02561
02562
02563
02564
02565
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
02583
02584
02585
02586
02587
02588
02589 inline SI_Bool CSIBCVector4D::IsNull() const
02590 {
02591
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
02602
02603
02604
02605
02606
02607
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
02622
02623
02624
02625
02626
02627
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
02648
02649
02650
02651
02652
02653 inline SI_Float CSIBCVector4D::GetLength() const
02654 {
02655 return (SI_Float)sqrt( GetSquaredLength() );
02656 }
02657
02658
02659
02660
02661
02662
02663
02664
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
02675
02676
02677
02678
02679
02680
02681
02682
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
02701
02702
02703
02704
02705
02706
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
02729
02730
02731
02732
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
02756
02757
02758
02759
02760
02761
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
02775
02776
02777
02778
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
02792
02793
02794
02795
02796
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
02817
02818
02819
02820
02821
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
02842
02843
02844
02845
02846
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
02873
02874
02875
02876
02877
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
02891
02892
02893
02894
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
02907
02908
02909
02910
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
02926
02927
02928
02929
02930
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
02949
02950
02951
02952
02953
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
02972
02973
02974
02975
02976
02977
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
02996
02997
02998
02999
03000
03001
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
03019
03020
03021
03022
03023
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
03048
03049
03050
03051
03052
03053
03054
03055
03056
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