35#include <libFreeWRL.h>
37#include "../vrml_parser/Structs.h"
38#include "../main/headers.h"
40#include "LinearAlgebra.h"
43void fwnorprint (
float *norm) {
44 printf (
"normals %f %f %f\n",norm[0],norm[1],norm[2]);
47void 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) {
81 veccopy3f(point_normal,facenormals[curpoly].c);
87 for (tmp_b=0; tmp_b<pointfaces[mypoint*POINT_FACES]; tmp_b++) {
88 tmp_a = pointfaces[mypoint*POINT_FACES+tmp_b+1];
91 if (curpoly == tmp_a) {
94 zz = calc_angle_between_two_vectors3f(facenormals[curpoly].c,facenormals[tmp_a].c );
99 if (zz <= creaseAngle) {
101 foundInOtherFaces =
true;
105 vecadd3f(point_normal,point_normal,facenormals[tmp_a].c);
110 if (foundInOtherFaces) {
114 vecnormalize3f(point_normal,point_normal);
120 veccopy3f(point_normal,facenormals[curpoly].c);