1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include <Graphic3d_Group.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Arrow.hxx>
#include <gp_Dir.hxx>
#include <Prs3d_LineAspect.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
void Prs3d_Vector::Add(const Handle(Prs3d_Presentation)& aPresentation,
const anyVector& aVector,
const Handle(Prs3d_Drawer)& aDrawer )
{
gp_Pnt Pnt = VectorTool::Location(aVector);
gp_Vec Vec = VectorTool::Vec(aVector);
Quantity_Length x1,y1,z1,dx,dy,dz;
Pnt.Coord(x1,y1,z1);
Vec.Coord(dx,dy,dz);
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
G->SetPrimitivesAspect(aDrawer->VectorAspect()->Aspect());
Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
aDrawer->VectorAspect()->Aspect()->Values(Col,Tol,W);
Graphic3d_Array1OfVertex A(1,2);
//
// Trace d'une petite sphere au debut du vecteur:
//
Graphic3d_Vertex VTX;
VTX.SetCoord(x1,y1,z1);
Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d
(Aspect_TOM_BALL,Col,1.);
G->SetPrimitivesAspect(Asp);
G->Marker(VTX);
A(1).SetCoord(x1,y1,z1);
A(2).SetCoord(x1+dx,y1+dy,z1+dz);
G->Polyline(A);
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x1+dx,y1+dy,z1+dz),gp_Dir(Vec),
PI/180.*10.,Sqrt(dx*dx+dy*dy+dz*dz)/10.);
}
|