Constructor
new Point2D(xopt, yopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
number |
<optional> |
0
|
The x coordinate of the point. |
y |
number |
<optional> |
0
|
The y coordinate of the point. |
Members
x :number
- Description:
- The x coordinate of the point.
- Source:
The x coordinate of the point.
Type:
- number
y :number
- Description:
- The y coordinate of the point.
- Source:
The y coordinate of the point.
Type:
- number
Methods
angleTo(pointnon-null) → {number}
- Description:
- Calculates the angle between this point and the given point.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
point |
westures-core.Point2D | Projected point for calculating the angle. |
Returns:
Radians along the unit circle where the projected
point lies.
- Type
- number
anglesTo(pointsnon-null) → {Array.<number>}
- Description:
- Determine the angle from the centroid to each of the points.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<westures-core.Point2D> | the Point2D objects to calculate the angles to. |
Returns:
- Type
- Array.<number>
averageDistanceTo(pointsnon-null) → {number}
- Description:
- Determine the average distance from this point to the provided array of points.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<westures-core.Point2D> | the Point2D objects to calculate the average distance to. |
Returns:
The average distance from this point to the provided
points.
- Type
- number
clone() → {westures-core.Point2D}
- Description:
- Clone this point.
- Source:
Returns:
A new Point2D, identical to this point.
distanceTo(pointnon-null) → {number}
- Description:
- Calculates the distance between two points.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
point |
westures-core.Point2D | Point to which the distance is calculated. |
Returns:
The distance between the two points, a.k.a. the
hypoteneuse.
- Type
- number
minus(pointnon-null) → {westures-core.Point2D}
- Description:
- Subtract the given point from this point.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
point |
westures-core.Point2D | Point to subtract from this point. |
Returns:
A new Point2D, which is the result of (this
- point).
plus(pointnon-null) → {westures-core.Point2D}
- Description:
- Return the summation of this point to the given point.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
point |
westures-core.Point2D | Point to add to this point. |
Returns:
A new Point2D, which is the addition of the
two points.
totalDistanceTo(pointsnon-null) → {number}
- Description:
- Calculates the total distance from this point to an array of points.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<westures-core.Point2D> | The array of Point2D objects to calculate the total distance to. |
Returns:
The total distance from this point to the provided points.
- Type
- number
(static) centroid(points) → {westures-core.Point2D}
- Description:
- Calculates the centroid of a list of points.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<westures-core.Point2D> | The array of Point2D objects for which to calculate the centroid. |
Returns:
The centroid of the provided points.
(static) sum(points) → {westures-core.Point2D}
- Description:
- Calculates the sum of the given points.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<westures-core.Point2D> | The Point2D objects to sum up. |
Returns:
A new Point2D representing the sum of the
given points.