Skip to content
Snippets Groups Projects
Commit 07b1e842 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix display of normals for very "thin" surfaces with curved boundaries:
this new algorithm should be better
parent a2353de4
No related branches found
No related tags found
No related merge requests found
// $Id: Geom.cpp,v 1.87 2005-06-30 07:13:38 remacle Exp $ // $Id: Geom.cpp,v 1.88 2005-07-03 07:55:32 geuzaine Exp $
// //
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
// //
...@@ -304,11 +304,17 @@ void getPlaneSurfaceNormal(Surface *s, double x, double y, double z, double n[3] ...@@ -304,11 +304,17 @@ void getPlaneSurfaceNormal(Surface *s, double x, double y, double z, double n[3]
t1[0] = x - c->beg->Pos.X; t1[0] = x - c->beg->Pos.X;
t1[1] = y - c->beg->Pos.Y; t1[1] = y - c->beg->Pos.Y;
t1[2] = z - c->beg->Pos.Z; t1[2] = z - c->beg->Pos.Z;
for(int i = 1; i < List_Nbr(s->Generatrices); i++){ // 1) try to get a point close to 'beg' on the same curve
// 2) if we are really unlucky and these two points are aligned
// with (x,y,z), which we know is inside or on the boundary of
// the surface, then get a point from the next generatrice
// 3) repeat
for(int i = 0; i < List_Nbr(s->Generatrices); i++){
List_Read(s->Generatrices, i, &c); List_Read(s->Generatrices, i, &c);
t2[0] = x - c->beg->Pos.X; Vertex v = InterpolateCurve(c, 0.1, 0);
t2[1] = y - c->beg->Pos.Y; t2[0] = x - v.Pos.X;
t2[2] = z - c->beg->Pos.Z; t2[1] = y - v.Pos.Y;
t2[2] = z - v.Pos.Z;
prodve(t1, t2, n); prodve(t1, t2, n);
if(norme(n)) if(norme(n))
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment