7 #ifndef __math_Barycenter_h__ 8 #define __math_Barycenter_h__ 32 {
set(*
this,a_b0,a_b1); }
35 {
set(*
this,a_b0,a_b1,a_b2); }
43 {
set(*
this,a_rOther[0],a_rOther[1]); }
57 {
set(*
this,T(1)-a_u-a_v,a_u);
62 T(1)-(*this)[0]-(*this)[1]); }
83 template<
class T,
typename U,
typename V,
typename W>
86 FEASSERT(fabs(a_b0+a_b1+a_b2-T(1))<T(0.001));
91 template<
int N,
class T,
typename U,
typename V,
typename W>
97 return a_vert0*a_barycenter[0]+a_vert1*a_barycenter[1]+
98 a_vert2*(T(1)-a_barycenter[0]-a_barycenter[1]);
101 template<
class T,
typename U>
103 U a_value0, U a_value1, U a_value2)
105 return a_value0*a_barycenter[0]+a_value1*a_barycenter[1]+
106 a_value2*(T(1)-a_barycenter[0]-a_barycenter[1]);
109 template <
typename T>
116 const T A=a_vert0[0]-a_vert2[0];
117 const T B=a_vert1[0]-a_vert2[0];
118 const T C=a_vert2[0]-a_point[0];
120 const T D=a_vert0[1]-a_vert2[1];
121 const T E=a_vert1[1]-a_vert2[1];
122 const T F=a_vert2[1]-a_point[1];
124 const T G=a_vert0[2]-a_vert2[2];
125 const T H=a_vert1[2]-a_vert2[2];
126 const T I=a_vert2[2]-a_point[2];
128 const T d0=(A*(E+H)-B*(D+G));
129 const T d1=(B*(D+G)-A*(E+H));
131 const T b0=(d0==0.0)? 0.0: (B*(F+I)-C*(E+H))/d0;
132 const T b1=(d1==0.0)? 0.0: (A*(F+I)-C*(D+G))/d1;
138 template <
typename T>
144 const Vector<3,T> point=location(*
this,a_vert0,a_vert1,a_vert2);
149 (*this)[1]=along(a_vert2,a_vert1,point);
151 else if((*
this)[1]<T(0))
153 (*this)[0]=along(a_vert2,a_vert0,point);
158 const T sum=(*this)[0]+(*this)[1];
161 (*this)[0]=along(a_vert1,a_vert0,point);
162 (*this)[1]=T(1)-(*this)[0];
167 template <
typename T>
179 T result=
dot(edge,point-start)/mag2;
kernel
Definition: namespace.dox:3
Barycentric coordinates for a triangle.
Definition: Barycenter.h:26
Dense vector - size fixed by template.
Definition: Vector.h:19
T dot(const Vector< N, T > &lhs, const Vector< N, T > &rhs)
Dot (inner) product.
Definition: Vector.h:768
T magnitudeSquared(const Vector< N, T > &rhs)
Square of the length.
Definition: Vector.h:794