From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- .../geometry.jsm/point/index.html | 264 +++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 files/he/mozilla/javascript_code_modules/geometry.jsm/point/index.html (limited to 'files/he/mozilla/javascript_code_modules/geometry.jsm/point') 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 +--- +

The Point class offers methods for performing common geometry operations on two dimensional points

+ +

Method overview

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Point add(x, y);
Point add(Point);
Point clone();
boolean equals(x, y);
Point equals(Point);
boolean isZero();
Point map(mapFunction);
Point scale(scaleFactor);
Point set(x, y);
Point set(Point);
Point subtract(x, y);
Point subtract(Point);
String toString();
+ +

Constructor

+ +

יוצר אובייקט Point חדש.

+ +
let p = new Point(x, y);
+
+ +

The new point, p, has the specified X and Y coordinates.

+ +

Methods

+ +

add()

+ +

Adds another point to this one.

+ +
Point add(
+  x,
+  y
+);
+
+Point add(
+  Point
+);
+
+ +
Parameters
+ +
+
x
+
The X coordinate of the point to add to the current point.
+
y
+
The Y coordinate of the point to add to the current point.
+
+ +
Note: You may specify another Point object instead of separate X and Y coordinates.
+ +
Return value
+ +

The value of the Point object after adding the specified value; this isn't a new object, just the same one you called the function on.

+ +

clone()

+ +

Creates and returns a copy of the Point object.

+ +
Point clone();
+
+ +
Parameters
+ +

None.

+ +
Return value
+ +

A new Point object which is a duplicate of the current object.

+ +

equals()

+ +

Determines whether another point is equal to this one.

+ +
boolean equals(
+  x,
+  y
+);
+
+boolean equals(
+  Point
+);
+
+ +
Parameters
+ +
+
x
+
The X coordinate of the point to compare to the current point.
+
y
+
The Y coordinate of the point to compare to the current point.
+
+ +
Note: You may specify another Point object instead of separate X and Y coordinates.
+ +
Return value
+ +

true if the two points are equal, otherwise false. Equality, in this context, means that both the X and Y coordinates are the same.

+ +

isZero()

+ +

Determines whether or not the point is (0, 0).

+ +
boolean isZero();
+
+ +
Parameters
+ +

None.

+ +
Return value
+ +

true if the point's X and Y coordinates are both zero; otherwise false.

+ +

map()

+ +

Calls a specified function to manipulate the values of the point's coordinates.

+ +
Point map(
+  mapFunction
+);
+
+ +
Parameters
+ +
+
mapFunction
+
The function to call to map the parameters; this function should accept one parameters: a single coordinate value. The Point object will be the value of this within the called function.
+
+ +
Return value
+ +

The value of the Point 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.

+ +

scale()

+ +

Scales the point's coordinates by a specified factor.

+ +
Point scale(
+  scaleFactor
+);
+
+ +
Parameters
+ +
+
scaleFactor
+
The amount by which to scale the point.
+
+ +
Return value
+ +

The value of the Point object after scaling its coordinates by the specified amount; this isn't a new object, just the same one you called the function on.

+ +

set()

+ +

Sets the value of the Point object.

+ +
Point set(
+  x,
+  y
+);
+
+Point set(
+  Point
+);
+
+ +
Parameters
+ +
+
x
+
The X coordinate of the point.
+
y
+
The Y coordinate of the point.
+
+ +
Note: You may specify another Point object instead of separate X and Y coordinates.
+ +
Return value
+ +

The Point object.

+ +

subtract()

+ +

Subtracts another point from this one.

+ +
Point subtract(
+  x,
+  y
+);
+
+Point subtract(
+  Point
+);
+
+ +
Parameters
+ +
+
x
+
The X coordinate of the point to subtract from the current point.
+
y
+
The Y coordinate of the point to subtract from the current point.
+
+ +
Note: You may specify another Point object instead of separate X and Y coordinates.
+ +
Return value
+ +

The value of the Point object after subtracting the specified value; this isn't a new object, just the same one you called the function on.

+ +

toString()

+ +

Returns a string representation of the Point object.

+ +
String toString();
+
+ +
Parameters
+ +

None.

+ +
Return value
+ +

A String object representing the point, in "(x,y)" format.

-- cgit v1.2.3-54-g00ecf