1 -- File: Select3D_SensitiveTriangulation.cdl
2 -- Created: Thu May 15 15:05:37 1997
3 -- Author: Robert COUBLANC
4 -- <rob@robox.paris1.matra-dtv.fr>
5 ---Copyright: Matra Datavision 1997
8 class SensitiveTriangulation from Select3D
9 inherits SensitiveEntity from Select3D
11 ---Purpose: A framework to define selection of a sensitive entity made of a set of triangles.
14 EntityOwner from SelectBasics,
15 Projector from Select3D,
18 ListOfBox2d from SelectBasics,
19 Array1OfPnt from TColgp,
20 Array1OfPnt2d from TColgp,
21 HArray1OfInteger from TColStd,
23 SensitiveTriangle from Select3D,
24 ListOfSensitiveTriangle from Select3D,
29 Triangulation from Poly,
33 Create(OwnerId : EntityOwner from SelectBasics;
34 aTriangulation: Triangulation from Poly;
35 aLoc : Location from TopLoc;
36 InteriorFlag : Boolean from Standard = Standard_True)
37 returns mutable SensitiveTriangulation from Select3D;
39 ---Purpose: Constructs a sensitive triangulation object defined by
40 -- the owner OwnerId, the triangulation aTriangulation,
41 -- the location aLoc, and the flag InteriorFlag.
43 Create(OwnerId : EntityOwner from SelectBasics;
44 aTriangulation: Triangulation from Poly;
45 aLoc : Location from TopLoc;
46 thefreeedges : HArray1OfInteger from TColStd;
48 InteriorFlag : Boolean from Standard)
49 returns mutable SensitiveTriangulation from Select3D;
50 ---Purpose: Constructs a sensitive triangulation object defined by
51 -- the owner OwnerId, the triangulation aTriangulation,
52 -- the location aLoc, the array of free edges
53 -- thefreeedges, the center of gravity theCDG, and the flag InteriorFlag.
54 -- As free edges and the center of gravity do not have
55 -- to be computed later, this syntax reduces computation time.
58 Project (me:mutable;aProjector : Projector from Select3D) is redefined static;
60 ---Purpose: projection of the sensitive primitive in order to
61 -- get 2D boxes for the Sort Algorithm
63 Areas (me:mutable ; boxes : in out ListOfBox2d from SelectBasics) is redefined static;
65 ---Purpose: stores in <boxes> the 2D Boxes which represent the sensitive face
66 -- in the selection algorithm.
68 GetConnected(me:mutable;aLocation: Location from TopLoc)
69 returns SensitiveEntity from Select3D is redefined static;
72 X,Y : Real from Standard;
73 aTol: Real from Standard;
74 DMin: out Real from Standard)
79 XMin,YMin,XMax,YMax : Real from Standard;
80 aTol: Real from Standard)
86 Polyline:Array1OfPnt2d from TColgp;
88 aTol: Real from Standard)
94 ComputeDepth(me;EyeLine: Lin from gp)
95 returns Real from Standard is redefined static;
96 ---Purpose: give the depht of the last detected triangle
97 -- (center of gravity)
99 DetectedTriangle(me) returns Integer from Standard;
100 ---Purpose: Returns the detected three nodes P1, P2, P3 constituting a triangle.
101 -- This triangle is a component of the overall sensitive
102 -- triangulation created at construction time.
105 Triangulation(me) returns any Triangulation from Poly;
106 ---Purpose: Returns the triangulation used at the time of construction.
108 ---C++: return const &
110 CDG3D(me) returns Pnt from gp;
111 ---Purpose: Returns the 3D center of gravity used at the time of construction.
113 ---C++: return const &
115 CDG2D(me) returns Pnt2d from gp;
116 ---Purpose: Returns the 2D center of gravity used at the time of construction.
118 ---C++: return const &
122 IndexOfTriangle : Integer from Standard;
123 IndexinFree : out Integer from Standard)
124 returns Boolean is static private;
127 p0,p1,p2: XY from gp ;
128 aPoint : XY from gp ;
129 aTol : Real from Standard;
130 Dmin : out Real from Standard) returns Integer from Standard;
131 ---Purpose: Dmin gives the distance between the cdg and aPoint
134 ---Category: TheLocations....
136 HasInitLocation(me) returns Boolean from Standard;
139 GetInitLocation(me) returns Location from TopLoc;
141 ---C++: return const &
144 ResetLocation(me:mutable) is redefined virtual;
146 SetLocation(me:mutable;aLoc :Location from TopLoc) is redefined virtual;
150 Dump(me; S: in out OStream;FullDump : Boolean from Standard = Standard_True) is redefined virtual;
153 DetectedTriangle(me;P1,P2,P3 : out Pnt from gp)
154 returns Boolean from Standard;
155 ---Purpose: gives the vertices of detected triangle...
158 DetectedTriangle2d(me;P1,P2,P3 : out Pnt2d from gp)
159 returns Boolean from Standard;
160 ---Purpose: Gets 2D nodes computed by entity using 3D nodes and viewer
161 -- parameters (see Project() method)
163 ComputeTotalTrsf(me:mutable) is static private;
169 myTriangul : Triangulation from Poly;
170 myiniloc : Location from TopLoc;
171 myTrsf : Trsf from gp;
173 myCDG3D : Pnt from gp;
174 myFreeEdges: HArray1OfInteger from TColStd;
175 myIntFlag : Boolean from Standard;
177 myNodes2d : Array1OfPnt2d from TColgp;
178 myCDG2D : Pnt2d from gp;
179 mybox2d : Box2d from Bnd;
182 myDetectedTr: Integer from Standard;
184 end SensitiveTriangulation;