Constructor
new Point(x, y)
Creates a new Point
Parameters:
Name | Type | Description |
---|---|---|
x | number | The x coordinate. (Can be any number from 0 to process.stdout.columns) |
y | number | The y coordinate. (Can be any number from 0 to process.stdout.rows) |
Throws:
- If the arguments are invalid or out of bounds
- Type
- Error
Example
// Create a new point at (10, 10)
const point = new Point(10, 10);
Members
x :number
The x coordinate
Type:
- number
y :number
The y coordinate
Type:
- number
Methods
equals(x, yopt) → {boolean}
Determines whether or not the point is equal to another point
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x | PointLike | The point to compare to, or the x coordinate | |
y | number | <optional> | The y coordinate |
Returns:
Whether or not the points are equal
- Type:
- boolean
transform(matrix)
Transforms the point by the given matrix
Parameters:
Name | Type | Description |
---|---|---|
matrix | Matrix | The matrix to transform the point by |
(static) center() → {Point}
Creates a new point at the center of the terminal
Returns:
The center point
- Type:
- Point
(static) centerFor(x, yopt) → {Point}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x | PointLike | The point or size to center, or the x coordinate | |
y | number | <optional> | The y coordinate |
Returns:
- Type:
- Point
(static) inBounds(px, yopt) → {boolean}
Determines whether or not the given point is within the bounds of the terminal
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
px | PointLike | The point or size to check, or the x coordinate | |
y | number | <optional> | The y coordinate |
Throws:
- If the arguments are invalid
- Type
- Error
Returns:
Whether or not the point is within the bounds of the terminal
- Type:
- boolean
(static) of(psx, yopt) → {Point}
Creates a new point from the given point, size, array, or coordinates
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
psx | Point | | The point or size to create a new point from, or the x coordinate | |
y | number | <optional> | The y coordinate |
Returns:
The new point
- Type:
- Point
(static) zero() → {Point}
Creates a new point at (0, 0)
Returns:
A new point at (0, 0)
- Type:
- Point