~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to doc/manual_16.html

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-12-11 21:22:35 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20091211212235-5iio4nzpra64snab
Tags: 7.0.10-1
* New upstream.  Closes: #551192.
  - New build-depends: libcairo2-dev, liblua5.1-0-dev, gsfonts
  - patches/config.diff: Remove.  Upstream build system replaced.
  - Runtime lib package changed to libipe7.0.10 from libipe1c2a
  - Devel package renamed to libipe-dev (from libipe1-dev)
  - Package ipe depends on lua5.1 due to ipe-update-master.

* rules: Re-write to use dh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0" encoding="UTF-8"?>
2
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
 
   "DTD/xhtml1-transitional.dtd">
4
 
<html xmlns="http://www.w3.org/1999/xhtml">
5
 
<!-- XML file produced from file: manual.tex
6
 
     using Hyperlatex v 2.6 (c) Otfried Cheong
7
 
     on Emacs 21.4.1, Sun Dec 24 00:03:22 2006 -->
8
 
<head>
9
 
<title>Ipe Manual -- 5.1 Path objects</title>
10
 
 
11
 
<style type="text/css">
12
 
.maketitle { align : center }
13
 
div.abstract { margin-left: 20%; margin-right: 10%; }
14
 
h3.abstract  { align : center }
15
 
div.verse, div.quote, div.quotation {
16
 
  margin-left : 10%; 
17
 
  margin-right : 10%;
18
 
}
19
 
</style>
20
 
 
21
 
<meta http-equiv="Content-Type" 
22
 
        content="text/html; charset=UTF-8">
23
 
</head>
24
 
<body bgcolor="#ffffe6">
25
 
<table width="100%" cellpadding=0 cellspacing=2><tr><td bgcolor="#99ccff"><a href="manual_17.html"><img border="0" alt="5.2 Text objects" src="next.png"></a></td><td bgcolor="#99ccff"><a href="manual_15.html"><img border="0" alt="5 Object types" src="up.png"></a></td><td bgcolor="#99ccff"><img alt="" src="blank.png"></td><td align="center" bgcolor="#99ccff" width="100%"><b>5.1 Path objects</b></td></tr></table>
26
 
<h2>5.1 Path objects</h2>
27
 
 
28
 
 
29
 
Path objects are defined by a set of <em>subpaths</em>, that is, curves
30
 
in the plane.<sup><a href="manual_44.html#id4">4</a></sup>  Each subpath is
31
 
either open or closed, and consists of straight line segments,
32
 
circular or elliptic arc segments, parabola segments, and cubic
33
 
B-spline segments.  The curves are drawn with the stroke color, dash
34
 
style, and line width; the interior of the object specified is filled
35
 
using the fill color.
36
 
<p>The distinction between open and closed subpaths is meaningful for
37
 
stroking only, for filling any open subpath is implicitely closed.
38
 
Stroking a set of subpaths is identical to stroking them individually.
39
 
This is not true for filling: using several subpaths, one can
40
 
construct objects with holes, and more complicated pattern.  The
41
 
filling algorithm is the <em>even-odd rule</em> of Postscript/PDF: To
42
 
determine whether a point lies inside the filled shape, draw a ray
43
 
from that point in any direction, and count the number of path
44
 
segments that cross the ray.  If this number is odd, the point is
45
 
inside; if even, the point is outside.
46
 
<p>Ipe can draw arrows on the first and last segment of a path object,
47
 
but only if that segment is part of an open subpath.
48
 
<p>There are several Ipe modes that create path objects in different
49
 
ways.  All modes create an object consisting of a single subpath
50
 
only.  To make more complicated path objects, such as objects with
51
 
holes, you create each boundary component separately, then select them
52
 
all and use the <em>Compose paths</em> function in the <em>Edit</em> menu.
53
 
The reverse operation is <em>Decompose path</em>, you find it in the
54
 
object menu of a path object that has several subpaths.
55
 
<p>You can also create complicated paths by joining curves sequentially.
56
 
For this to work, the endpoint of one path must be (nearly) identical
57
 
to the begin point of the next--easy to achieve using snapping.  You
58
 
select the object you wish to join, and call <em>Join paths</em> in the
59
 
<em>Edit</em> menu.  You can also join several open path objects into a
60
 
single closed path this way.
61
 
<p><a name="id1">  
62
 
Circles</A> can be entered in three different ways.  To create an ellipse,
63
 
