4952a30a |
1 | -- File: Select3D_Projector.cdl |
2 | -- Created: Thu Mar 12 13:32:28 1992 |
3 | -- Author: Christophe MARION |
4 | -- <cma@sdsun2> copie quasi exacte de HLRAlgo_Projector |
5 | ---Copyright: Matra Datavision 1992 |
6 | |
7 | class Projector from Select3D inherits Transient from Standard |
8 | ---Purpose: A framework to define 3D projectors. |
7fd59977 |
9 | uses |
10 | Real from Standard, |
11 | Boolean from Standard, |
4952a30a |
12 | Trsf from gp, |
7fd59977 |
13 | GTrsf from gp, |
14 | Lin from gp, |
15 | Pnt from gp, |
16 | Vec from gp, |
17 | Ax2 from gp, |
18 | Vec2d from gp, |
19 | Pnt2d from gp, |
20 | Box from Bnd, |
21 | View from V3d |
4952a30a |
22 | |
7fd59977 |
23 | raises |
24 | NoSuchObject from Standard |
25 | |
26 | is |
27 | |
28 | Create(aView:View from V3d) returns Projector from Select3D; |
4952a30a |
29 | --- Purpose: Constructs the 3D projector object defined by the 3D view aView. |
7fd59977 |
30 | Create returns Projector from Select3D; |
31 | |
32 | Create(CS : Ax2 from gp) |
4952a30a |
33 | ---Purpose: Creates an axonometric projector. <CS> is the |
34 | -- viewing coordinate system. |
7fd59977 |
35 | returns Projector from Select3D; |
36 | |
37 | Create(CS : Ax2 from gp; |
4952a30a |
38 | Focus : Real from Standard) |
39 | ---Purpose: Creates a perspective projector. <CS> is the |
40 | -- viewing coordinate system. |
7fd59977 |
41 | returns Projector from Select3D; |
42 | |
43 | Create(T : Trsf from gp; |
4952a30a |
44 | Persp : Boolean from Standard; |
45 | Focus : Real from Standard) |
46 | ---Purpose: build a Projector with automatic minmax directions. |
7fd59977 |
47 | returns Projector from Select3D; |
48 | |
49 | Create(T : Trsf from gp; |
4952a30a |
50 | Persp : Boolean from Standard; |
51 | Focus : Real from Standard; |
52 | v1,v2,v3 : Vec2d from gp) |
53 | ---Purpose: build a Projector with given minmax directions. |
7fd59977 |
54 | returns Projector from Select3D; |
4952a30a |
55 | |
7fd59977 |
56 | Create(GT : GTrsf from gp; |
4952a30a |
57 | Persp : Boolean from Standard; |
58 | Focus : Real from Standard) |
59 | ---Purpose: build a Projector with automatic minmax directions. |
7fd59977 |
60 | returns Projector from Select3D; |
61 | |
4952a30a |
62 | Set (me : mutable; |
63 | T : Trsf from gp; |
7fd59977 |
64 | Persp : Boolean from Standard; |
4952a30a |
65 | Focus : Real from Standard) |
7fd59977 |
66 | is static; |
67 | |
4952a30a |
68 | |
69 | SetView(me : mutable; V : View from V3d); |
70 | ---Purpose: Sets the 3D view V used at the time of construction. |
7fd59977 |
71 | |
72 | View(me) returns any View from V3d; |
4952a30a |
73 | ---Purpose: Returns the 3D view used at the time of construction. |
74 | ---C++: return const& |
75 | ---C++: inline |
7fd59977 |
76 | |
77 | |
78 | Directions(me; D1 , D2 , D3 : out Vec2d from gp) |
4952a30a |
79 | ---C++: inline |
7fd59977 |
80 | is virtual; |
81 | |
4952a30a |
82 | Scaled(me : mutable; On : Boolean from Standard = Standard_False) |
83 | ---Purpose: to compute with the given scale and translation. |
7fd59977 |
84 | is virtual; |
85 | |
86 | Perspective(me) returns Boolean |
4952a30a |
87 | ---Purpose: Returns True if there is a perspective transformation. |
88 | ---C++: inline |
7fd59977 |
89 | is virtual; |
90 | |
91 | Transformation(me) returns GTrsf from gp |
4952a30a |
92 | ---Purpose: Returns the active transformation. |
93 | ---C++: inline |
94 | ---C++: return const & |
7fd59977 |
95 | is virtual; |
96 | |
97 | InvertedTransformation(me) returns GTrsf from gp |
4952a30a |
98 | ---Purpose: Returns the active inverted transformation. |
99 | ---C++: inline |
100 | ---C++: return const & |
7fd59977 |
101 | is virtual; |
102 | |
103 | FullTransformation(me) returns Trsf from gp |
4952a30a |
104 | ---Purpose: Returns the original transformation. |
105 | ---C++: inline |
106 | ---C++: return const & |
7fd59977 |
107 | is virtual; |
108 | |
109 | Focus(me) returns Real from Standard |
4952a30a |
110 | ---Purpose: Returns the focal length. |
111 | ---C++: inline |
7fd59977 |
112 | raises |
4952a30a |
113 | NoSuchObject from Standard -- if there is no perspective |
7fd59977 |
114 | is virtual; |
4952a30a |
115 | |
7fd59977 |
116 | Transform(me; D : in out Vec from gp) |
4952a30a |
117 | ---C++: inline |
7fd59977 |
118 | is virtual; |
119 | |
120 | Transform(me; Pnt : in out Pnt from gp) |
4952a30a |
121 | ---C++: inline |
7fd59977 |
122 | is virtual; |
4952a30a |
123 | |
7fd59977 |
124 | Project(me; P : Pnt from gp; |
125 | Pout : out Pnt2d from gp) |
4952a30a |
126 | ---Purpose: Transform and apply perspective if needed. |
7fd59977 |
127 | is virtual; |
4952a30a |
128 | |
7fd59977 |
129 | Project(me; P : Pnt from gp; |
130 | X,Y,Z : out Real from Standard) |
4952a30a |
131 | ---Purpose: Transform and apply perspective if needed. |
7fd59977 |
132 | is static; |
4952a30a |
133 | |
7fd59977 |
134 | Project(me; P : Pnt from gp; |
135 | D1 : Vec from gp; |
4952a30a |
136 | Pout : out Pnt2d from gp; |
137 | D1out : out Vec2d from gp) |
138 | ---Purpose: Transform and apply perspective if needed. |
7fd59977 |
139 | is virtual; |
4952a30a |
140 | |
7fd59977 |
141 | BoxAdd(me; P : Pnt2d from gp; |
142 | B : out Box from Bnd) |
4952a30a |
143 | ---Purpose: Adds to the box <B> the min-max of the point <P>. |
7fd59977 |
144 | is virtual; |
145 | |
146 | Shoot(me; X , Y : Real from Standard) |
147 | returns Lin from gp |
4952a30a |
148 | ---Purpose: return a line going through the eye towards the |
149 | -- 2d point <X,Y>. |
150 | is virtual; |
151 | |
152 | DepthMin(me) returns Real from Standard; |
153 | ---Purpose: Returns the minimum depth value (if clipping plane defined). |
154 | --- Should be used when call ::Shoot() to compute eyeline. |
155 | ---C++: inline |
156 | |
157 | DepthMax(me) returns Real from Standard; |
158 | ---Purpose: Returns the maximum depth value (if clipping plane defined). |
159 | --- Should be used when call ::Shoot() to compute eyeline. |
160 | ---C++: inline |
161 | |
162 | DepthMinMax(me : mutable; |
163 | theDepthMin : in Real from Standard; |
164 | theDepthMax : in Real from Standard); |
165 | ---Purpose: Setup the min/max depth values (doesn't affect |
166 | --- projection functionality itself). |
167 | --- Should be used when call ::Shoot() to compute eyeline. |
168 | |
169 | SetDirection(me : mutable) |
170 | is static private; |
171 | |
172 | Transform(me; P : in out Pnt from gp; |
173 | T : GTrsf from gp) |
174 | ---C++: inline |
7fd59977 |
175 | is virtual; |
176 | |
4952a30a |
177 | Transform(me; D : in out Lin from gp; |
178 | T : GTrsf from gp) |
179 | ---C++: inline |
7fd59977 |
180 | is virtual; |
181 | |
182 | fields |
4952a30a |
183 | myType : Integer from Standard; |
184 | |
7fd59977 |
185 | myPersp : Boolean from Standard is protected; |
186 | myFocus : Real from Standard is protected; |
187 | myScaledTrsf : Trsf from gp is protected; |
188 | myGTrsf : GTrsf from gp is protected; |
189 | myInvTrsf : GTrsf from gp is protected; |
190 | myD1 : Vec2d from gp is protected; |
191 | myD2 : Vec2d from gp is protected; |
192 | myD3 : Vec2d from gp is protected; |
193 | |
4952a30a |
194 | myView : View from V3d; |
195 | myDepthMin : Real from Standard; |
196 | myDepthMax : Real from Standard; |
7fd59977 |
197 | |
198 | end Projector; |