diff options
Diffstat (limited to 'files/he/mozilla/javascript_code_modules/geometry.jsm/point/index.html')
| -rw-r--r-- | files/he/mozilla/javascript_code_modules/geometry.jsm/point/index.html | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/files/he/mozilla/javascript_code_modules/geometry.jsm/point/index.html b/files/he/mozilla/javascript_code_modules/geometry.jsm/point/index.html new file mode 100644 index 0000000000..54b0c6fe81 --- /dev/null +++ b/files/he/mozilla/javascript_code_modules/geometry.jsm/point/index.html @@ -0,0 +1,264 @@ +--- +title: Point +slug: Mozilla/JavaScript_code_modules/Geometry.jsm/Point +translation_of: Mozilla/JavaScript_code_modules/Geometry.jsm/Point +--- +<p>The <code>Point</code> class offers methods for performing common geometry operations on two dimensional points</p> + +<h2 id="Method_overview">Method overview</h2> + +<table class="standard-table"> + <tbody> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#add()" title="en/JavaScript code modules/Geometry.jsm/Point#add()">add</a>(x, y);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#add()" title="en/JavaScript code modules/Geometry.jsm/Point#add()">add</a>(Point);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#clone()" title="en/JavaScript code modules/Geometry.jsm/Point#clone()">clone</a>();</code></td> + </tr> + <tr> + <td dir="ltr"><code>boolean <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#equals()" title="en/JavaScript code modules/Geometry.jsm/Point#equals()">equals</a>(x, y);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#equals()" title="en/JavaScript code modules/Geometry.jsm/Point#equals()">equals</a>(Point);</code></td> + </tr> + <tr> + <td dir="ltr"><code>boolean <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#isZero()" title="en/JavaScript code modules/Geometry.jsm/Point#isZero()">isZero</a>();</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#map()" title="en/JavaScript code modules/Geometry.jsm/Point#map()">map</a>(mapFunction);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#scale()" title="en/JavaScript code modules/Geometry.jsm/Point#scale()">scale</a>(scaleFactor);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#set()" title="en/JavaScript code modules/Geometry.jsm/Point#set()">set</a>(x, y);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#set()" title="en/JavaScript code modules/Geometry.jsm/Point#set()">set</a>(Point);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#subtract()" title="en/JavaScript code modules/Geometry.jsm/Point#subtract()">subtract</a>(x, y);</code></td> + </tr> + <tr> + <td dir="ltr"><code>Point <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#subtract()" title="en/JavaScript code modules/Geometry.jsm/Point#subtract()">subtract</a>(Point);</code></td> + </tr> + <tr> + <td dir="ltr"><code><a href="/en/JavaScript/Reference/Global_Objects/String" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String">String</a> <a href="/en/JavaScript_code_modules/Geometry.jsm/Point#toString()" title="en/JavaScript code modules/Geometry.jsm/Point#toString()">toString</a>();</code></td> + </tr> + </tbody> +</table> + +<h2 id="Constructor">Constructor</h2> + +<p>יוצר אובייקט <code>Point</code> חדש.</p> + +<pre>let p = new Point(x, y); +</pre> + +<p>The new point, <code>p</code>, has the specified X and Y coordinates.</p> + +<h2 id="Methods">Methods</h2> + +<h3 dir="ltr" id="add()">add()</h3> + +<p>Adds another point to this one.</p> + +<pre>Point add( + x, + y +); + +Point add( + Point +); +</pre> + +<h6 id="Parameters">Parameters</h6> + +<dl> + <dt><code>x</code></dt> + <dd>The X coordinate of the point to add to the current point.</dd> + <dt><code>y</code></dt> + <dd>The Y coordinate of the point to add to the current point.</dd> +</dl> + +<div class="note"><strong>Note:</strong> You may specify another <code>Point</code> object instead of separate X and Y coordinates.</div> + +<h6 id="Return_value">Return value</h6> + +<p>The value of the <code>Point</code> object after adding the specified value; this isn't a new object, just the same one you called the function on.</p> + +<h3 id="clone()">clone()</h3> + +<p>Creates and returns a copy of the <code>Point</code> object.</p> + +<pre>Point clone(); +</pre> + +<h6 id="Parameters_2">Parameters</h6> + +<p>None.</p> + +<h6 id="Return_value_2">Return value</h6> + +<p>A new <code>Point</code> object which is a duplicate of the current object.</p> + +<h3 id="equals()">equals()</h3> + +<p>Determines whether another point is equal to this one.</p> + +<pre>boolean equals( + x, + y +); + +boolean equals( + Point +); +</pre> + +<h6 id="Parameters_3">Parameters</h6> + +<dl> + <dt><code>x</code></dt> + <dd>The X coordinate of the point to compare to the current point.</dd> + <dt><code>y</code></dt> + <dd>The Y coordinate of the point to compare to the current point.</dd> +</dl> + +<div class="note"><strong>Note:</strong> You may specify another <code>Point</code> object instead of separate X and Y coordinates.</div> + +<h6 id="Return_value_3">Return value</h6> + +<p><code>true</code> if the two points are equal, otherwise <code>false</code>. Equality, in this context, means that both the X and Y coordinates are the same.</p> + +<h3 id="isZero()">isZero()</h3> + +<p>Determines whether or not the point is (0, 0).</p> + +<pre>boolean isZero(); +</pre> + +<h6 id="Parameters_4">Parameters</h6> + +<p>None.</p> + +<h6 id="Return_value_4">Return value</h6> + +<p><code>true</code> if the point's X and Y coordinates are both zero; otherwise <code>false</code>.</p> + +<h3 id="map()">map()</h3> + +<p>Calls a specified function to manipulate the values of the point's coordinates.</p> + +<pre>Point map( + mapFunction +); +</pre> + +<h6 id="Parameters_5">Parameters</h6> + +<dl> + <dt><code>mapFunction</code></dt> + <dd>The function to call to map the parameters; this function should accept one parameters: a single coordinate value. The <code>Point</code> object will be the value of <code>this</code> within the called function.</dd> +</dl> + +<h6 id="Return_value_5">Return value</h6> + +<p>The value of the <code>Point</code> object after modifying its coordinates by calling the specified function; this isn't a new object, just the same one you called the function on.</p> + +<h3 id="scale()">scale()</h3> + +<p>Scales the point's coordinates by a specified factor.</p> + +<pre>Point scale( + scaleFactor +); +</pre> + +<h6 id="Parameters_6">Parameters</h6> + +<dl> + <dt><code>scaleFactor</code></dt> + <dd>The amount by which to scale the point.</dd> +</dl> + +<h6 id="Return_value_6">Return value</h6> + +<p>The value of the <code>Point</code> object after scaling its coordinates by the specified amount; this isn't a new object, just the same one you called the function on.</p> + +<h3 id="set()">set()</h3> + +<p>Sets the value of the <code>Point</code> object.</p> + +<pre>Point set( + x, + y +); + +Point set( + Point +); +</pre> + +<h6 id="Parameters_7">Parameters</h6> + +<dl> + <dt><code>x</code></dt> + <dd>The X coordinate of the point.</dd> + <dt><code>y</code></dt> + <dd>The Y coordinate of the point.</dd> +</dl> + +<div class="note"><strong>Note:</strong> You may specify another <code>Point</code> object instead of separate X and Y coordinates.</div> + +<h6 id="Return_value_7">Return value</h6> + +<p>The <code>Point</code> object.</p> + +<h3 id="subtract()">subtract()</h3> + +<p>Subtracts another point from this one.</p> + +<pre>Point subtract( + x, + y +); + +Point subtract( + Point +); +</pre> + +<h6 id="Parameters_8">Parameters</h6> + +<dl> + <dt><code>x</code></dt> + <dd>The X coordinate of the point to subtract from the current point.</dd> + <dt><code>y</code></dt> + <dd>The Y coordinate of the point to subtract from the current point.</dd> +</dl> + +<div class="note"><strong>Note:</strong> You may specify another <code>Point</code> object instead of separate X and Y coordinates.</div> + +<h6 id="Return_value_8">Return value</h6> + +<p>The value of the <code>Point</code> object after subtracting the specified value; this isn't a new object, just the same one you called the function on.</p> + +<h3 id="toString()">toString()</h3> + +<p>Returns a string representation of the <code>Point</code> object.</p> + +<pre>String toString(); +</pre> + +<h6 id="Parameters_9">Parameters</h6> + +<p>None.</p> + +<h6 id="Return_value_9">Return value</h6> + +<p>A <a href="/en/JavaScript/Reference/Global_Objects/String" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String"><code>String</code></a> object representing the point, in "(<em>x</em>,<em>y</em>)" format.</p> |
