1 // File: DsgPrs_TangentPresentation.cxx
2 // Created: Tue Jan 16 14:29:33 1996
3 // Author: Jean-Pierre COMBE
7 #include <DsgPrs_TangentPresentation.ixx>
9 #include <Graphic3d_Group.hxx>
10 #include <Graphic3d_Array1OfVertex.hxx>
11 #include <Prs3d_Arrow.hxx>
12 #include <Prs3d_ArrowAspect.hxx>
13 #include <Prs3d_LineAspect.hxx>
14 #include <Prs3d_LengthAspect.hxx>
15 #include <Graphic3d_AspectLine3d.hxx>
16 #include <Prs3d_PointAspect.hxx>
17 #include <Geom_CartesianPoint.hxx>
18 #include <StdPrs_Point.hxx>
20 #include <Prs3d_Arrow.hxx>
22 void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
23 const Handle(Prs3d_Drawer)& aDrawer,
24 const gp_Pnt& OffsetPoint,
25 const gp_Dir& aDirection,
26 const Standard_Real length)
28 gp_Vec vec(aDirection);
29 gp_Vec vec1 = vec.Multiplied(length);
30 gp_Vec vec2 = vec.Multiplied(-length);
31 gp_Pnt p1 = OffsetPoint.Translated(vec1);
32 gp_Pnt p2 = OffsetPoint.Translated(vec2);
35 Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
36 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
37 Handle(Prs3d_ArrowAspect) ARR1 = LA->Arrow1Aspect();
38 Handle(Prs3d_ArrowAspect) ARR2 = LA->Arrow2Aspect();
39 ARR1->SetLength(length/5);
40 ARR2->SetLength(length/5);
43 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
44 Graphic3d_Array1OfVertex V(1,2);
45 Quantity_Length X,Y,Z;
50 Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
53 Prs3d_Root::NewGroup(aPresentation);
54 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
55 Prs3d_Arrow::Draw(aPresentation,p1,aDirection,
56 LA->Arrow1Aspect()->Angle(),
57 LA->Arrow1Aspect()->Length());
60 Prs3d_Root::NewGroup(aPresentation);
61 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
62 Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),
63 LA->Arrow2Aspect()->Angle(),
64 LA->Arrow2Aspect()->Length());