60 |
jpm |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<title>Documentation</title>
|
|
|
4 |
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
|
|
5 |
<link rel='stylesheet' href='style.css' />
|
|
|
6 |
</head>
|
|
|
7 |
|
|
|
8 |
<body>
|
|
|
9 |
<div align='center'>
|
|
|
10 |
<table cellpadding='0' cellspacing='0' id='contenu' class='round' style='width: 80%; margin-bottom: 20px'>
|
|
|
11 |
<tr>
|
|
|
12 |
<td class='borderhg'> </td>
|
|
|
13 |
<td class='borderh'> </td>
|
|
|
14 |
<td class='cornerhd'></td>
|
|
|
15 |
</tr>
|
|
|
16 |
<tr>
|
|
|
17 |
<td class='borderg'> </td>
|
|
|
18 |
<td><a id="top"></a><h2> Class Line</h2><div class="extends"><ul>
|
|
|
19 |
<li><a href="Shape.html">Shape</a></li>
|
|
|
20 |
<ul><li>Line</li></ul>
|
|
|
21 |
</ul></div><div class="description">
|
|
|
22 |
<p>
|
|
|
23 |
La classe <a href="Line.html">Line</a> permet de manipuler des lignes de manière uniforme sur Artichow. Une ligne est composée de deux Point.
|
|
|
24 |
</p>
|
|
|
25 |
</div><div class="inherit">
|
|
|
26 |
Les classes suivantes dérivent de Line :
|
|
|
27 |
<ul><li><a href="Vector.html">Vector</a></li></ul>
|
|
|
28 |
</div><ul class="links"><li><a href="index.html">Retourner voir la liste de toutes les classes</a></li></ul><h2>Méthodes et propriétés</h2><ul class="properties">
|
|
|
29 |
<li>
|
|
|
30 |
<span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p1"><span class="argument">$p1</span></a>
|
|
|
31 |
</li>
|
|
|
32 |
<li>
|
|
|
33 |
<span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p2"><span class="argument">$p2</span></a>
|
|
|
34 |
</li>
|
|
|
35 |
<li>
|
|
|
36 |
<span class="access">private</span> <span class="type">float</span> <a href="Line.html#property.slope"><span class="argument">$slope</span></a>
|
|
|
37 |
</li>
|
|
|
38 |
<li>
|
|
|
39 |
<span class="access">private</span> <span class="type">float</span> <a href="Line.html#property.origin"><span class="argument">$origin</span></a>
|
|
|
40 |
</li>
|
|
|
41 |
</ul><ul class="methods">
|
|
|
42 |
<li>
|
|
|
43 |
<span class="access">public</span> <a href="Line.html#method.__construct">__construct</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>, <span class="type">int</span> <span class="argument">$style</span> := <span class="default">Line::SOLID</span>, <span class="type">int</span> <span class="argument">$thickness</span> := <span class="default">1</span>)
|
|
|
44 |
</li>
|
|
|
45 |
<li>
|
|
|
46 |
<span class="access">public static</span> <a href="Line.html#method.build">build</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$x2</span>, <span class="type">int</span> <span class="argument">$y2</span>)
|
|
|
47 |
</li>
|
|
|
48 |
<li>
|
|
|
49 |
<span class="access">public</span> <a href="Line.html#method.setX">setX</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$x2</span>)
|
|
|
50 |
</li>
|
|
|
51 |
<li>
|
|
|
52 |
<span class="access">public</span> <a href="Line.html#method.setY">setY</a>(<span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$y2</span>)
|
|
|
53 |
</li>
|
|
|
54 |
<li>
|
|
|
55 |
<span class="access">public</span> <a href="Line.html#method.setLocation">setLocation</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>)
|
|
|
56 |
</li>
|
|
|
57 |
<li>
|
|
|
58 |
<span class="access">public</span> <span class="type">array</span> <a href="Line.html#method.getLocation">getLocation</a>()
|
|
|
59 |
</li>
|
|
|
60 |
<li>
|
|
|
61 |
<span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getSize">getSize</a>()
|
|
|
62 |
</li>
|
|
|
63 |
<li>
|
|
|
64 |
<span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getSlope">getSlope</a>()
|
|
|
65 |
</li>
|
|
|
66 |
<li>
|
|
|
67 |
<span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getOrigin">getOrigin</a>()
|
|
|
68 |
</li>
|
|
|
69 |
<li>
|
|
|
70 |
<span class="access">public</span> <span class="type">array</span> <a href="Line.html#method.getEquation">getEquation</a>()
|
|
|
71 |
</li>
|
|
|
72 |
<li>
|
|
|
73 |
<span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getXFrom">getXFrom</a>(<span class="type">float</span> <span class="argument">$y</span>)
|
|
|
74 |
</li>
|
|
|
75 |
<li>
|
|
|
76 |
<span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getYFrom">getYFrom</a>(<span class="type">float</span> <span class="argument">$x</span>)
|
|
|
77 |
</li>
|
|
|
78 |
<li>
|
|
|
79 |
<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isPoint">isPoint</a>()
|
|
|
80 |
</li>
|
|
|
81 |
<li>
|
|
|
82 |
<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isHorizontal">isHorizontal</a>()
|
|
|
83 |
</li>
|
|
|
84 |
<li>
|
|
|
85 |
<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isVertical">isVertical</a>()
|
|
|
86 |
</li>
|
|
|
87 |
<li>
|
|
|
88 |
<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isTopToBottom">isTopToBottom</a>(<a href="Polygon.html"><span class="type">Polygon</span></a> <span class="argument">$polygon</span>)
|
|
|
89 |
</li>
|
|
|
90 |
<li>
|
|
|
91 |
<span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isLeftToRight">isLeftToRight</a>(<a href="Polygon.html"><span class="type">Polygon</span></a> <span class="argument">$polygon</span>)
|
|
|
92 |
</li>
|
|
|
93 |
</ul><h2>Documentation</h2><ul class="doc">
|
|
|
94 |
<li class="property">
|
|
|
95 |
<a id="property.p1"></a><span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p1"><span class="argument">$p1</span></a><div class="description">
|
|
|
96 |
Le premier point de la ligne.
|
|
|
97 |
</div>
|
|
|
98 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
99 |
</li>
|
|
|
100 |
<li class="property">
|
|
|
101 |
<a id="property.p2"></a><span class="access">protected</span> <a href="Point.html"><span class="type">Point</span></a> <a href="Line.html#property.p2"><span class="argument">$p2</span></a><div class="description">
|
|
|
102 |
Le second point de la ligne.
|
|
|
103 |
</div>
|
|
|
104 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
105 |
</li>
|
|
|
106 |
<li class="property">
|
|
|
107 |
<a id="property.slope"></a><span class="access">private</span> <span class="type">float</span> <a href="Line.html#property.slope"><span class="argument">$slope</span></a><div class="description">
|
|
|
108 |
La pente (ou coefficient directeur) de la droite.
|
|
|
109 |
</div>
|
|
|
110 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
111 |
</li>
|
|
|
112 |
<li class="property">
|
|
|
113 |
<a id="property.origin"></a><span class="access">private</span> <span class="type">float</span> <a href="Line.html#property.origin"><span class="argument">$origin</span></a><div class="description">
|
|
|
114 |
La valeur de l'ordonnée à l'origine de la droite.
|
|
|
115 |
</div>
|
|
|
116 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
117 |
</li>
|
|
|
118 |
<li class="method">
|
|
|
119 |
<a id="method.__construct"></a><span class="access">public</span> <a href="Line.html#method.__construct">__construct</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>, <span class="type">int</span> <span class="argument">$style</span> := <span class="default">Line::SOLID</span>, <span class="type">int</span> <span class="argument">$thickness</span> := <span class="default">1</span>)
|
|
|
120 |
<div class="description">
|
|
|
121 |
Déclare une nouvelle ligne des points $p1 à $p2. La ligne est de style $style (<a href="Line.html#constant.SOLID">Line::SOLID</a> pour une ligne continue, <a href="Line.html#constant.DOTTED">Line::DOTTED</a> pour une ligne pointillée ou encore <a href="Line.html#constant.DASHED">Line::DASHED</a>) et d'épaisseur $thickness.
|
|
|
122 |
</div>
|
|
|
123 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
124 |
</li>
|
|
|
125 |
<li class="method">
|
|
|
126 |
<a id="method.build"></a><span class="access">public static</span> <a href="Line.html#method.build">build</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$x2</span>, <span class="type">int</span> <span class="argument">$y2</span>)
|
|
|
127 |
<div class="description">
|
|
|
128 |
Construit une ligne à partir des coordonnées ($x1, $y1) et ($x2, $y2)
|
|
|
129 |
</div>
|
|
|
130 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
131 |
</li>
|
|
|
132 |
<li class="method">
|
|
|
133 |
<a id="method.setX"></a><span class="access">public</span> <a href="Line.html#method.setX">setX</a>(<span class="type">int</span> <span class="argument">$x1</span>, <span class="type">int</span> <span class="argument">$x2</span>)
|
|
|
134 |
<div class="description">
|
|
|
135 |
Change les coordonnées X des deux points de la ligne pour $x1 et $x2.
|
|
|
136 |
</div>
|
|
|
137 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
138 |
</li>
|
|
|
139 |
<li class="method">
|
|
|
140 |
<a id="method.setY"></a><span class="access">public</span> <a href="Line.html#method.setY">setY</a>(<span class="type">int</span> <span class="argument">$y1</span>, <span class="type">int</span> <span class="argument">$y2</span>)
|
|
|
141 |
<div class="description">
|
|
|
142 |
Change les coordonnées Y des deux points de la ligne pour $y1 et $y2.
|
|
|
143 |
</div>
|
|
|
144 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
145 |
</li>
|
|
|
146 |
<li class="method">
|
|
|
147 |
<a id="method.setLocation"></a><span class="access">public</span> <a href="Line.html#method.setLocation">setLocation</a>(<a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p1</span>, <a href="Point.html"><span class="type">Point</span></a> <span class="argument">$p2</span>)
|
|
|
148 |
<div class="description">
|
|
|
149 |
Change l'emplacement de la ligne pour les points $p1 et $p2 passés en paramètre.
|
|
|
150 |
</div>
|
|
|
151 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
152 |
</li>
|
|
|
153 |
<li class="method">
|
|
|
154 |
<a id="method.getLocation"></a><span class="access">public</span> <span class="type">array</span> <a href="Line.html#method.getLocation">getLocation</a>()
|
|
|
155 |
<div class="description">
|
|
|
156 |
Retourne la position de la ligne dans un tableau à deux valeurs.
|
|
|
157 |
<pre>
|
|
|
158 |
|
|
|
159 |
<?php
|
|
|
160 |
$line = new Line(new Point(1, 2), new Point(3, 4));
|
|
|
161 |
list($p1, $p2) = $line->getLocation();
|
|
|
162 |
// $p1 == new Point(1, 2)
|
|
|
163 |
// $p2 == new Point(3, 4)
|
|
|
164 |
?>
|
|
|
165 |
|
|
|
166 |
</pre>
|
|
|
167 |
</div>
|
|
|
168 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
169 |
</li>
|
|
|
170 |
<li class="method">
|
|
|
171 |
<a id="method.getSize"></a><span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getSize">getSize</a>()
|
|
|
172 |
<div class="description">
|
|
|
173 |
Retourne la taille de la ligne en pixels.
|
|
|
174 |
</div>
|
|
|
175 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
176 |
</li>
|
|
|
177 |
<li class="method">
|
|
|
178 |
<a id="method.getSlope"></a><span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getSlope">getSlope</a>()
|
|
|
179 |
<ul class="version"><li>
|
|
|
180 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
181 |
<div class="description">
|
|
|
182 |
Renvoie la valeur de la pente de la ligne.
|
|
|
183 |
Si celle-ci est verticale, la pente vaudra NULL; si elle est horizontale, la pente vaudra 0.
|
|
|
184 |
La valeur est calculée uniquement lorsqu'elle est demandée.
|
|
|
185 |
</div>
|
|
|
186 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
187 |
</li>
|
|
|
188 |
<li class="method">
|
|
|
189 |
<a id="method.getOrigin"></a><span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getOrigin">getOrigin</a>()
|
|
|
190 |
<ul class="version"><li>
|
|
|
191 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
192 |
<div class="description">
|
|
|
193 |
Renvoie la valeur de l'ordonnée à l'origine.
|
|
|
194 |
Si la ligne est verticale, l'ordonnée à l'origine vaudra NULL.
|
|
|
195 |
La valeur est calculée uniquement lorsqu'elle est demandée.
|
|
|
196 |
</div>
|
|
|
197 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
198 |
</li>
|
|
|
199 |
<li class="method">
|
|
|
200 |
<a id="method.getEquation"></a><span class="access">public</span> <span class="type">array</span> <a href="Line.html#method.getEquation">getEquation</a>()
|
|
|
201 |
<ul class="version"><li>
|
|
|
202 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
203 |
<div class="description">
|
|
|
204 |
Renvoie un tableau contenant la pente et l'ordonnée à l'origine de la ligne.
|
|
|
205 |
</div>
|
|
|
206 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
207 |
</li>
|
|
|
208 |
<li class="method">
|
|
|
209 |
<a id="method.getXFrom"></a><span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getXFrom">getXFrom</a>(<span class="type">float</span> <span class="argument">$y</span>)
|
|
|
210 |
<ul class="version"><li>
|
|
|
211 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
212 |
<div class="description">
|
|
|
213 |
Renvoie la valeur de l'abscisse du point d'ordonnée $y situé sur la droite portant la ligne.
|
|
|
214 |
Si la ligne est horizontale et que $y est différent de l'ordonnée à l'origine, aucun point ne pourra être trouvé et la méthode renverra NULL.
|
|
|
215 |
</div>
|
|
|
216 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
217 |
</li>
|
|
|
218 |
<li class="method">
|
|
|
219 |
<a id="method.getYFrom"></a><span class="access">public</span> <span class="type">float</span> <a href="Line.html#method.getYFrom">getYFrom</a>(<span class="type">float</span> <span class="argument">$x</span>)
|
|
|
220 |
<ul class="version"><li>
|
|
|
221 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
222 |
<div class="description">
|
|
|
223 |
Renvoie la valeur de l'ordonnée du point d'abscisse $x situé sur la droite portant la ligne.
|
|
|
224 |
Si la ligne est verticale et qu'aucun point correspondant à $x ne peut être trouvé, la méthode renverra NULL.
|
|
|
225 |
</div>
|
|
|
226 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
227 |
</li>
|
|
|
228 |
<li class="method">
|
|
|
229 |
<a id="method.isPoint"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isPoint">isPoint</a>()
|
|
|
230 |
<div class="description">
|
|
|
231 |
Retourne TRUE si la ligne peut être considérée comme un point, FALSE sinon.
|
|
|
232 |
</div>
|
|
|
233 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
234 |
</li>
|
|
|
235 |
<li class="method">
|
|
|
236 |
<a id="method.isHorizontal"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isHorizontal">isHorizontal</a>()
|
|
|
237 |
<div class="description">
|
|
|
238 |
Retourne TRUE si la ligne est horizontale, FALSE sinon.
|
|
|
239 |
</div>
|
|
|
240 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
241 |
</li>
|
|
|
242 |
<li class="method">
|
|
|
243 |
<a id="method.isVertical"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isVertical">isVertical</a>()
|
|
|
244 |
<div class="description">
|
|
|
245 |
Retourne TRUE si la ligne est verticale, FALSE sinon.
|
|
|
246 |
</div>
|
|
|
247 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
248 |
</li>
|
|
|
249 |
<li class="method">
|
|
|
250 |
<a id="method.isTopToBottom"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isTopToBottom">isTopToBottom</a>(<a href="Polygon.html"><span class="type">Polygon</span></a> <span class="argument">$polygon</span>)
|
|
|
251 |
<ul class="version"><li>
|
|
|
252 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
253 |
<div class="description">
|
|
|
254 |
Renvoie TRUE si la ligne remplit toute la hauteur du rectangle encadrant le polygone $polygon, FALSE sinon.
|
|
|
255 |
</div>
|
|
|
256 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
257 |
</li>
|
|
|
258 |
<li class="method">
|
|
|
259 |
<a id="method.isLeftToRight"></a><span class="access">public</span> <span class="type">bool</span> <a href="Line.html#method.isLeftToRight">isLeftToRight</a>(<a href="Polygon.html"><span class="type">Polygon</span></a> <span class="argument">$polygon</span>)
|
|
|
260 |
<ul class="version"><li>
|
|
|
261 |
Disponible depuis Artichow 1.0.9</li></ul>
|
|
|
262 |
<div class="description">
|
|
|
263 |
Renvoie TRUE si la ligne remplit toute la largeur du rectangle encadrant le polygone $polygon, FALSE sinon.
|
|
|
264 |
</div>
|
|
|
265 |
<div class="description-bottom"><a href="Line.html#top">Remonter</a></div>
|
|
|
266 |
</li>
|
|
|
267 |
</ul>
|
|
|
268 |
</td>
|
|
|
269 |
<td class='borderd'> </td>
|
|
|
270 |
</tr>
|
|
|
271 |
<tr>
|
|
|
272 |
<td class='cornerbg'></td>
|
|
|
273 |
<td class='borderb'> </td>
|
|
|
274 |
<td class='cornerbd'></td>
|
|
|
275 |
</tr>
|
|
|
276 |
</table>
|
|
|
277 |
</div>
|
|
|
278 |
</body>
|
|
|
279 |
</html>
|