create a circle and stretch and rotate it.  Circular arcs can be
64
 
entered by clicking three points on the arc or by clicking the center
65
 
of the supporting circle as well as the begin and end vertex of the
66
 
arc. They can be filled in Postscript fashion, and can have
67
 
arrows. You can stretch a circular arc to create an elliptic arc.
68
 
<p>A common application for arcs is to mark angles in drawings. The snap
69
 
keys are useful to create such arcs: set arc creation to <em>center
70
 
&#38; 2 pts</em>, select <em>snap to vertex</em> and <em>snap to boundary</em>,
71
 
click first on the center point of the angle (which is magnetic) and
72
 
click then on the two bounding lines.
73
 
<p><a name="id2">
74
 
 
75
 
 
76
 
 
77
 
 
78
 
 
79
 
 
80
 
 
81
 
There</A> are two modes for creating more complex general path objects.
82
 
The difference between the <em>line</em> mode and the <em>polygon</em>
83
 
mode is that the first creates an open path, the latter generates a
84
 
closed one.  As a consequence, the <em>line</em> mode uses the current
85
 
arrow settings, while the <em>polygon</em> mode doesn't.  Also, objects
86
 
created in <em>line</em> mode will only have the stroke color set, even
87
 
if the current fill color is not void.  (However, if the current
88
 
stroke color is void and the fill color is not, it will be filled.)
89
 
<p>The path created consists of segments of various types.  The initial
90
 
setting is to create straight segments. By holding the shift-key when
91
 
pressing the left mouse button one can switch to uniform
92
 
B-splines. One can also add parabolic segments and circular arcs to
93
 
the path by pressing the "q" and "a" keys.
94
 
The mode for splines is identical to the polyline mode, but starts in
95
 
the uniform B-spline setting.
96
 
<p>For the mathematically inclined, a more precise description of the
97
 
segments that can appear on a subpath follows.  More details can be
98
 
found in Foley et al.<sup><a href="manual_44.html#id5">5</a></sup> and other text books on splines.
99
 
<p>A subpath consists of a sequence of segments.  Each segment is either
100
 
a straight line segment, an elliptic arc, a quadratic B&eacute;zier spline,
101
 
a cubic B&eacute;zier spline, or a uniform cubic B-spline. 
102
 
<p>The quadratic Bezi&eacute;r spline defined by control points <i>p<sub>0</sub></i>,
103
 
<i>p<sub>1</sub></i>, and <i>p<sub>2</sub></i>, is the curve
104
 
<blockquote><i>
105
 
P(t) = (1-t)<sup>2</sup> p<sub>0</sub> + 2t(1-t) p<sub>1</sub> + t<sup>2</sup> p<sub>2</sub>,
106
 
</i></blockquote>
107
 
where&nbsp;<i>t</i> ranges from <i>0</i> to <i>1</i>. This implies that it starts in
108
 
<i>p<sub>0</sub></i> tangent to the line <i>p<sub>0</sub>p<sub>1</sub></i>, ends in <i>p<sub>2</sub></i> tangent to
109
 
the line <i>p<sub>1</sub>p<sub>2</sub></i>, and is contained in the convex hull of the
110
 
three points.  Any segment of any parabola can be expressed as a
111
 
quadratic Bezi&eacute;r spline.
112
 
<p>For instance, the piece of the unit parabola <i>y = x<sup>2</sup></i> between <i>x=a</i>
113
 
and <i>x=b</i> can be created with the control points
114
 
<blockquote><table border><tbody><tr><td colspan="1" align="LEFT">
115
 
<i>
116
 
p<sub>0</sub> </td><td colspan="1" align="CENTER"> = </td><td colspan="1" align="LEFT"> (a, a<sup>2</sup>)</td></tr>
117
 
<tr><td colspan="1" align="LEFT">
118
 
p<sub>1</sub> </td><td colspan="1" align="CENTER"> = </td><td colspan="1" align="LEFT"> ( (a + b)/(2), ab) </td></tr>
119
 
<tr><td colspan="1" align="LEFT">
120
 
p<sub>2</sub> </td><td colspan="1" align="CENTER"> = </td><td colspan="1" align="LEFT"> (b, b<sup>2</sup>)
121
 
</i></td></tr></tbody></table>
122
 
</blockquote>
123
 
Any piece of any parabola can be created by applying some affine
124
 
