35 #include <libFreeWRL.h>
37 #include "../vrml_parser/Structs.h"
38 #include "../main/headers.h"
40 #include "LinearAlgebra.h"
43 void fwnorprint (
float *norm) {
44 printf (
"normals %f %f %f\n",norm[0],norm[1],norm[2]);
47 void normalize_ifs_face (
float *point_normal,
69 bool foundInOtherFaces =
false;
71 point_normal[0] = 0.0f; point_normal[1] = 0.0f; point_normal[2] = 0.0f;
77 if (pointfaces[mypoint*POINT_FACES] == 1) {
78 point_normal[0]=(float) facenormals[curpoly].x;
79 point_normal[1]=(float) facenormals[curpoly].y;
80 point_normal[2]=(float) facenormals[curpoly].z;
86 for (tmp_b=0; tmp_b<pointfaces[mypoint*POINT_FACES]; tmp_b++) {
87 tmp_a = pointfaces[mypoint*POINT_FACES+tmp_b+1];
90 if (curpoly == tmp_a) {
93 zz = calc_angle_between_two_vectors(facenormals[curpoly],facenormals[tmp_a] );
98 if (zz <= creaseAngle) {
100 foundInOtherFaces =
true;
101 point_normal[0] += (float) facenormals[tmp_a].x;
102 point_normal[1] += (float) facenormals[tmp_a].y;
103 point_normal[2] += (float) facenormals[tmp_a].z;
108 if (foundInOtherFaces) {
109 temp.x = point_normal[0]; temp.y=point_normal[1]; temp.z=point_normal[2];
110 normalize_vector(&temp);
111 point_normal[0]=(float) temp.x; point_normal[1]=(
float) temp.y; point_normal[2]=(float) temp.z;
114 point_normal[0]=(float) facenormals[curpoly].x;
115 point_normal[1]=(float) facenormals[curpoly].y;
116 point_normal[2]=(float) facenormals[curpoly].z;