Tue, 09/27/2005 - 17:47

Forums:

Hello everyone:

In my project,I want to draw a sphere on a surface which is tangent to the surface.I have known the three coordinates of the tangent point,but how can I get the normal vector of the point on the surface?

Thanks.

Tue, 09/27/2005 - 18:22

Hi Andy,

you can get the direction from the plane assuming its a gp_Pln:

gp_Dir dir=yourPlane.Axis().Direction();

HTH, Torsten

Tue, 09/27/2005 - 18:32

if you have a Geom_Surface, you can use the D1 method to compute the D1U and D1V and after that, compute the cross product of both vector to get the normal (if I remember correctly. I don't have the OCC code installed)

Stephane

Wed, 09/28/2005 - 15:15

Thank you,Torsten and Stephane.In my project ,the type of the surface is uncertain,maybe it's a plane,maybe a cylindrical surface or some other type of suface,so I want to find a way that will be ralative universal to all situations.I have also thought about the method of computing the cross of the D1U and D1V,but how to get the parameters of the point on a random surface so that I can compute the D1U and D1V ?

Thanks a lot!

Andy

Wed, 09/28/2005 - 15:24

Hi Andy,

Geom_Surface::Value(U,V) returns the point on the surface.

You should take a web browser and point it to

whereeverthisis/OpenCASCADE5.2/doc/ClassBrowser/index.htm

Then you have only to find the right class ;-))

Torsten

Wed, 09/28/2005 - 16:18

Hi Torsten ,

Thanks for your help. I also know that function and the Geom_Surface class,but what I want to do is just the opposite.The three coordinates of the point is known to me,I want to get the parameters of the point on a random surface so that I can compute the D1U and D1V ,and afetr that,compute the cross product of both vector to get the normal of the point.

Wed, 09/28/2005 - 16:31

Hi Andy,

Points are a bit difficult at this point because they are easily outside the surface. I don't know how you got your point but the GeomAPI_IntCS class gives you all intersection points between curve and surface and the parameters for curve and surface.

Torsten

Wed, 09/28/2005 - 17:16

Hi Torsten,

In fact,I only want to draw some spheres which are all tangent to a surface.Firstly,I got some points on a curve which is in the surface, i.e. a sequence of equidistant points.That is to say,the three coordinates of the point is known to me.Then I want to draw some spheres tangent to the surface with these points.Do you have some good suggestion?

Andy

Wed, 09/28/2005 - 16:42

the good way is to use GeomAPI_ProjectPointOnSurf.

the method LowerDistanceParameters gives you the U and V you are searching

Stephane

Wed, 09/28/2005 - 17:30

Thank you very much,Stephane.Your suggestion is very useful for me.That's a good idea.But I also have a question.If the point exists in the surface,is the way to use GeomAPI_ProjectPointOnSurf on the point also effectual?

Thu, 09/29/2005 - 17:50

you can try to use Geom_Tools::Parameters or ElSLib::Parameters if you have surfaces where you know the types

Thu, 09/29/2005 - 17:58

Thank you very much!

Andy

Thu, 09/29/2005 - 18:25

you can try to use Geom_Tools::Parameters or ElSLib::Parameters if you have surfaces where you know the types