7 #ifndef __geometry_TrianglePN_h__ 8 #define __geometry_TrianglePN_h__ 80 if(isZero(n1) || isZero(n2) || isZero(n3))
82 #if FE_CODEGEN<=FE_DEBUG 83 feLog(
"v1 %s\n",c_print(v1));
84 feLog(
"v2 %s\n",c_print(v2));
85 feLog(
"v3 %s\n",c_print(v3));
86 feLog(
"n1 %s\n",c_print(n1));
87 feLog(
"n2 %s\n",c_print(n2));
88 feLog(
"n3 %s\n",c_print(n3));
90 feX(e_unsolvable,
"TrianglePN<T>::configure",
"zero length normal(s)");
101 const T w12=dot(v2_v1,n1);
102 const T w21=dot(-v2_v1,n2);
103 const T w23=dot(v3_v2,n2);
104 const T w32=dot(-v3_v2,n3);
105 const T w31=dot(v1_v3,n3);
106 const T w13=dot(-v1_v3,n1);
108 m_b210=(T(2)*v1+v2-w12*n1)*T(1.0/3.0);
109 m_b120=(T(2)*v2+v1-w21*n2)*T(1.0/3.0);
110 m_b021=(T(2)*v2+v3-w23*n2)*T(1.0/3.0);
111 m_b012=(T(2)*v3+v2-w32*n3)*T(1.0/3.0);
112 m_b102=(T(2)*v3+v1-w31*n3)*T(1.0/3.0);
113 m_b201=(T(2)*v1+v3-w13*n1)*T(1.0/3.0);
115 const Vector<3,T> E=(m_b210+m_b120+m_b021+m_b012+m_b102+m_b201)*T(1.0/6.0);
117 m_b111=E+(E-V)*T(1.0/2.0);
127 const T v12=T(2)*dot(v2_v1,n1_n2)/dot(v2_v1,v2_v1);
128 const T v23=T(2)*dot(v3_v2,n2_n3)/dot(v3_v2,v3_v2);
129 const T v31=T(2)*dot(v1_v3,n3_n1)/dot(v1_v3,v1_v3);
140 template <
typename T>
145 const T u=barycenter[0];
146 const T v=barycenter[1];
153 vertex=m_b300*uu*u+m_b030*vv*v+m_b003*ww*w+
154 T(3)*(m_b210*uu*v+m_b120*u*vv+m_b201*uu*w+
155 m_b021*vv*w+m_b102*u*ww+m_b012*v*ww)+
158 normal=unit(m_n200*uu+m_n020*vv+m_n002*ww+
159 m_n110*u*v+m_n011*v*w+m_n101*u*w);
162 template <
typename T>
168 return 0.125*(m_b300+m_b030+T(3)*(m_b210+m_b120));
171 return 0.125*(m_b030+m_b003+T(3)*(m_b021+m_b012));
174 return 0.125*(m_b300+m_b003+T(3)*(m_b201+m_b102));
179 template <
typename T>
185 return unit(m_n200+m_n020+m_n110);
188 return unit(m_n020+m_n002+m_n011);
191 return unit(m_n200+m_n002+m_n101);
kernel
Definition: namespace.dox:3
Evaluate barycenter on triangle using Curved PN Triangles.
Definition: TrianglePN.h:24
Barycentric coordinates for a triangle.
Definition: Barycenter.h:26
Edge
halfway between two of the vertices
Definition: TrianglePN.h:28