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 #ifndef _Matrix_hpointnD_h_
00026 #define _Matrix_hpointnD_h_
00027
00028 #include "matrix_global.h"
00029 #include "point_nd.h"
00030
00031
00032 namespace PLib {
00033
00057 template <class T, int N>
00058 struct HPoint_nD {
00059
00060
00061 };
00062
00063
00064
00065 template <>
00066 struct HPoint_nD<float,3> {
00067 typedef float T;
00068 T *data ;
00069 int created;
00070
00071 HPoint_nD(): data(new T[4]), created(1) { x() = y() = z() = w() = T(); }
00072 HPoint_nD(T *d,int c): data(d), created(c) { ; }
00073 HPoint_nD(T a): data(new T[4]), created(1) { x() = y() = z() = w() = a; }
00074 HPoint_nD(T X, T Y, T Z, T W): data(new T[4]), created(1) { x()=X ; y()=Y; z()=Z; w()=W;}
00075 HPoint_nD(const HPoint_nD& a): data(new T[4]), created(1) { memcpy((void*)data,(void*)a.data,4*sizeof(T)); }
00076 HPoint_nD(const Point_nD<T,3>& a): data(new T[4]), created(1) { memcpy((void*)data,(void*)a.data,(3)*sizeof(T)); data[3] = T(1); }
00077 ~HPoint_nD() { if(created) if(data) delete []data ; }
00078
00079 inline T& x() { return data[0] ;}
00080 inline T x() const { return data[0] ; }
00081 inline T& y() { return data[1] ;}
00082 inline T y() const { return data[1] ;}
00083 inline T& z() { return data[2] ;}
00084 inline T z() const { return data[2] ;}
00085 inline T& w() { return data[3] ;}
00086 inline T w() const { return data[3] ;}
00087
00088 HPoint_nD& operator=(const HPoint_nD& v) { data[0]=v.data[0]; data[1]=v.data[1]; data[2]=v.data[2]; data[3]=v.data[3]; return *this;}
00089 HPoint_nD& operator=(const Point_nD<T,3>& v) {x()=v.x() ; y()=v.y() ; z()=v.z() ; w()=1.0 ; return *this;}
00090 HPoint_nD& operator=(const T v) { x() = y() = z() = w() = v ; return *this ;} ;
00091 HPoint_nD& operator+=(const HPoint_nD& v) { data[0]+=v.data[0]; data[1]+=v.data[1]; data[2]+=v.data[2]; data[3]+=v.data[3]; return *this;}
00092 HPoint_nD& operator-=(const HPoint_nD& v) { data[0]-=v.data[0]; data[1]-=v.data[1]; data[2]-=v.data[2]; data[3]-=v.data[3]; return *this;}
00093
00094 HPoint_nD& operator*=(T v) { data[0]*=v; data[1]*=v; data[2]*=v; data[3]*=v; return *this; }
00095 HPoint_nD& operator/=(T v) { data[0]/=v; data[1]/=v; data[2]/=v; data[3]/=v; return *this; }
00096
00097 void move(const Point_nD<T,3>& m) {
00098 for(int i=3-1;i>=0;--i) {
00099 data[i] += m.data[i]*data[3];
00100 }
00101 }
00102 Point_nD<T,3> projectW() { return Point_nD<T,3>(x(),y(),z()) ; }
00103 };
00104
00105
00106 template <>
00107 struct HPoint_nD<double,3> {
00108 typedef double T;
00109 T *data ;
00110 int created;
00111
00112 HPoint_nD(): data(new T[4]), created(1) { x() = y() = z() = w() = T(); }
00113 HPoint_nD(T *d,int c): data(d), created(c) { ; }
00114 HPoint_nD(T a): data(new T[4]), created(1) { x() = y() = z() = w() = a; }
00115 HPoint_nD(T X, T Y, T Z, T W): data(new T[4]), created(1) { x()=X ; y()=Y; z()=Z; w()=W;}
00116 HPoint_nD(const HPoint_nD& a): data(new T[4]), created(1) { memcpy((void*)data,(void*)a.data,4*sizeof(T)); }
00117 HPoint_nD(const Point_nD<T,3>& a): data(new T[4]), created(1) { memcpy((void*)data,(void*)a.data,(3)*sizeof(T)); data[3] = T(1); }
00118 ~HPoint_nD() { if(created) if(data) delete []data ; }
00119
00120 inline T& x() { return data[0] ;}
00121 inline T x() const { return data[0] ; }
00122 inline T& y() { return data[1] ;}
00123 inline T y() const { return data[1] ;}
00124 inline T& z() { return data[2] ;}
00125 inline T z() const { return data[2] ;}
00126 inline T& w() { return data[3] ;}
00127 inline T w() const { return data[3] ;}
00128
00129 HPoint_nD& operator=(const HPoint_nD& v) { data[0]=v.data[0]; data[1]=v.data[1]; data[2]=v.data[2]; data[3]=v.data[3]; return *this;}
00130 HPoint_nD& operator=(const Point_nD<T,3>& v) {x()=v.x() ; y()=v.y() ; z()=v.z() ; w()=1.0 ; return *this;}
00131 HPoint_nD& operator=(const T v) { x() = y() = z() = w() = v ; return *this ;} ;
00132 HPoint_nD& operator+=(const HPoint_nD& v) { data[0]+=v.data[0]; data[1]+=v.data[1]; data[2]+=v.data[2]; data[3]+=v.data[3]; return *this;}
00133 HPoint_nD& operator-=(const HPoint_nD& v) { data[0]-=v.data[0]; data[1]-=v.data[1]; data[2]-=v.data[2]; data[3]-=v.data[3]; return *this;}
00134
00135 HPoint_nD& operator*=(T v) { data[0]*=v; data[1]*=v; data[2]*=v; data[3]*=v; return *this; }
00136 HPoint_nD& operator/=(T v) { data[0]/=v; data[1]/=v; data[2]/=v; data[3]/=v; return *this; }
00137
00138 void move(const Point_nD<T,3>& m) {
00139 for(int i=3-1;i>=0;--i) {
00140 data[i] += m.data[i]*data[3];
00141 }
00142 }
00143 Point_nD<T,3> projectW() { return Point_nD<T,3>(x(),y(),z()) ; }
00144 };
00145
00146
00147
00148
00149
00161 template <>
00162 struct HPoint_nD<float,2> {
00163 typedef float T;
00164 T *data ;
00165 int created;
00166
00167 HPoint_nD(): data(new T[3]), created(1) { x() = y() = w() = T(); }
00168 HPoint_nD(T *d,int c): data(d), created(c) { ; }
00169 HPoint_nD(T a): data(new T[3]), created(1) { x() = y() = w() = a; }
00170 HPoint_nD(T X, T Y, T W): data(new T[3]), created(1) { x()=X ; y()=Y; w()=W;}
00171 HPoint_nD(T X, T Y, T Z, T W): data(new T[3]), created(1) { x()=X ; y()=Y; w()=W;}
00172 HPoint_nD(const HPoint_nD& a): data(new T[3]), created(1) { memcpy((void*)data,(void*)a.data,3*sizeof(T)); }
00173 HPoint_nD(const Point_nD<T,2>& a): data(new T[3]), created(1) { memcpy((void*)data,(void*)a.data,(2)*sizeof(T)); data[2] = T(1); }
00174 ~HPoint_nD() { if(created) if(data) delete []data ; }
00175
00176 inline T& x() { return data[0] ;}
00177 inline T x() const { return data[0] ; }
00178 inline T& y() { return data[1] ;}
00179 inline T y() const { return data[1] ;}
00180 inline T& z() { return dumbVar;}
00181 inline T z() const { return T(0) ;}
00182 inline T& w() { return data[2] ;}
00183 inline T w() const { return data[2] ;}
00184
00185
00186 HPoint_nD<T,2>& operator=(const HPoint_nD<T,2>& v) { data[0]=v.data[0]; data[1]=v.data[1]; data[2]=v.data[2]; return *this;}
00187 HPoint_nD<T,2>& operator=(const Point_nD<T,2>& v) {x()=v.x() ; y()=v.y() ; w()=1.0 ; return *this;}
00188 HPoint_nD<T,2>& operator=(const T v) { x() = y() = w() = v ; return *this ;} ;
00189
00190 HPoint_nD<T,2>& operator*=(T v) { data[0]*=v; data[1]*=v; data[2]*=v; return *this; }
00191 HPoint_nD<T,2>& operator/=(T v) { data[0]/=v; data[1]/=v; data[2]/=v; return *this; }
00192
00193 HPoint_nD<T,2>& operator-=(const HPoint_nD<T,2>& v) { data[0]-=v.data[0]; data[1]-=v.data[1]; data[2]-=v.data[2]; return *this;}
00194 HPoint_nD<T,2>& operator+=(const HPoint_nD<T,2>& v) { data[0]+=v.data[0]; data[1]+=v.data[1]; data[2]+=v.data[2]; return *this;}
00195
00196 void move(const Point_nD<T,2>& m) {
00197 for(int i=2-1;i>=0;--i) {
00198 data[i] += m.data[i]*data[2];
00199 }
00200 }
00201 Point_nD<T,2> projectW() { return Point_nD<T,2>(x(),y()) ; }
00202
00203 protected:
00204 static T dumbVar ;
00205 };
00206
00207
00208 template <>
00209 struct HPoint_nD<double,2> {
00210 typedef double T;
00211 T *data ;
00212 int created;
00213
00214 HPoint_nD(): data(new T[3]), created(1) { x() = y() = w() = T(); }
00215 HPoint_nD(T *d,int c): data(d), created(c) { ; }
00216 HPoint_nD(T a): data(new T[3]), created(1) { x() = y() = w() = a; }
00217 HPoint_nD(T X, T Y, T W): data(new T[3]), created(1) { x()=X ; y()=Y; w()=W;}
00218 HPoint_nD(T X, T Y, T Z, T W): data(new T[3]), created(1) { x()=X ; y()=Y; w()=W;}
00219 HPoint_nD(const HPoint_nD& a): data(new T[3]), created(1) { memcpy((void*)data,(void*)a.data,3*sizeof(T)); }
00220 HPoint_nD(const Point_nD<T,2>& a): data(new T[3]), created(1) { memcpy((void*)data,(void*)a.data,(2)*sizeof(T)); data[2] = T(1); }
00221 ~HPoint_nD() { if(created) if(data) delete []data ; }
00222
00223 inline T& x() { return data[0] ;}
00224 inline T x() const { return data[0] ; }
00225 inline T& y() { return data[1] ;}
00226 inline T y() const { return data[1] ;}
00227 inline T& z() { return dumbVar;}
00228 inline T z() const { return T(0) ;}
00229 inline T& w() { return data[2] ;}
00230 inline T w() const { return data[2] ;}
00231
00232
00233 HPoint_nD<T,2>& operator=(const HPoint_nD<T,2>& v) { data[0]=v.data[0]; data[1]=v.data[1]; data[2]=v.data[2]; return *this;}
00234 HPoint_nD<T,2>& operator=(const Point_nD<T,2>& v) {x()=v.x() ; y()=v.y() ; w()=1.0 ; return *this;}
00235 HPoint_nD<T,2>& operator=(const T v) { x() = y() = w() = v ; return *this ;} ;
00236
00237 HPoint_nD<T,2>& operator*=(T v) { data[0]*=v; data[1]*=v; data[2]*=v; return *this; }
00238 HPoint_nD<T,2>& operator/=(T v) { data[0]/=v; data[1]/=v; data[2]/=v; return *this; }
00239
00240 HPoint_nD<T,2>& operator-=(const HPoint_nD<T,2>& v) { data[0]-=v.data[0]; data[1]-=v.data[1]; data[2]-=v.data[2]; return *this;}
00241 HPoint_nD<T,2>& operator+=(const HPoint_nD<T,2>& v) { data[0]+=v.data[0]; data[1]+=v.data[1]; data[2]+=v.data[2]; return *this;}
00242
00243 void move(const Point_nD<T,2>& m) {
00244 for(int i=2-1;i>=0;--i) {
00245 data[i] += m.data[i]*data[2];
00246 }
00247 }
00248
00249 Point_nD<T,2> projectW() { return Point_nD<T,2>(x(),y()) ; }
00250
00251 protected:
00252 static T dumbVar ;
00253 };
00254
00255
00256
00268 template <class T, const int D>
00269 class NoInitHPoint_nD : public HPoint_nD<T,D> {
00270 public:
00271 NoInitHPoint_nD() : HPoint_nD<T,D>(0,0) { ; }
00272 };
00273
00274
00286 template <class T>
00287 class NoInitHPoint_2D : public HPoint_nD<T,2> {
00288 public:
00289 NoInitHPoint_2D() : HPoint_nD<T,2>(0,0) { ; }
00290 };
00291
00292
00293
00307 template <class T, int D>
00308 inline HPoint_nD<T,D> operator+(const HPoint_nD<T,D>&a,const HPoint_nD<T,D>&b) {
00309 HPoint_nD<T,D> sum(a) ;
00310 sum += b ;
00311 return sum ;
00312 }
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325 template <class T, int D>
00326 inline HPoint_nD<T,D> operator-(const HPoint_nD<T,D>&a,const HPoint_nD<T,D>&b) {
00327 HPoint_nD<T,D> diff(a) ;
00328 diff -= b ;
00329 return diff ;
00330 }
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343 template <class T>
00344 inline T dot(const HPoint_nD<T,3>&a,const HPoint_nD<T,3>&b) {
00345 return a.x()*b.x()+a.y()*b.y()+a.z()*b.z()+a.w()*b.w() ;
00346 }
00347
00348 template <class T>
00349 inline T dot(const HPoint_nD<T,2>&a,const HPoint_nD<T,2>&b) {
00350 return a.x()*b.x()+a.y()*b.y()+a.w()*b.w() ;
00351 }
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364 template <class T>
00365 inline HPoint_nD<T,3> operator*(const HPoint_nD<T,3>&b, T a) {
00366 HPoint_nD<T,3> mul(b.x()*a,b.y()*a,b.z()*a,b.w()*a) ;
00367 return mul;
00368 }
00369
00370 template <class T>
00371 inline HPoint_nD<T,2> operator*(const HPoint_nD<T,2>&b, T a) {
00372 HPoint_nD<T,3> mul(b.x()*a,b.y()*a,b.w()*a) ;
00373 return mul;
00374 }
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386 template <class T>
00387 inline HPoint_nD<T,3> operator*( T a, const HPoint_nD<T,3>&b) {
00388 HPoint_nD<T,3> mul(b.x()*a,b.y()*a,b.z()*a,b.w()*a) ;
00389 return mul;
00390
00391
00392
00393 }
00394
00395 inline HPoint_nD<float,3> operator*( double a, const HPoint_nD<float,3>&b) {
00396 HPoint_nD<float,3> mul(b.x()*a,b.y()*a,b.z()*a,b.w()*a) ;
00397 return mul;
00398 }
00399
00400
00401 template <class T>
00402 inline HPoint_nD<T,2> operator*(T a, const HPoint_nD<T,2>&b) {
00403 HPoint_nD<T,2> mul(b.x()*a,b.y()*a,b.w()*a) ;
00404 return mul;
00405 }
00406
00407 inline HPoint_nD<float,2> operator*(double a, const HPoint_nD<float,2>&b) {
00408 HPoint_nD<float,2> mul(b.x()*a,b.y()*a,b.w()*a) ;
00409 return mul;
00410 }
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 template <class T>
00424 inline T operator*(const HPoint_nD<T,3>&a,const HPoint_nD<T,3>&b) {
00425 return a.x()*b.x()+a.y()*b.y()+a.z()*b.z()+a.w()*b.w() ;
00426 }
00427
00428 template <class T>
00429 inline T operator*(const HPoint_nD<T,2>&a,const HPoint_nD<T,2>&b) {
00430 return a.x()*b.x()+a.y()*b.y()+a.w()*b.w() ;
00431 }
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445 template <class T>
00446 inline HPoint_nD<T,3> operator/(const HPoint_nD<T,3>&a,const T b) {
00447 HPoint_nD<T,3> div(a.x()/b,a.y()/b,a.z()/b,a.w()/b) ;
00448 return div ;
00449 }
00450
00451 inline HPoint_nD<float,3> operator/(const HPoint_nD<float,3>&a,const double b) {
00452 HPoint_nD<float,3> div(float(a.x()/b),float(a.y()/b),float(a.z()/b),float(a.w()/b)) ;
00453 return div ;
00454 }
00455
00456 template <class T>
00457 inline HPoint_nD<T,2> operator/(const HPoint_nD<T,2>&a,const T b) {
00458 HPoint_nD<T,2> div(a.x()/b,a.y()/b,a.w()/b) ;
00459 return div ;
00460 }
00461
00462 inline HPoint_nD<float,2> operator/(const HPoint_nD<float,2>&a,const double b) {
00463 HPoint_nD<float,2> div(float(a.x()/b),float(a.y()/b),float(a.w()/b)) ;
00464 return div ;
00465 }
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479 template <class T, int D>
00480 inline int operator==(const HPoint_nD<T,D>& a, T b) {
00481 int r ;
00482 r = 1 ;
00483 for(int i=3;i>=0;--i)
00484 r = r && a.data[i]==b ;
00485 return r ;
00486 }
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499 template <class T, int D>
00500 inline int operator!=(const HPoint_nD<T,D>& a, const HPoint_nD<T,D>& b){
00501 return !(a==b) ;
00502 }
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515 template <class T, int D>
00516 inline int operator==(const HPoint_nD<T,D>& a, const HPoint_nD<T,D>& b){
00517 int r = 1 ;
00518 for(int i=D;i>=0;--i)
00519 r = r && a.data[i]==b.data[i] ;
00520 return r ;
00521 }
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535 template <class T,int N>
00536 inline T norm2(const HPoint_nD<T,N>& a){
00537 double temp = 0 ;
00538 for(int i=N-1;i>=0;--i)
00539 temp += a.data[i]*a.data[i] ;
00540 return temp ;
00541 }
00542
00543 template <class T,int N>
00544 inline double norm(const HPoint_nD<T,N>& a) { return sqrt(norm2(a)); }
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558 template <class T, int D>
00559 inline T angle(const HPoint_nD<T,D>& a,const HPoint_nD<T,D>& b) {
00560 if(b==0 || a==0 )
00561 return 0 ;
00562 return dot(a,b)/norm(a)/norm(b) ;
00563 }
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593 template <class T>
00594 inline ostream& operator<<(ostream& os,const HPoint_nD<T,3>& point)
00595 {
00596 os << point.x() << " " << point.y() << " " << point.z() << " " << point.w() << " " ;
00597 return os;
00598 }
00599
00600 template <class T>
00601 inline ostream& operator<<(ostream& os,const HPoint_nD<T,2>& point)
00602 {
00603 os << point.x() << " " << point.y() << " " << point.w() << " " ;
00604 return os;
00605 }
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617 template <class T, int D>
00618 inline T distance3D(const HPoint_nD<T,D>& a, const HPoint_nD<T,D>& b) {
00619 return norm(project(a)-project(b)) ;
00620 }
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632 template <class T>
00633 inline istream& operator>>(istream& os, HPoint_nD<T,3>& point){
00634 float x,y,z,w ;
00635 os >> x >> y >> z >> w;
00636 point.data[0] = x ;
00637 point.data[1] = y ;
00638 point.data[2] = z ;
00639 point.data[3] = w ;
00640 return os ;
00641 }
00642
00643 template <class T>
00644 inline istream& operator>>(istream& os, HPoint_nD<T,2>& point){
00645 float x,y,w ;
00646 os >> x >> y >> w;
00647 point.data[0] = x ;
00648 point.data[1] = y ;
00649 point.data[2] = w ;
00650 return os ;
00651 }
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665 template <class T>
00666 inline Point_nD<T,3> project(const HPoint_nD<T,3>&a) {
00667 Point_nD<T,3> p(a.data[0]/a.data[3],a.data[1]/a.data[3],a.data[2]/a.data[3]) ;
00668 return p ;
00669 }
00670
00671 template <class T>
00672 inline Point_nD<T,2> project(const HPoint_nD<T,2>&a) {
00673 Point_nD<T,2> p(a.x()/a.w(),a.y()/a.w()) ;
00674 return p ;
00675 }
00676
00677
00678 template <class T, int N>
00679 inline int operator<(const HPoint_nD<T,N>& a, const HPoint_nD<T,N>& b) {
00680 return norm2(a)<norm2(b) ? 1 : 0 ;}
00681 template <class T, int N>
00682 inline int operator>(const HPoint_nD<T,N>& a, const HPoint_nD<T,N>& b) {
00683 return norm2(a)>norm2(b) ? 1 : 0 ;}
00684 template <class T, int N>
00685 inline int operator<=(const HPoint_nD<T,N>& a, const HPoint_nD<T,N>& b) {
00686 return norm2(a)<=norm2(b) ? 1 : 0 ;}
00687 template <class T, int N>
00688 inline int operator>=(const HPoint_nD<T,N>& a, const HPoint_nD<T,N>& b) {
00689 return norm2(a)>=norm2(b) ? 1 : 0 ;}
00690
00691
00692 template <class T>
00693 inline HPoint_nD<T,2> minimum(HPoint_nD<T,2> a, HPoint_nD<T,2> b){
00694 HPoint_nD<T,2> m ;
00695 m.x() = minimum(a.x(),b.x()) ;
00696 m.y() = minimum(a.y(),b.y()) ;
00697 m.w() = minimum(a.w(),b.w()) ;
00698 return m ;
00699 }
00700
00701 template <class T>
00702 inline HPoint_nD<T,3> minimum(HPoint_nD<T,3> a, HPoint_nD<T,3> b){
00703 HPoint_nD<T,3> m ;
00704 m.x() = minimum(a.x(),b.x()) ;
00705 m.y() = minimum(a.y(),b.y()) ;
00706 m.z() = minimum(a.z(),b.z()) ;
00707 m.w() = minimum(a.w(),b.w()) ;
00708 return m ;
00709 }
00710
00711
00712 template <class T>
00713 inline HPoint_nD<T,2> maximum(HPoint_nD<T,2> a, HPoint_nD<T,2> b){
00714 HPoint_nD<T,2> m ;
00715 m.x() = maximum(a.x(),b.x()) ;
00716 m.y() = maximum(a.y(),b.y()) ;
00717 m.w() = maximum(a.w(),b.w()) ;
00718 return m ;
00719 }
00720
00721 template <class T>
00722 inline HPoint_nD<T,3> maximum(HPoint_nD<T,3> a, HPoint_nD<T,3> b){
00723 HPoint_nD<T,3> m ;
00724 m.x() = maximum(a.x(),b.x()) ;
00725 m.y() = maximum(a.y(),b.y()) ;
00726 m.z() = maximum(a.z(),b.z()) ;
00727 m.w() = maximum(a.w(),b.w()) ;
00728 return m ;
00729 }
00730
00731
00732 template <class T>
00733 inline HPoint_nD<T,3> minimumByRef(const HPoint_nD<T,3> &a, const HPoint_nD<T,3> &b){
00734 HPoint_nD<T,3> m ;
00735 m.x() = minimum(a.x(),b.x()) ;
00736 m.y() = minimum(a.y(),b.y()) ;
00737 m.z() = minimum(a.z(),b.z()) ;
00738 m.w() = minimum(a.w(),b.w()) ;
00739 return m ;
00740 }
00741
00742
00743 template <class T>
00744 inline HPoint_nD<T,2> minimumByRef(const HPoint_nD<T,2> &a, const HPoint_nD<T,2> &b){
00745 HPoint_nD<T,2> m ;
00746 m.x() = minimum(a.x(),b.x()) ;
00747 m.y() = minimum(a.y(),b.y()) ;
00748 m.w() = minimum(a.w(),b.w()) ;
00749 return m ;
00750 }
00751
00752
00753 template <class T>
00754 inline HPoint_nD<T,3> maximumByRef(const HPoint_nD<T,3> &a, const HPoint_nD<T,3> &b){
00755 HPoint_nD<T,3> m ;
00756 m.x() = maximum(a.x(),b.x()) ;
00757 m.y() = maximum(a.y(),b.y()) ;
00758 m.z() = maximum(a.z(),b.z()) ;
00759 m.w() = maximum(a.w(),b.w()) ;
00760 return m ;
00761 }
00762
00763
00764
00765 typedef HPoint_nD<float,3> HPoint3Df ;
00766 typedef HPoint_nD<double,3> HPoint3Dd ;
00767
00768 typedef HPoint_nD<float,2> HPoint2Df ;
00769 typedef HPoint_nD<double,2> HPoint2Dd ;
00770
00771
00772
00773 }
00774
00775 typedef PLib::HPoint_nD<float,3> PlHPoint3Df ;
00776 typedef PLib::HPoint_nD<double,3> PlHPoint3Dd ;
00777
00778 typedef PLib::HPoint_nD<float,2> PlHPoint2Df ;
00779 typedef PLib::HPoint_nD<double,2> PlHPoint2Dd ;
00780
00781 #endif