File: class_ipe_path_segment.html

package info (click to toggle)
ipe 6.0pre27-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,128 kB
  • ctags: 5,328
  • sloc: cpp: 29,689; ansic: 1,045; xml: 821; makefile: 65
file content (472 lines) | stat: -rw-r--r-- 19,002 bytes parent folder | download
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Ipelib: IpePathSegment Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a></div>
<h1>IpePathSegment Class Reference<br>
<small>
[<a class="el" href="group__obj.html">Ipe Objects</a>]</small>
</h1><!-- doxytag: class="IpePathSegment" -->A segment on an <a class="el" href="class_ipe_sub_path.html">IpeSubPath</a>.  
<a href="#_details">More...</a>
<p>
<a href="class_ipe_path_segment-members.html">List of all members.</a><h2>Public Types</h2>
<ul>
<li>enum <b>TType</b> { <br>
&nbsp;&nbsp;<b>EArc</b>, 
<b>ESegment</b>, 
<b>EQuad</b>, 
<b>EBezier</b>, 
<br>
&nbsp;&nbsp;<b>ESpline</b>
<br>
 }
</ul>
<h2>Public Member Functions</h2>
<ul>
<li>TType <a class="el" href="class_ipe_path_segment.html#a0">Type</a> () const 
<li>int <a class="el" href="class_ipe_path_segment.html#a1">NumCP</a> () const 
<li><a class="el" href="class_ipe_vector.html">IpeVector</a> <a class="el" href="class_ipe_path_segment.html#a2">CP</a> (int i) const 
<li><a class="el" href="class_ipe_vector.html">IpeVector</a> <a class="el" href="class_ipe_path_segment.html#a3">Last</a> () const 
<li><a class="el" href="class_ipe_matrix.html">IpeMatrix</a> <a class="el" href="class_ipe_path_segment.html#a4">Matrix</a> () const 
<li><a class="el" href="class_ipe_bezier.html">IpeBezier</a> <a class="el" href="class_ipe_path_segment.html#a5">Bezier</a> () const 
<li><a class="el" href="class_ipe_arc.html">IpeArc</a> <a class="el" href="class_ipe_path_segment.html#a6">Arc</a> () const 
<li>void <a class="el" href="class_ipe_path_segment.html#a7">Beziers</a> (std::vector&lt; <a class="el" href="class_ipe_bezier.html">IpeBezier</a> &gt; &amp;bez) const 
<li>void <a class="el" href="class_ipe_path_segment.html#a8">Draw</a> (<a class="el" href="class_ipe_painter.html">IpePainter</a> &amp;painter) const 
<li>void <a class="el" href="class_ipe_path_segment.html#a9">AddToBBox</a> (<a class="el" href="class_ipe_rect.html">IpeRect</a> &amp;box, const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;m) const 
<li>double <a class="el" href="class_ipe_path_segment.html#a10">Distance</a> (const <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;v, const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;m, double bound) const 
<li>void <a class="el" href="class_ipe_path_segment.html#a11">SnapVtx</a> (const <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;mouse, const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;m, <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;pos, double &amp;bound) const 
<li><a class="anchor" name="a12"></a><!-- doxytag: member="IpePathSegment::SnapBnd" ref="a12" args="(const IpeVector &amp;mouse, const IpeMatrix &amp;m, IpeVector &amp;pos, double &amp;bound) const " -->
void <b>SnapBnd</b> (const <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;mouse, const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;m, <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;pos, double &amp;bound) const 
</ul>
<h2>Friends</h2>
<ul>
<li><a class="anchor" name="n0"></a><!-- doxytag: member="IpePathSegment::IpeSegmentSubPath" ref="n0" args="" -->
class <a class="el" href="class_ipe_path_segment.html#n0">IpeSegmentSubPath</a>
</ul>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A segment on an <a class="el" href="class_ipe_sub_path.html">IpeSubPath</a>. 
<p>
A segment is either an elliptic arc, a straight segment, a quadratic Bezier spline, a cubic Bezier spline, or a B-spline curve, depending on its <a class="el" href="class_ipe_path_segment.html#a0">Type()</a>. This is a lightweight object, created on the fly by <a class="el" href="class_ipe_segment_sub_path.html#a14">IpeSegmentSubPath::Segment()</a>. There is no public constructor, so the only way to create such an object is through that method.<p>
The <a class="el" href="class_ipe_path_segment.html#a0">Type()</a> is one of the following:<p>
<ul>
<li><code>ESegment:</code> the segment has two control points, and represents a line segment.</li></ul>
<p>
<ul>
<li><code>EQuad:</code> a quadratic Bezier spline with three control points.</li></ul>
<p>
<ul>
<li><code>EBezier:</code> a cubic Bezier spline with four control points.</li></ul>
<p>
<ul>
<li><code>ESpline:</code> a B-spline curve with n control points. The first and last control point's knot value is repeated three times, so the curve begins and ends in these points.</li></ul>
<p>
<ul>
<li><code>EArc:</code> an elliptic arc, with begin and end point. The supporting ellipse is defined by the <a class="el" href="class_ipe_path_segment.html#a4">Matrix()</a>, it is the image under the affine transformation <a class="el" href="class_ipe_path_segment.html#a4">Matrix()</a> of the unit circle. <a class="el" href="class_ipe_path_segment.html#a4">Matrix()</a> is such that its inverse transforms both start and end position to points (nearly) on the unit circle. The arc is the image of the positively (counter-clockwise) directed arc from the pre-image of the start position to the pre-image of the end position. Whether this is a positively or negatively oriented arc in user space depends on the matrix.</li></ul>

