File: qlinef.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (115 lines) | stat: -rw-r--r-- 15,785 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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QLineF Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QLineF Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QLineF class provides a two-dimensional vector using floating point precision. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qlinef.html#IntersectType-enum">IntersectType</a></b> { NoIntersection, BoundedIntersection, UnboundedIntersection }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlinef.html#QLineF">__init__</a></b> (<i>self</i>, QLine&#160;<i>line</i>)</li><li><div class="fn" /><b><a href="qlinef.html#QLineF-2">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlinef.html#QLineF-3">__init__</a></b> (<i>self</i>, QPointF&#160;<i>apt1</i>, QPointF&#160;<i>apt2</i>)</li><li><div class="fn" /><b><a href="qlinef.html#QLineF-4">__init__</a></b> (<i>self</i>, float&#160;<i>x1pos</i>, float&#160;<i>y1pos</i>, float&#160;<i>x2pos</i>, float&#160;<i>y2pos</i>)</li><li><div class="fn" /><b><a href="qlinef.html#QLineF-5">__init__</a></b> (<i>self</i>, QLineF)</li><li><div class="fn" />float <b><a href="qlinef.html#angle">angle</a></b> (<i>self</i>, QLineF&#160;<i>l</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#dx">dx</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#dy">dy</a></b> (<i>self</i>)</li><li><div class="fn" />IntersectType <b><a href="qlinef.html#intersect">intersect</a></b> (<i>self</i>, QLineF&#160;<i>l</i>, QPointF&#160;<i>intersectionPoint</i>)</li><li><div class="fn" />bool <b><a href="qlinef.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#length">length</a></b> (<i>self</i>)</li><li><div class="fn" />QLineF <b><a href="qlinef.html#normalVector">normalVector</a></b> (<i>self</i>)</li><li><div class="fn" />QPointF <b><a href="qlinef.html#p1">p1</a></b> (<i>self</i>)</li><li><div class="fn" />QPointF <b><a href="qlinef.html#p2">p2</a></b> (<i>self</i>)</li><li><div class="fn" />QPointF <b><a href="qlinef.html#pointAt">pointAt</a></b> (<i>self</i>, float&#160;<i>t</i>)</li><li><div class="fn" /><b><a href="qlinef.html#setLength">setLength</a></b> (<i>self</i>, float&#160;<i>len</i>)</li><li><div class="fn" />QLine <b><a href="qlinef.html#toLine">toLine</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlinef.html#translate">translate</a></b> (<i>self</i>, QPointF&#160;<i>point</i>)</li><li><div class="fn" /><b><a href="qlinef.html#translate-2">translate</a></b> (<i>self</i>, float&#160;<i>adx</i>, float&#160;<i>ady</i>)</li><li><div class="fn" />QLineF <b><a href="qlinef.html#unitVector">unitVector</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#x1">x1</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#x2">x2</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#y1">y1</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qlinef.html#y2">y2</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QLineF <b><a href="qtgui.html#__mul__-3">__mul__</a></b> (<i>self</i>, QMatrix&#160;<i>m</i>)</li><li><div class="fn" />bool <b><a href="qlinef.html#__eq__">__eq__</a></b> (<i>self</i>, QLineF&#160;<i>d</i>)</li><li><div class="fn" />bool <b><a href="qlinef.html#__ne__">__ne__</a></b> (<i>self</i>, QLineF&#160;<i>d</i>)</li><li><div class="fn" />int <b><a href="qlinef.html#__nonzero__">__nonzero__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QLineF class provides a two-dimensional vector using floating point precision.</p>
<p>A QLineF describes a finite length line (or line segment) on a two-dimensional surface. QLineF defines the start and end points of the line using floating point accuracy for coordinates. Use the <a href="qlinef.html#toLine">toLine</a>() function to retrieve an integer based copy of this line.</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#F0F0F0" valign="top">
<td><img src="images/qline-point.png" /></td>
<td><img src="images/qline-coordinates.png" /></td>
</tr>
</table>
<br />
<br />
<p>The positions of the line's start and end points can be retrieved using the <a href="qlinef.html#p1">p1</a>(), <a href="qlinef.html#x1">x1</a>(), <a href="qlinef.html#y1">y1</a>(), <a href="qlinef.html#p2">p2</a>(), <a href="qlinef.html#x2">x2</a>(), and <a href="qlinef.html#y2">y2</a>() functions. The <a href="qlinef.html#dx">dx</a>() and <a href="qlinef.html#dy">dy</a>() functions return the horizontal and vertical components of the line, respectively.</p>
<p>The line's length can be retrieved using the <a href="qlinef.html#length">length</a>() function, and altered using the <a href="qlinef.html#setLength">setLength</a>() function. Use the <a href="qlinef.html#isNull">isNull</a>() function to determine whether the QLineF represents a valid line or a null line.</p>
<p>The <a href="qlinef.html#intersect">intersect</a>() function determines the <a href="qlinef.html#IntersectType-enum">IntersectType</a> for this line and a given line, while the <a href="qlinef.html#angle">angle</a>() function returns the angle between the lines. In addition, the <a href="qlinef.html#unitVector">unitVector</a>() function returns a line that has the same starting point as this line, but with a length of only 1, while the <a href="qlinef.html#normalVector">normalVector</a>() function returns a line that is perpendicular to this line with the same starting point and length.</p>
<p>Finally, the line can be translated a given offset using the <a href="qlinef.html#translate">translate</a>() function, and can be traversed using the <a href="qlinef.html#pointAt">pointAt</a>() function.</p>
<p>See also <a href="qline.html">QLine</a>, <a href="qpolygonf.html">QPolygonF</a>, and <a href="qrectf.html">QRectF</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="IntersectType-enum" />QLineF.IntersectType</h3><p>Describes the intersection between two lines.</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#F0F0F0" valign="top">
<td><img src="images/qlinef-unbounded.png" /></td>
<td><img src="images/qlinef-bounded.png" /></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>QLineF.UnboundedIntersection</td>
<td>QLineF.BoundedIntersection</td>
</tr>
</table>
<br />
<br />
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QLineF.NoIntersection</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">Indicates that the lines do not intersect; i.e. they are parallel.</td>
</tr>
<tr>
<td valign="top"><tt>QLineF.UnboundedIntersection</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
<td valign="top">The two lines intersect, but not within the range defined by their lengths. This will be the case if the lines are not parallel.</td>
</tr>
<tr>
<td valign="top"><tt>QLineF.BoundedIntersection</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">The two lines intersect with each other within the start and end points of each line.</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qlinef.html#intersect">intersect</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLineF" />QLineF.__init__ (<i>self</i>, <a href="qline.html">QLine</a>&#160;<i>line</i>)</h3><p>Constructs a null line.</p>
<h3 class="fn"><a name="QLineF-2" />QLineF.__init__ (<i>self</i>)</h3><p>Constructs a line object that represents the line between <i>p1</i> and <i>p2</i>.</p>
<h3 class="fn"><a name="QLineF-3" />QLineF.__init__ (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>apt1</i>, <a href="qpointf.html">QPointF</a>&#160;<i>apt2</i>)</h3><p>Constructs a line object that represents the line between (<i>x1</i>, <i>y1</i>) and (<i>x2</i>, <i>y2</i>).</p>
<h3 class="fn"><a name="QLineF-4" />QLineF.__init__ (<i>self</i>, float&#160;<i>x1pos</i>, float&#160;<i>y1pos</i>, float&#160;<i>x2pos</i>, float&#160;<i>y2pos</i>)</h3><p>Construct a <a href="qlinef.html">QLineF</a> object from the given integer-based <i>line</i>.</p>
<p>See also <a href="qlinef.html#toLine">toLine</a>().</p>
<h3 class="fn"><a name="QLineF-5" />QLineF.__init__ (<i>self</i>, <a href="qlinef.html">QLineF</a>)</h3><h3 class="fn"><a name="angle" />float QLineF.angle (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>l</i>)</h3><p>Returns the angle (in degrees) between this line and the given <i>line</i>, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origo (see <a href="qlinef.html#IntersectType-enum">QLineF.UnboundedIntersection</a>).</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#F0F0F0" valign="top">
<td><img src="images/qlinef-angle-identicaldirection.png" /></td>
<td><img src="images/qlinef-angle-oppositedirection.png" /></td>
</tr>
</table>
<br />
<br />
<p>When the lines are parallel, this function returns 0 if they have the same direction; otherwise it returns 180.</p>
<p>See also <a href="qlinef.html#intersect">intersect</a>().</p>
<h3 class="fn"><a name="dx" />float QLineF.dx (<i>self</i>)</h3><p>Returns the horizontal component of the line's vector.</p>
<p>See also <a href="qlinef.html#dy">dy</a>() and <a href="qlinef.html#pointAt">pointAt</a>().</p>
<h3 class="fn"><a name="dy" />float QLineF.dy (<i>self</i>)</h3><p>Returns the vertical component of the line's vector.</p>
<p>See also <a href="qlinef.html#dx">dx</a>() and <a href="qlinef.html#pointAt">pointAt</a>().</p>
<h3 class="fn"><a name="intersect" /><a href="qlinef.html#IntersectType-enum">IntersectType</a> QLineF.intersect (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>l</i>, <a href="qpointf.html">QPointF</a>&#160;<i>intersectionPoint</i>)</h3><p>Returns a value indicating whether or not <i>this</i> line intersects with the given <i>line</i>.</p>
<p>The actual intersection point is extracted to <i>intersectionPoint</i> (if the pointer is valid). If the lines are parallel, the intersection point is undefined.</p>
<h3 class="fn"><a name="isNull" />bool QLineF.isNull (<i>self</i>)</h3><p>Returns true if the line is not set up with valid start and end point; otherwise returns false.</p>
<h3 class="fn"><a name="length" />float QLineF.length (<i>self</i>)</h3><p>Returns the length of the line.</p>
<p>See also <a href="qlinef.html#setLength">setLength</a>().</p>
<h3 class="fn"><a name="normalVector" /><a href="qlinef.html">QLineF</a> QLineF.normalVector (<i>self</i>)</h3><p>Returns a line that is perpendicular to this line with the same starting point and length.</p>
<p align="center"><img src="images/qlinef-normalvector.png" /></p>
<p>See also <a href="qlinef.html#unitVector">unitVector</a>().</p>
<h3 class="fn"><a name="p1" /><a href="qpointf.html">QPointF</a> QLineF.p1 (<i>self</i>)</h3><p>Returns the line's start point.</p>
<p>See also <a href="qlinef.html#x1">x1</a>(), <a href="qlinef.html#y1">y1</a>(), and <a href="qlinef.html#p2">p2</a>().</p>
<h3 class="fn"><a name="p2" /><a href="qpointf.html">QPointF</a> QLineF.p2 (<i>self</i>)</h3><p>Returns the line's end point.</p>
<p>See also <a href="qlinef.html#x2">x2</a>(), <a href="qlinef.html#y2">y2</a>(), and <a href="qlinef.html#p1">p1</a>().</p>
<h3 class="fn"><a name="pointAt" /><a href="qpointf.html">QPointF</a> QLineF.pointAt (<i>self</i>, float&#160;<i>t</i>)</h3><p>Returns the point at the parameterized position specified by <i>t</i>. The function returns the line's start point if t = 0, and its end point if t = 1.</p>
<p>See also <a href="qlinef.html#dx">dx</a>() and <a href="qlinef.html#dy">dy</a>().</p>
<h3 class="fn"><a name="setLength" />QLineF.setLength (<i>self</i>, float&#160;<i>len</i>)</h3><p>Sets the length of the line to the given <i>length</i>.</p>
<p>See also <a href="qlinef.html#length">length</a>().</p>
<h3 class="fn"><a name="toLine" /><a href="qline.html">QLine</a> QLineF.toLine (<i>self</i>)</h3><p>Returns an integer based copy of this line.</p>
<p>Note that the returned line's start and end points are rounded to the nearest integer.</p>
<p>See also <a href="qlinef.html#QLineF">QLineF</a>().</p>
<h3 class="fn"><a name="translate" />QLineF.translate (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>)</h3><p>Translates this line by the given <i>offset</i>.</p>
<h3 class="fn"><a name="translate-2" />QLineF.translate (<i>self</i>, float&#160;<i>adx</i>, float&#160;<i>ady</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Translates this line the distance specified by <i>dx</i> and <i>dy</i>.</p>
<h3 class="fn"><a name="unitVector" /><a href="qlinef.html">QLineF</a> QLineF.unitVector (<i>self</i>)</h3><p>Returns the unit vector for this line, i.e a line starting at the same point as <i>this</i> line with a length of 1.0.</p>
<p>See also <a href="qlinef.html#normalVector">normalVector</a>().</p>
<h3 class="fn"><a name="x1" />float QLineF.x1 (<i>self</i>)</h3><p>Returns the x-coordinate of the line's start point.</p>
<p>See also <a href="qlinef.html#p1">p1</a>().</p>
<h3 class="fn"><a name="x2" />float QLineF.x2 (<i>self</i>)</h3><p>Returns the x-coordinate of the line's end point.</p>
<p>See also <a href="qlinef.html#p2">p2</a>().</p>
<h3 class="fn"><a name="y1" />float QLineF.y1 (<i>self</i>)</h3><p>Returns the y-coordinate of the line's start point.</p>
<p>See also <a href="qlinef.html#p1">p1</a>().</p>
<h3 class="fn"><a name="y2" />float QLineF.y2 (<i>self</i>)</h3><p>Returns the y-coordinate of the line's end point.</p>
<p>See also <a href="qlinef.html#p2">p2</a>().</p>
<h3 class="fn"><a name="__mul__-3" /><a href="qlinef.html">QLineF</a> __mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>m</i>)</h3><p>This method is only available if the QtGui module is imported.</p><h3 class="fn"><a name="__eq__" />bool QLineF.__eq__ (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>d</i>)</h3><h3 class="fn"><a name="__ne__" />bool QLineF.__ne__ (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>d</i>)</h3><h3 class="fn"><a name="__nonzero__" />int QLineF.__nonzero__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>