Line
A 2D line segment defined by two points.
Constructor
-
Line() → Line -
Line(
ax: float,
ay: float,
bx: float,
by: float
) → Line -
Line(ax: float, ay: float, b: Vec2) → Line -
Line(a: Vec2, bx: float, by: float) → Line -
Line(a: Vec2, b: Vec2) → Line
A 2D line segment defined by two points.
Properties
| Name | Description | Type |
|---|---|---|
a | Get or set point A as a tuple or Vec2. | Vec2 |
b | Get or set point B as a tuple or Vec2. | Vec2 |
ax | X-coordinate of point A. | float |
ay | Y-coordinate of point A. | float |
bx | X-coordinate of point B. | float |
by | Y-coordinate of point B. | float |
length | The Euclidean length of the line segment. | float |
Methods
Copy
copy() → LineReturn a copy of this line.
Move
move(offset: Vec2) → NoneMove this line by a Vec2 or 2-element sequence.
Args
offset: The amount to move.