Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

How to fing the normal to a curve ??

How to fing the normal to a curve ??
Msaaf Omar 2000/05/04 17:48
Hello, I am trying to calculate the normal and the tangent to a curve belonging to a surface in a given point. COuld some one point me out which package of classes to use ??? I tried using BRepLProp, and GeomProp, but it didn't work. Any help would be appreciated. Thanxs. Omar Msaaf
Thomas 2000/05/04 19:41
Hi Omar,

Have a look at the following classes: GeomLProp_CLProps and GeomLProp_SLProps.

For example: gp_Pnt p1(0,0,1);

gp_Pnt p2(1,2,2);

gp_Pnt p3(2,3,3);

gp_Pnt p4(4,3,4);

gp_Pnt p5(5,5,5);

TColgp_Array1OfPnt array1(1,5); // sizing array

array1.SetValue(1,p1);

array1.SetValue(2,p2);

array1.SetValue(3,p3);

array1.SetValue(4,p4);

array1.SetValue(5,p5);

Handle(Geom_BezierCurve) Curve1 = new Geom_BezierCurve(array1);

gp_Pnt P1 = Curve1->EndPoint();

GeomLProp_CLProps analyse1(Curve1,

Curve1->LastParameter(),

1,

Precision::Confusion());

gp_Dir T1;

analyse1.Tangent(T1);

It should be similar with a surface (GeomLProp_SLProps)

Regards, Thomas
Maxim ZVEREV 2000/05/05 05:53
Hello!

The simpliest way is to use directly the methods of Geom_Curve and Geom_Surface:

for the Curves : see the method Geom_Curve::D1 (which returns vector of first derivative, i.e tangent).

for the Surfaces : see the method Geom_Surface::D1 (which returns two tangent vectors D1U and D1V). Normal is the vector product of two tangencies:

gp_Vec aNorm = aD1U^aD1V;

Best regards.
Michael Gandyra 2000/05/05 07:16
Normally you want to have the main normal. You are able to compute it with a given parameter u:

gp_Pnt aPnt;

gp_Vec d1u, d2u;

Handle_Geom_Curve aCurv=aCertainCurve;

Standard_Real u=aCertainValue;

// get 1st and 2nd derivative in u

aCurv->D2(u, aPnt, d1u, d2u);

Standard_Real nu_dot = d1u.Dot(d2u)/d1u.Magnitude();

gp_Vec t_vec = d1u.Divided(d1u.Magnitude());

// compute the main normal (not the bi normal)

gp_Vec mainn = d2u-(nu_dot*t_vec);

with regards,

Michael

------------------------------------------------------------------

University of Kaiserslautern

Research Group for Computer Application in Engineering Design

------------------------------------------------------------------
maneesh 2013/01/02 16:38
Can we compute the normal in case of line.
bcz for line the 2nd derivative becomes (0, 0, 0).

Pls. Help ??

Thanks in Advance.
Msaaf Omar 2000/05/05 14:06
NT = Nothing To Tell Omar Msaaf
 
 
Latest news
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map