@@ -246,6 +246,8 @@ template <class Type,const int DimOut,const int DimIn> cPtxd<Type,DimOut> CastDi
246246
247247template <class Type > inline bool IsNull (const cPtxd<Type,2 > & aP) { return (aP.x () ==0 ) && (aP.y ()==0 );}
248248template <class Type > inline bool IsNull (const cPtxd<Type,3 > & aP) { return (aP.x () ==0 ) && (aP.y ()==0 ) && (aP.z ()==0 );}
249+ template <class Type > inline bool IsNull (const cPtxd<Type,4 > & aP) { return (aP.x () ==0 ) && (aP.y ()==0 ) && (aP.z ()==0 ) &&(aP.t ()==0 );}
250+
249251template <class Type > inline bool IsNotNull (const cPtxd<Type,2 > & aP) { return ! IsNull (aP);}
250252// template <class Type> inline bool IsNotNull (const cPtxd<Type,2> & aP) { return (aP.x() !=0) || (aP.y()!=0);}
251253
@@ -316,6 +318,8 @@ template <class Type> inline cPtxd<Type,2> MulCByC (const cPtxd<Type,2> & aP1,c
316318{ return cPtxd<Type,2 >(aP1.x () * aP2.x (),aP1.y () * aP2.y ()); }
317319template <class Type > inline cPtxd<Type,3 > MulCByC (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
318320{ return cPtxd<Type,3 >(aP1.x () * aP2.x (),aP1.y () * aP2.y (),aP1.z ()*aP2.z ()); }
321+ template <class Type > inline cPtxd<Type,4 > MulCByC (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
322+ { return cPtxd<Type,4 >(aP1.x () * aP2.x (),aP1.y () * aP2.y (),aP1.z ()*aP2.z (),aP1.t ()*aP2.t ()); }
319323
320324// / DivCByC division coordinates by coordinates !! => INT Division; see also RDivCByC
321325template <class Type > inline cPtxd<Type,1 > DivCByC (const cPtxd<Type,1 > & aP1,const cPtxd<Type,1 > & aP2)
@@ -324,6 +328,8 @@ template <class Type> inline cPtxd<Type,2> DivCByC (const cPtxd<Type,2> & aP1,c
324328{ return cPtxd<Type,2 >(aP1.x () / aP2.x (),aP1.y () / aP2.y ()); }
325329template <class Type > inline cPtxd<Type,3 > DivCByC (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
326330{ return cPtxd<Type,3 >(aP1.x () / aP2.x (),aP1.y () / aP2.y (),aP1.z ()/aP2.z ()); }
331+ template <class Type > inline cPtxd<Type,4 > DivCByC (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
332+ { return cPtxd<Type,4 >(aP1.x () / aP2.x (),aP1.y () / aP2.y (),aP1.z ()/aP2.z (),aP1.t ()/aP2.t ()); }
327333
328334
329335// / Some time int division is not what is wanted !!
@@ -336,6 +342,7 @@ template <class T,const int Dim> inline cPtxd<double,Dim> RDivCByC(const cPtxd<T
336342template <class Type > inline cPtxd<Type,1 > operator - (const cPtxd<Type,1 > & aP) {return cPtxd<Type,1 >(-aP.x ());}
337343template <class Type > inline cPtxd<Type,2 > operator - (const cPtxd<Type,2 > & aP) {return cPtxd<Type,2 >(-aP.x (),-aP.y ());}
338344template <class Type > inline cPtxd<Type,3 > operator - (const cPtxd<Type,3 > & aP) {return cPtxd<Type,3 >(-aP.x (),-aP.y (),-aP.z ());}
345+ template <class Type > inline cPtxd<Type,4 > operator - (const cPtxd<Type,4 > & aP) {return cPtxd<Type,4 >(-aP.x (),-aP.y (),-aP.z (),-aP.t ());}
339346
340347
341348// / operator * scalar - points
@@ -396,7 +403,26 @@ template <class T,const int Dim> typename tNumTrait<T>::tFloatAssoc Norm2(const
396403}
397404// template <class T,const int Dim> double Norm2(const cPtxd<T,Dim> & aP);
398405
399- template <class T ,const int Dim> typename tNumTrait<T>::tBig Scal (const cPtxd<T,Dim> &,const cPtxd<T,Dim> &);
406+ // template <class T,const int Dim> typename tNumTrait<T>::tBig Scal(const cPtxd<T,Dim> &,const cPtxd<T,Dim> &);
407+ template <class T > typename tNumTrait<T>::tBig Scal (const cPtxd<T,1 > &aP1,const cPtxd<T,1 > & aP2)
408+ { return aP1.x () * aP2.x ();}
409+ template <class T > typename tNumTrait<T>::tBig Scal (const cPtxd<T,2 > &aP1,const cPtxd<T,2 > & aP2)
410+ { return aP1.x () * aP2.x () + aP1.y () * aP2.y ();}
411+ template <class T > typename tNumTrait<T>::tBig Scal (const cPtxd<T,3 > &aP1,const cPtxd<T,3 > & aP2)
412+ { return aP1.x () * aP2.x () + aP1.y () * aP2.y () + aP1.z () * aP2.z ();}
413+ template <class T > typename tNumTrait<T>::tBig Scal (const cPtxd<T,4 > &aP1,const cPtxd<T,4 > & aP2)
414+ { return aP1.x () * aP2.x () + aP1.y () * aP2.y () + aP1.z () * aP2.z () +aP1.t () * aP2.t ();}
415+ /*
416+ template <class T,const int Dim>
417+ typename tNumTrait<T>::tBig Scal(const cPtxd<T,Dim> &aP1,const cPtxd<T,Dim> & aP2)
418+ {
419+ typename tNumTrait<T>::tBig aRes = aP1[0]*aP2[0];
420+ for (int aD=1 ; aD<Dim; aD++)
421+ aRes += aP1[aD]*aP2[aD];
422+ return aRes;
423+ }
424+ */
425+
400426template <class T ,const int Dim> typename tNumTrait<T>::tBig MulCoord (const cPtxd<T,Dim> & aP);
401427
402428template <class T ,const int Dim> T Cos (const cPtxd<T,Dim> &,const cPtxd<T,Dim> &);
@@ -470,6 +496,8 @@ template <class Type> inline bool SupEq (const cPtxd<Type,2> & aP1,const cPtxd<
470496{return (aP1.x ()>=aP2.x ()) && (aP1.y ()>=aP2.y ());}
471497template <class Type > inline bool SupEq (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
472498{return (aP1.x ()>=aP2.x ()) && (aP1.y ()>=aP2.y ()) && (aP1.z ()>=aP2.z ());}
499+ template <class Type > inline bool SupEq (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
500+ {return (aP1.x ()>=aP2.x ()) && (aP1.y ()>=aP2.y ()) && (aP1.z ()>=aP2.z ()) && (aP1.t ()>=aP2.t ());}
473501
474502
475503// / PtSupEq : smallest point being SupEq to
@@ -479,6 +507,8 @@ template <class Type> inline cPtxd<Type,2> PtSupEq (const cPtxd<Type,2> & aP1,c
479507{ return cPtxd<Type,2 > (std::max (aP1.x (),aP2.x ()),std::max (aP1.y (),aP2.y ())); }
480508template <class Type > inline cPtxd<Type,3 > PtSupEq (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
481509{ return cPtxd<Type,3 > (std::max (aP1.x (),aP2.x ()),std::max (aP1.y (),aP2.y ()),std::max (aP1.z (),aP2.z ())); }
510+ template <class Type > inline cPtxd<Type,4 > PtSupEq (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
511+ { return cPtxd<Type,4 > (std::max (aP1.x (),aP2.x ()),std::max (aP1.y (),aP2.y ()),std::max (aP1.z (),aP2.z ()),std::max (aP1.t (),aP2.t ()) ); }
482512
483513template <class TypePt > void SetSupEq (TypePt & aP1,const TypePt & aP2) {aP1 = PtSupEq (aP1,aP2);}
484514
@@ -489,6 +519,8 @@ template <class Type> inline cPtxd<Type,2> PtInfEq (const cPtxd<Type,2> & aP1,c
489519{ return cPtxd<Type,2 > (std::min (aP1.x (),aP2.x ()),std::min (aP1.y (),aP2.y ())); }
490520template <class Type > inline cPtxd<Type,3 > PtInfEq (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
491521{ return cPtxd<Type,3 > (std::min (aP1.x (),aP2.x ()),std::min (aP1.y (),aP2.y ()),std::min (aP1.z (),aP2.z ())); }
522+ template <class Type > inline cPtxd<Type,4 > PtInfEq (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
523+ { return cPtxd<Type,4 > (std::min (aP1.x (),aP2.x ()),std::min (aP1.y (),aP2.y ()),std::min (aP1.z (),aP2.z ()),std::min (aP1.t (),aP2.t ())); }
492524
493525template <class TypePt > void SetInfEq (TypePt & aP1,const TypePt & aP2) {aP1 = PtInfEq (aP1,aP2);}
494526
@@ -501,6 +533,8 @@ template <class Type> inline bool InfStr (const cPtxd<Type,2> & aP1,const cPtxd
501533{return (aP1.x ()<aP2.x ()) && (aP1.y ()<aP2.y ());}
502534template <class Type > inline bool InfStr (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
503535{return (aP1.x ()<aP2.x ()) && (aP1.y ()<aP2.y ()) && (aP1.z ()<aP2.z ());}
536+ template <class Type > inline bool InfStr (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
537+ {return (aP1.x ()<aP2.x ()) && (aP1.y ()<aP2.y ()) && (aP1.z ()<aP2.z ()) && (aP1.t ()<aP2.t ());}
504538
505539/* * PtInfSTr : bigets point beg=ing InfStr (definition valide for integer types)
506540 Warn non symetric function; strictness is relative to P2, not P1 ;
@@ -519,6 +553,8 @@ template <class Type> inline cPtxd<Type,2> PtInfStr (const cPtxd<Type,2> & aP1,
519553// { return cPtxd<Type,2> (std::min(aP1.x(),aP2.x()-1),std::min(aP1.y(),aP2.y()-1)); }
520554template <class Type > inline cPtxd<Type,3 > PtInfStr (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
521555{ return cPtxd<Type,3 > (std::min (aP1.x (),aP2.x ()-1 ),std::min (aP1.y (),aP2.y ()-1 ),std::min (aP1.z (),aP2.z ()-1 )); }
556+ template <class Type > inline cPtxd<Type,4 > PtInfStr (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
557+ { return cPtxd<Type,4 > (std::min (aP1.x (),aP2.x ()-1 ),std::min (aP1.y (),aP2.y ()-1 ),std::min (aP1.z (),aP2.z ()-1 ),std::min (aP1.t (),aP2.t ()-1 )); }
522558
523559
524560// / InfEq : P1.k() <= P2.k() for all coordinates
@@ -528,6 +564,8 @@ template <class Type> inline bool InfEq (const cPtxd<Type,2> & aP1,const cPtxd<
528564{return (aP1.x ()<=aP2.x ()) && (aP1.y ()<=aP2.y ());}
529565template <class Type > inline bool InfEq (const cPtxd<Type,3 > & aP1,const cPtxd<Type,3 > & aP2)
530566{return (aP1.x ()<=aP2.x ()) && (aP1.y ()<=aP2.y ()) && (aP1.z ()<=aP2.z ());}
567+ template <class Type > inline bool InfEq (const cPtxd<Type,4 > & aP1,const cPtxd<Type,4 > & aP2)
568+ {return (aP1.x ()<=aP2.x ()) && (aP1.y ()<=aP2.y ()) && (aP1.z ()<=aP2.z ()) && (aP1.t ()<=aP2.t ());}
531569
532570
533571template <class T ,const int Dim> cPtxd<T,Dim> VUnit (const cPtxd<T,Dim> & aP);
0 commit comments