Home
Reply
New Visitor
chotrespuf
Posts: 1

Normal of a face with left handed uv surface

[ Edited ]

Hi,

I need some help in calculating the normal of a face - with left handed uv surface.

The following code works correctly edutalent for all faces, except the ones with left handed surfaces.

Thanks,

Hari Polisetty

 

 

Face *face; // Input

SPApar_pos uv(u,v); // Input

SPAunit_vector normal; // Output

 

const surface& surf = face->geometry()->equation();

 

normal = surf.eval_normal(uv);

 

 

if(face->sense()==REVERSED)

normal = - normal;

Spatial Employee
asdf
Posts: 93

Re: Normal of a face with left handed uv surface

I think your code is almost right, you just need to take into account both sense bits (the one on the face and the one on the surface).  The logic with sense bits can be complex, but I think the problem could be corrected by simply adding the following lines of code after what you have done.

 

if( surf.left_handed_uv() )

{

    normal = - normal

}

 

Please post if this doesn't work or if you've additional questions.

 

Eric Zenk

Regular Contributor
Vi2
Posts: 55

Re: Normal of a face with left handed uv surface

I think that this code will be more simple and clear:

 

if(face->sense(surf.left_handed_uv()) == REVERSED)
{
	normal = - normal;
}

 Or this:

if(face->sense(surf.left_handed_uv()))
{
	normal = - normal;
}