For all issues regarding the Forums use, please, refer to the Forum Rules.

### Our Solutions

Need professional assistance?
Consider our:

Need to speed up your development?
Have a look at our:

Need some functionality extending standard OCCT capabilities?
Check out our:

# How to fing the normal to a curve ??

Forums:

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

### Re: How to find the normal to a curve

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

### Re: How to fing the normal to a curve

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.

### Re: How to fing the normal to a curve

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

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

Can we compute the normal in case of line.
bcz for line the 2nd derivative becomes (0, 0, 0).

Pls. Help ??

Thanks in Advance.

### Thanxs Guys Nice from you...

NT = Nothing To Tell Omar Msaaf

### FOLLOW OPEN CASCADE

Twitter      LinkedIn

Google+    Youtube

A Capgemini Group Company