Author Topic: Normal to face of solid  (Read 2662 times)

0 Members and 1 Guest are viewing this topic.

bikelink

  • Guest
Normal to face of solid
« on: May 21, 2009, 04:42:42 AM »
I'm not able to get the normal of a face of solid3d.
I iterate through the brep but i can't find any info about it...
Does someone have any idea to get it ?

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: Normal to face of solid
« Reply #1 on: May 21, 2009, 06:41:12 AM »
What you have to do is assertain what type of face you're dealing with and convert it to the coresponding geometry type, for example, in C++, if it's a type of 'kPlane' (which you can get by using the getNativeGeometry() function), you can cast it to a AcGePlane object and query it from there.
There is examples of getting of brep data in the ARX SDK, might be a bit of a stretch though if you are new to C++ and ARX.

How to do it in C#/VB.Net is another story though :) there's a post on Kean's blog about it which might help.

A quick hack though is to loop through the face's edges, find out what the winding is (this is important as edges can produce wrong normals depending on their direction in relation to the last edge) and find 2 edges that comply with the winding and get their cross product which is the face's normal.

Easy eh :)

Sorry I can't be more help at the moment but there's plenty of clues and tips in there to ponder, cheers.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

Strucmad

  • Guest
Re: Normal to face of solid
« Reply #2 on: May 21, 2009, 07:17:53 AM »
Sorry Mick to piggy back a question,

I'm no programmer, but just a linear algebra question?

The winding you mentioned, I'm just curious if that is the direction of the edges,
my question really is `how can a cross product of 2 vectors that are on a plain give a wrong normal'

that one has got me scratching my head.???


bikelink

  • Guest
Re: Normal to face of solid
« Reply #3 on: May 21, 2009, 07:20:35 AM »
thank You
But I don't understood the speech about the last edge of loop.
Isn't it as others edges ?
If I have a loop (with 3 edges) can I consider the first and the second edge to obtain the normal ?

bikelink

  • Guest
Re: Normal to face of solid
« Reply #4 on: May 21, 2009, 07:23:57 AM »
Sorry Mick to piggy back a question,

I'm no programmer, but just a linear algebra question?

The winding you mentioned, I'm just curious if that is the direction of the edges,
my question really is `how can a cross product of 2 vectors that are on a plain give a wrong normal'

that one has got me scratching my head.???



I think that  MickD talks about "clockwise" orientation edges.. if those are clock oriented you have a normal ...normal -negate otherwise.

Strucmad

  • Guest
Re: Normal to face of solid
« Reply #5 on: May 21, 2009, 07:27:27 AM »
Thanks Bikelink,
I thought that was his intention, similar to a polyline direction, clockwise, anti-clockwise stuff. :-)

mick I think you threw me with the word 'wrong'   :oops:

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: Normal to face of solid
« Reply #6 on: May 21, 2009, 04:17:47 PM »
Yep, I should have said wrong direction. A piccy will illustrate this better :)
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: Normal to face of solid
« Reply #7 on: May 21, 2009, 04:21:55 PM »
Actually, the normals may be the other way around in the above piccy but it's just to illutrate a point.

Basically with the Brep lib, you need to cast the face 'type' to a corresponding geometry type then query the geometry. I don't have the 2009 sdk here to check the help files so I'll have a look later at work.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

bikelink

  • Guest
Re: Normal to face of solid
« Reply #8 on: May 22, 2009, 07:50:35 AM »
OK... I Made it.!
in my case isn't matter the orientation of normal (+ or -) 'cause I need just to know the vector3d..
Now I'm able to obtain the projection of my solid3d as I want. Thank You very much .