37#include <gtest/gtest.h>
242 auto [x,
y] =
l1.intersection(
l2);
253 auto [x,
y] =
l1.intersection(
l2);
265 auto [x,
y] =
l1.intersection(
l2);
366 double expected = 1.0 / std::sqrt(2.0);
454 EXPECT_TRUE(str.find(
"y = ") != std::string::npos);
462 std::ostringstream
ss;
465 EXPECT_TRUE(
ss.str().find(
"1.5") != std::string::npos ||
ss.str().find(
"3/2") != std::string::npos);
466 EXPECT_TRUE(
ss.str().find(
"2.5") != std::string::npos ||
ss.str().find(
"5/2") != std::string::npos);
573 auto [x1,
y1] =
l1.intersection(
l2);
574 auto [x2, y2] =
l1.intersection(
l3);
575 auto [
x3,
y3] =
l2.intersection(
l3);
594 auto [x,
y] =
l1.intersection(
l2);
625 ::testing::InitGoogleTest(&
argc,
argv);
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_y1_function > > y1(const __gmp_expr< T, U > &expr)
2D infinite line representation using slope-intercept form.
TEST_F(LineConstructorTest, DefaultConstructor)
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.
mpq_class Geom_Number
Numeric type used by the geometry module.
2D infinite line in slope-intercept form.
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.
bool is_horizontal(const Geom_Number &epsilon=LINE_EPSILON) const noexcept
Check if the line is horizontal (slope = 0).
const Geom_Number & y_intercept() const noexcept
Get the y-intercept of the line.
Geom_Number x_at(const Geom_Number &y) const
Compute x-coordinate for a given y-coordinate.
std::string to_string() const
Convert line to a string representation.
Geom_Number distance_to(const Geom_Number &px, const Geom_Number &py) const noexcept
Compute distance from a point to this line.
const Geom_Number & slope() const noexcept
Get the slope of the line.
Geom_Number y0
Y-intercept (where line crosses y-axis)
Geom_Number m
Slope (dy/dx)
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.