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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
-- File: Hatcher.cdl
-- Created: Wed Aug 19 10:00:20 1992
-- Author: Modelistation
-- <model@phylox>
---Copyright: Matra Datavision 1992
class Hatcher from Hatch
---Purpose: The Hatcher is an algorithm to compute cross
-- hatchings in a 2d plane. It is mainly dedicated to
-- display purpose.
--
-- Computing cross hatchings is a 3 steps process :
--
-- 1. The users stores in the Hatcher a set of 2d
-- lines to be trimmed. Methods in the "Lines"
-- category.
--
-- 2. The user trims the lines with a boundary. The
-- inside of a boundary is on the left side. Methods
-- in the "Trimming" category.
--
-- 3. The user reads back the trimmed lines. Methods
-- in the "Results" category.
--
-- The result is a set of parameter intervals on the
-- line. The first parameter of an Interval may be
-- RealFirst() and the last may be RealLast().
--
-- A line can be a line parallel to the axis (X or Y
-- line or a 2D line.
--
-- The Hatcher has two modes :
--
-- * The "Oriented" mode, where the orientation of
-- the trimming curves is considered. The hatch are
-- kept on the left of the trimming curve. In this
-- mode infinite hatch can be computed.
--
-- * The "UnOriented" mode, where the hatch are
-- always finite.
--
---Overview: Lines, Trimming, Results
uses
Boolean from Standard,
Integer from Standard,
Real from Standard,
Lin2d from gp,
Pnt2d from gp,
Dir2d from gp,
LineForm from Hatch,
SequenceOfLine from Hatch
raises
OutOfRange from Standard
is
Create(Tol : Real from Standard;
Oriented : Boolean = Standard_True) returns Hatcher from Hatch;
---Purpose: Returns a empty hatcher. <Tol> is the tolerance
-- for intersections.
Tolerance(me : in out; Tol : Real from Standard)
---C++: inline
is static;
Tolerance(me) returns Real from Standard
---C++: inline
is static;
AddLine(me : in out; L : Lin2d from gp;
T : LineForm from Hatch = Hatch_ANYLINE)
---Purpose: Add a line <L> to be trimmed. <T> the type is
-- only kept from information. It is not used in the
-- computation.
--
---Category: Lines
is static;
AddLine(me : in out; D : Dir2d from gp; Dist : Real from Standard)
---Purpose: Add an infinite line on direction <D> at distance
-- <Dist> from the origin to be trimmed. <Dist> may
-- be negative.
--
-- If O is the origin of the 2D plane, and V the
-- vector perpendicular to D (in the direct direction).
--
-- A point P is on the line if :
-- OP dot V = Dist
-- The parameter of P on the line is
-- OP dot D
--
---Category: Lines
is static;
AddXLine(me : in out; X : Real from Standard)
---Purpose: Add an infinite line parallel to the Y-axis at
-- abciss <X>.
--
---Category: Lines
is static;
AddYLine(me : in out; Y : Real from Standard)
---Purpose: Add an infinite line parallel to the X-axis at
-- ordinate <Y>.
--
---Category: Lines
is static;
Trim(me : in out; L : Lin2d from gp;
Index : Integer from Standard = 0)
---Purpose: Trims the lines at intersections with <L>.
--
--Category: Trimming
is static;
Trim(me : in out; L : Lin2d from gp;
Start, End : Real from Standard;
Index : Integer from Standard = 0)
---Purpose: Trims the lines at intersections with <L> in the
-- parameter range <Start>, <End>
--
--Category: Trimming
is static;
Trim(me : in out; P1, P2 : Pnt2d from gp;
Index : Integer from Standard = 0)
---Purpose: Trims the line at intersection with the oriented
-- segment P1,P2.
--
--Category: Trimming
is static;
NbIntervals(me) returns Integer from Standard
---Purpose: Returns the total number of intervals on all the
-- lines.
---Category : Results
raises OutOfRange
is static;
NbLines(me) returns Integer from Standard
---Purpose: Returns the number of lines.
---Category : Results
is static;
Line(me; I : Integer from Standard) returns Lin2d from gp
---Purpose: Returns the line of index <I>.
---C++: return const &
---Category : Results
raises OutOfRange
is static;
LineForm(me; I : Integer from Standard) returns LineForm from Hatch
---Purpose: Returns the type of the line of index <I>.
---Category : Results
raises OutOfRange
is static;
IsXLine(me; I : Integer from Standard) returns Boolean from Standard
---Purpose: Returns True if the line of index <I> has a
-- constant X value.
---Category : Results
---C++: inline
raises OutOfRange
is static;
IsYLine(me; I : Integer from Standard) returns Boolean from Standard
---Purpose: Returns True if the line of index <I> has a
-- constant Y value.
---Category : Results
---C++: inline
raises OutOfRange
is static;
Coordinate(me; I : Integer from Standard) returns Real from Standard
---Purpose: Returns the X or Y coordinate of the line of index
-- <I> if it is a X or a Y line.
---Category : Results
raises OutOfRange
is static;
NbIntervals(me; I : Integer from Standard) returns Integer from Standard
---Purpose: Returns the number of intervals on line of index <I>.
---Category : Results
raises OutOfRange
is static;
Start(me; I,J : Integer from Standard) returns Real from Standard
---Purpose: Returns the first parameter of interval <J> on
-- line <I>.
---Category : Results
raises OutOfRange
is static;
StartIndex(me; I,J : Integer from Standard;
Index : out Integer from Standard;
Par2 : out Real from Standard)
---Purpose: Returns the first Index and Par2 of interval <J> on
-- line <I>.
---Category : Results
raises OutOfRange
is static;
End(me; I,J : Integer) returns Real from Standard
---Purpose: Returns the last parameter of interval <J> on
-- line <I>.
---Category : Results
raises OutOfRange
is static;
EndIndex(me; I,J : Integer from Standard;
Index : out Integer from Standard;
Par2 : out Real from Standard)
---Purpose: Returns the last Index and Par2 of interval <J> on
-- line <I>.
---Category : Results
raises OutOfRange
is static;
fields
myToler : Real;
myLines : SequenceOfLine from Hatch;
myOrient : Boolean;
end Hatcher;
|