37 hemo::Array<T,3> x1 = mesh.getVertex(iVertex), x2({0.,0.,0.}), x3({0.,0.,0.}), x4({0.,0.,0.});
39 std::vector<plint> adjacentTriangles = mesh.getAdjacentTriangleIds(iVertex, jVertex);
40 plint iTriangle=adjacentTriangles[0], jTriangle=adjacentTriangles[1];
41 x3 = mesh.getVertex(jVertex);
43 for (
pluint id = 0;
id < 3; ++id) {
44 kVertex = mesh.getVertexId(iTriangle,
id);
45 if ( (kVertex != iVertex) && (kVertex != jVertex) ) {
46 x2 = mesh.getVertex(kVertex);
51 for (
pluint id = 0;
id < 3; ++id) {
52 lVertex = mesh.getVertexId(jTriangle,
id);
53 if ( (lVertex != iVertex) && (lVertex != jVertex) ) {
54 x4 = mesh.getVertex(lVertex);
59 PLB_ASSERT(foundVertices == 2);
63 T angle = angleBetweenVectors(V1, V2);
64 plint sign = dot(x2-x1, V2) >= 0?1:-1;
68 angle = (angle >
PI)?angle-2*
PI:angle;
88 FILE *fp = fopen(fname.c_str(),
"w");
89 PLB_ASSERT(fp != NULL);
91 char fmt1[64] =
" facet normal ";
92 char fmt2[64] =
" vertex ";
93 if (
sizeof(
T) ==
sizeof(
long double)) {
94 strcat(fmt1,
"% Le % Le % Le\n");
95 strcat(fmt2,
"% Le % Le % Le\n");
97 else if (
sizeof(
T) ==
sizeof(
float) ||
98 sizeof(
T) ==
sizeof(
double)) {
99 strcat(fmt1,
"% e % e % e\n");
100 strcat(fmt2,
"% e % e % e\n");
106 fprintf(fp,
"solid surface\n");
107 for (
plint i = 0; i < mesh.getNumTriangles(); i++) {
110 fprintf(fp, fmt1, n[0], n[1], n[2]);
111 fprintf(fp,
" outer loop\n");
112 v = dx * mesh.getVertex(i, 0);
113 fprintf(fp, fmt2, v[0], v[1], v[2]);
114 v = dx * mesh.getVertex(i, 1);
115 fprintf(fp, fmt2, v[0], v[1], v[2]);
116 v = dx * mesh.getVertex(i, 2);
117 fprintf(fp, fmt2, v[0], v[1], v[2]);
118 fprintf(fp,
" endloop\n");
119 fprintf(fp,
" endfacet\n");
121 fprintf(fp,
"endsolid surface\n");
T calculateSignedAngle(TriangularSurfaceMesh< T > const &mesh, plint iVertex, plint jVertex, plint &kVertex, plint &lVertex)
Definition meshMetrics.hh:36