A 2D line segment defined by two points.
Line() → LineLine() → Line
Line(ax: float, ay: float, bx: float, by: float) → LineLine(ax: float, ay: float, bx: float, by: float) → Line
Line(ax: float, ay: float, b: Vec2) → LineLine(ax: float, ay: float, b: Vec2) → Line
Line(a: Vec2, bx: float, by: float) → LineLine(a: Vec2, bx: float, by: float) → Line
Line(a: Vec2, b: Vec2) → LineLine(a: Vec2, b: Vec2) → Line
A 2D line segment defined by two points.
| Name | Description | Type |
|---|---|---|
a | Get or set point A as a tuple or Vec2. | Vec2 |
ax | X-coordinate of point A. | float |
ay | Y-coordinate of point A. | float |
b | Get or set point B as a tuple or Vec2. | Vec2 |
bx | X-coordinate of point B. | float |
by | Y-coordinate of point B. | float |
length | The Euclidean length of the line segment. | float |
get_angle() → floatget_angle() → floatGet the angle of the line in radians.
Returns
float : The angle in radians.
get_closest_point(point: Vec2) → Vec2get_closest_point(point: Vec2) → Vec2Get the closest point on the line to a given point.
Args
point : The point to find the closest point to.Returns
Vec2 : The closest point on the line as a Vec2.
get_midpoint() → Vec2get_midpoint() → Vec2Get the midpoint of the line segment.
Returns
Vec2 : The midpoint as a Vec2.
get_perpendicular() → Lineget_perpendicular() → LineGet a perpendicular bisector line from this line.
Returns
Line : A new perpendicular line.
move(offset: Vec2) → Nonemove(offset: Vec2) → NoneMove this line by a Vec2 offset.
Args
offset : The amount to move.