<p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a0"></a><!-- doxytag: member="IpePathSegment::Type" ref="a0" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">TType IpePathSegment::Type           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Type of segment. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a1"></a><!-- doxytag: member="IpePathSegment::NumCP" ref="a1" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">int IpePathSegment::NumCP           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Number of control points. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a2"></a><!-- doxytag: member="IpePathSegment::CP" ref="a2" args="(int i) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_vector.html">IpeVector</a> IpePathSegment::CP           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>i</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return control point. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a3"></a><!-- doxytag: member="IpePathSegment::Last" ref="a3" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_vector.html">IpeVector</a> IpePathSegment::Last           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return last control point. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a4"></a><!-- doxytag: member="IpePathSegment::Matrix" ref="a4" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_matrix.html">IpeMatrix</a> IpePathSegment::Matrix           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Matrix (if <a class="el" href="class_ipe_path_segment.html#a0">Type()</a> == EArc). 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a5"></a><!-- doxytag: member="IpePathSegment::Bezier" ref="a5" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_bezier.html">IpeBezier</a> IpePathSegment::Bezier           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return segment as <a class="el" href="class_ipe_bezier.html">IpeBezier</a>. 
<p>
Panics if segment is not a quadratic or cubic Bezier spline.     </td>
  </tr>
</table>
<a class="anchor" name="a6"></a><!-- doxytag: member="IpePathSegment::Arc" ref="a6" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_arc.html">IpeArc</a> IpePathSegment::Arc           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return segment as <a class="el" href="class_ipe_arc.html">IpeArc</a>. 
<p>
Panics if segment is not an arc.     </td>
  </tr>
</table>
<a class="anchor" name="a7"></a><!-- doxytag: member="IpePathSegment::Beziers" ref="a7" args="(std::vector&lt; IpeBezier &gt; &amp;bez) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void IpePathSegment::Beziers           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::vector&lt; <a class="el" href="class_ipe_bezier.html">IpeBezier</a> &gt; &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>bez</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert B-spline to a sequence of Bezier splines. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a8"></a><!-- doxytag: member="IpePathSegment::Draw" ref="a8" args="(IpePainter &amp;painter) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void IpePathSegment::Draw           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_painter.html">IpePainter</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>painter</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Draw the segment. 
<p>
Current position of the <em>painter</em> is already on first control point.     </td>
  </tr>
</table>
<a class="anchor" name="a9"></a><!-- doxytag: member="IpePathSegment::AddToBBox" ref="a9" args="(IpeRect &amp;box, const IpeMatrix &amp;m) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void IpePathSegment::AddToBBox           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="class_ipe_rect.html">IpeRect</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>box</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>m</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Add segment to bounding box. 
<p>
Does not assume that first control point has already been added. Centers of arcs are included in the bbox, to make sure snapping finds them.     </td>
  </tr>
</table>
<a class="anchor" name="a10"></a><!-- doxytag: member="IpePathSegment::Distance" ref="a10" args="(const IpeVector &amp;v, const IpeMatrix &amp;m, double bound) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">double IpePathSegment::Distance           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>v</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>m</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>double&nbsp;</td>
          <td class="mdname" nowrap> <em>bound</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return distance to the segment. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="a11"></a><!-- doxytag: member="IpePathSegment::SnapVtx" ref="a11" args="(const IpeVector &amp;mouse, const IpeMatrix &amp;m, IpeVector &amp;pos, double &amp;bound) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void IpePathSegment::SnapVtx           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>mouse</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>const <a class="el" href="class_ipe_matrix.html">IpeMatrix</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>m</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap><a class="el" href="class_ipe_vector.html">IpeVector</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>pos</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>double &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>bound</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Snap to vertex of the segment. 
<p>
The method assumes that the first control point has already been tested.     </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li>ipepath.h<li>ipepath.cpp</ul>
<hr>
</body></html>