Thu, 05/04/2000 - 19:48
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
Thu, 05/04/2000 - 21: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
Fri, 05/05/2000 - 07: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.
Fri, 05/05/2000 - 09: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
------------------------------------------------------------------
Wed, 01/02/2013 - 19: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.
Fri, 05/05/2000 - 16:06
NT = Nothing To Tell Omar Msaaf