|
| constexpr | LineEq () noexcept=default |
| | Default constructor creates line y = x.
|
| |
| | LineEq (const Geom_Number &__y0, const Geom_Number &__m) noexcept |
| | Construct line from y-intercept and slope.
|
| |
| | LineEq (const Geom_Number &x1, const Geom_Number &y1, const Geom_Number &__m) noexcept |
| | Construct line through a point with given slope.
|
| |
| | LineEq (const Geom_Number &x1, const Geom_Number &y1, const Geom_Number &x2, const Geom_Number &y2) |
| | Construct a line through two points.
|
| |
| | LineEq (const Point &p, const Geom_Number &__m) noexcept |
| | Construct a line through a Point with a given slope.
|
| |
| | LineEq (const Point &p1, const Point &p2) |
| | Construct line through two Points.
|
| |
| Geom_Number | operator() (const Geom_Number &x) const noexcept |
| | Evaluate line at given x-coordinate.
|
| |
| const Geom_Number & | slope () const noexcept |
| | Get the slope of the line.
|
| |
| const Geom_Number & | y_intercept () const noexcept |
| | Get the y-intercept of the line.
|
| |
| bool | is_horizontal (const Geom_Number &epsilon=LINE_EPSILON) const noexcept |
| | Check if the line is horizontal (slope = 0).
|
| |
| bool | is_parallel_to (const LineEq &l, const Geom_Number &epsilon=LINE_EPSILON) const noexcept |
| | Check if this line is parallel to another.
|
| |
| bool | is_perpendicular_to (const LineEq &l, const Geom_Number &epsilon=LINE_EPSILON) const noexcept |
| | Check if this line is perpendicular to another.
|
| |
| Geom_Number | x_at (const Geom_Number &y) const |
| | Compute x-coordinate for a given y-coordinate.
|
| |
| std::pair< Geom_Number, Geom_Number > | intersection (const LineEq &l, const Geom_Number &epsilon=LINE_EPSILON) const |
| | Compute the intersection point with another line.
|
| |
| LineEq | perpendicular_through (const Geom_Number &px, const Geom_Number &py) const |
| | Compute perpendicular line through a point.
|
| |
| Geom_Number | distance_to (const Geom_Number &px, const Geom_Number &py) const noexcept |
| | Compute distance from a point to this line.
|
| |
| bool | contains_point (const Geom_Number &px, const Geom_Number &py, const Geom_Number &epsilon=LINE_EPSILON) const noexcept |
| | Check if a point lies on this line.
|
| |
| Geom_Number | distance_to (const Point &p) const noexcept |
| | Compute distance from a Point to this line.
|
| |
| LineEq | perpendicular_through (const Point &p) const |
| | Compute a perpendicular line through a Point.
|
| |
| bool | contains_point (const Point &p, const Geom_Number &epsilon=LINE_EPSILON) const noexcept |
| | Check if a Point lies on this line.
|
| |
| Point | intersection_point (const LineEq &l, const Geom_Number &epsilon=LINE_EPSILON) const |
| | Compute the intersection Point with another line.
|
| |
| bool | operator== (const LineEq &l) const noexcept |
| | Test equality of two lines.
|
| |
| bool | operator!= (const LineEq &l) const noexcept |
| | Test inequality of two lines.
|
| |
| bool | approx_equal (const LineEq &l, const Geom_Number &epsilon) const noexcept |
| | Test approximate equality of two lines.
|
| |
| std::string | to_string () const |
| | Convert line to a string representation.
|
| |
2D infinite line in slope-intercept form.
Represents an infinite line using the equation y = y0 + m*x where:
- y0 is the y-intercept (value of y when x = 0)
- m is the slope (dy/dx)
- Note
- This representation cannot handle vertical lines (infinite slope). For vertical lines, use parametric or implicit form.
Definition at line 125 of file line.H.
| bool Aleph::LineEq::approx_equal |
( |
const LineEq & |
l, |
|
|
const Geom_Number & |
epsilon |
|
) |
| const |
|
inlinenoexcept |
Test approximate equality of two lines.
Lines are approximately equal if their slope and y-intercept are within an epsilon tolerance.
- Parameters
-
| l | Line to compare with |
| epsilon | Tolerance for comparison |
- Returns
- True if lines are approximately equal
Definition at line 497 of file line.H.
References abs(), Aleph::and, l, m, and y0.
Compute the intersection point with another line.
Solves the system of equations to find where lines cross:
- y = y0_1 + m_1 * x
- y = y0_2 + m_2 * x
Solution: x = (y0_1 - y0_2) / (m_2 - m_1)
- Parameters
-
| l | The other line |
| epsilon | Tolerance for parallel line detection |
- Returns
- Pair (x, y) of intersection coordinates
- Exceptions
-
| domain_error | if lines are parallel (no unique intersection) |
- Example
auto [x,
y] =
l1.intersection(
l2);
Definition at line 343 of file line.H.
References ah_domain_error_if, is_parallel_to(), l, m, and y0.
Referenced by intersection_point(), and TEST_F().
Check if this line is parallel to another.
Two lines are parallel if they have the same slope.
- Parameters
-
| l | The other line |
| epsilon | Tolerance for comparison (default: exact equality) |
- Returns
- True if lines are parallel
Definition at line 285 of file line.H.
References abs(), l, and m.
Referenced by intersection().
| bool Aleph::LineEq::operator== |
( |
const LineEq & |
l | ) |
const |
|
inlinenoexcept |
Test equality of two lines.
Lines are equal if they have the same slope and y-intercept.
- Parameters
-
- Returns
- True if lines are identical
Definition at line 471 of file line.H.
References Aleph::and, l, m, and y0.
Compute perpendicular line through a point.
Returns the line perpendicular to this one that passes through the given point. The perpendicular slope is -1/m.
- Parameters
-
| px | X-coordinate of point |
| py | Y-coordinate of point |
- Returns
- Perpendicular line through (px, py)
- Exceptions
-
| domain_error | if this line is horizontal (perpendicular would be vertical) |
Definition at line 365 of file line.H.
References ah_domain_error_if, is_horizontal(), and m.
Referenced by perpendicular_through(), TEST_F(), and TEST_F().