transformation to these points.
125
 
<p>The cubic Bezi&eacute;r spline with control points <i>p<sub>0</sub></i>, <i>p<sub>1</sub></i>, and
126
 
<i>p<sub>2</sub></i> is the curve
127
 
<blockquote><i>
128
 
R(t) = (1-t)<sup>3</sup>p<sub>0</sub> + 3t(1-t)<sup>2</sup> p<sub>1</sub> + 
129
 
3 t<sup>2</sup>(1-t) p<sub>2</sub> + t<sup>3</sup> p<sub>3</sub>.
130
 
</i></blockquote>
131
 
It starts in <i>p<sub>0</sub></i> being tangent to the line <i>p<sub>0</sub>p<sub>1</sub></i>, ends in
132
 
<i>p<sub>3</sub></i> being tangent to the line <i>p<sub>2</sub>p<sub>3</sub></i>, and lies in the convex
133
 
hull of the four control points.
134
 
<p>Uniform cubic B-splines approximate a series of <i>m+1</i> control points
135
 
<i>p<sub>0</sub></i>, <i>p<sub>1</sub></i>, ..., <i>p<sub>m</sub></i>, <i>m  &gt;= 3</i>, with a curve consisting
136
 
of <i>m-2</i> cubic polynomial curve segments <i>s<sub>0</sub></i>, <i>s<sub>1</sub></i>, ...,
137
 
<i>s<sub>m-3</sub></i>. Every such curve segment is defined by four of the control
138
 
points. In fact, curve segment <i>s<sub>i</sub></i> is defined by the points
139
 
<i>p<sub>i</sub></i>, <i>p<sub>i+1</sub></i>, <i>p<sub>i+2</sub></i>, and <i>p<sub>i+3</sub></i>. If the curve is closed
140
 
(a <em>splinegon</em>), it contains three additional curve segments
141
 
<i>s<sub>m-2</sub></i>, <i>s<sub>m-1</sub></i>, and <i>s<sub>m</sub></i>, defined by appending <i>p<sub>0</sub></i>,
142
 
<i>p<sub>1</sub></i>, and <i>p<sub>2</sub></i> to the end of the sequence.  A uniform B-spline
143
 
segment on an open subpath of an Ipe path object is defined by
144
 
repeating both the first and last control point three times, so as to
145
 
make the segment begin and end in these points.
146
 
<p>The segment <i>s<sub>i</sub></i> is the cubic curve segment with the following
147
 
parametrization.
148
 
<blockquote><i>
149
 
Q(t) = ((1-t)<sup>3</sup>)/(6) p<sub>i</sub> + (3t<sup>3</sup> -6t<sup>2</sup> + 4)/(6) p<sub>i+1</sub>
150
 
+ (-3t<sup>3</sup> + 3t<sup>2</sup> + 3t +1)/(6) p<sub>i+2</sub> + (t<sup>3</sup>)/(6)
151
 
p<sub>i+3</sub>,
152
 
</i></blockquote>
153
 
where <i>t</i> ranges from <i>0</i> to <i>1</i>.
154
 
<p>Since the point <i>Q(t)</i> is a convex combination of the four control
155
 
points, the curve segment <i>s<sub>i</sub></i> lies in the convex hull of <i>p<sub>i</sub></i> to
156
 
<i>p<sub>i+3</sub></i>. Furthermore, it follows that any affine transformation can be
157
 
applied to the curve by applying it to the control points.
158
 
Note that a control point <i>p<sub>i</sub></i> has influence on only four curve
159
 
segments, <i>s<sub>i-3</sub></i>, <i>s<sub>i-2</sub></i>, <i>s<sub>i-1</sub></i>, and <i>s<sub>i</sub></i>. Thus, when you
160
 
edit a spline object and move a control point, only a short piece of the
161
 
spline in the neighborhood of the control point will move.
162
 
 
163
 
<hr />
164
 
<table width="100%" cellpadding=0 cellspacing=2><tr><td bgcolor="#99ccff"><a href="manual_17.html"><img border="0" alt="5.2 Text objects" src="next.png"></a></td><td bgcolor="#99ccff"><a href="manual_15.html"><img border="0" alt="5 Object types" src="up.png"></a></td><td bgcolor="#99ccff"><img alt="" src="blank.png"></td><td align="center" bgcolor="#99ccff" width="100%"><b>5.1 Path objects</b></td></tr></table></body></html>