52#include <gtest/gtest.h>
54#include <unordered_set>
71 return std::abs(a - b) < tol;
138 std::string str = origin.to_string();
140 EXPECT_NE(str.find(
"0"), std::string::npos);
145 std::string str =
static_cast<std::string
>(p1);
181 Point right{0.5, -1};
192 Point right{0.5, -1};
276 std::unordered_set<Point> set;
277 set.insert(
Point(1, 2));
344 std::string str = polar.to_string();
381 EXPECT_EQ(horizontal.get_src_point(), origin);
382 EXPECT_EQ(horizontal.get_tgt_point(), p1);
427 const Point &
l = s.lowest_point();
434 const Point &
l = s.leftmost_point();
559 std::string str = diagonal.to_string();
586 double angle = s.counterclockwise_angle();
659 const Point &
l = t.lowest_point();
665 const Point &
l = t.leftmost_point();
812 EXPECT_EQ(
e2.get_hradius(), ellipse.get_hradius());
813 EXPECT_EQ(
e2.get_vradius(), ellipse.get_vradius());
825 Point l = ellipse.lowest_point();
832 Point l = ellipse.leftmost_point();
991 std::string str =
"hello";
998 std::string str =
"\\alpha";
1005 std::string str =
"$x$";
1012 std::string str =
"{ab}";
1079 Segment s{src, slope, length};
1146 EXPECT_THROW(s.mid_perpendicular(1), std::domain_error);
1175 testing::InitGoogleTest(&
argc,
argv);
bool intersects_with(const Segment &s) const
Checks if a segment intersects the ellipse.
static bool is_clockwise()
Returns the orientation of the ellipse.
Segment intersection_with(const Segment &sg) const
Computes the intersection segment between a line segment and this ellipse.
Represents a point with rectangular coordinates in a 2D plane.
const Point & rightmost_point() const
Returns the rightmost point (largest x-coordinate).
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
const Point & highest_point() const
Returns the highest point (largest y-coordinate).
const Point & nearest_point(const Point &p1, const Point &p2) const
Returns which of the two points, p1 or p2, is nearer to this point.
Point rotate(const Geom_Number &angle) const
Rotates the point around the origin by a given angle.
Point normalize() const
Returns a normalized copy of this vector (magnitude 1).
Polar representation of a 2D point.
An axis-aligned rectangle.
void set_rect(const Geom_Number &xmin, const Geom_Number &ymin, const Geom_Number &xmax, const Geom_Number &ymax)
Sets the coordinates of the rectangle.
Represents a line segment between two points.
Segment mid_perpendicular(const Geom_Number &dist) const
Returns the perpendicular chord of a given length passing through the midpoint.
Segment get_perpendicular(const Point &p) const
Constructs a segment perpendicular to this that passes through point p.
Represents a text string positioned at a 2D point.
A non-degenerate triangle defined by three points.
bool vertical
If true, use vertical layout (default).
Main namespace for Aleph-w library functions.
Geom_Number area_of_parallelogram(const Point &a, const Point &b, const Point &c)
Compute the signed area of the parallelogram defined by vectors a->b and a->c.
bool on_segment(const Segment &s, const Point &p)
Return true if p lies on segment s (exact).
Geom_Number cosinus(const Geom_Number &x)
Cosine of x (wrapper over mpfr).
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.
Geom_Number square_root(const Geom_Number &x)
Square root of x (wrapper over mpfr).
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.
bool diff(const C1 &c1, const C2 &c2, Eq e=Eq())
Check if two containers differ.
mpq_class Geom_Number
Numeric type used by the geometry module.
Geom_Number arctan2(const Geom_Number &m, const Geom_Number &n)
Two-argument arc tangent (wrapper over mpfr).
size_t approximate_string_size(const std::string &str)
Estimate the count of printable characters in a LaTeX string.
Geom_Number arctan(const Geom_Number &m)
Arc tangent of m (wrapper over mpfr).
Geom_Number euclidean_distance(const Geom_Number &x, const Geom_Number &y)
Euclidean distance (hypotenuse) of the vector (x, y).
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
Geom_Number sinus(const Geom_Number &x)
Sine of x (wrapper over mpfr).
2D point and geometric utilities.
TEST_F(PointTest, DefaultConstruction)
bool approx_equal(const Geom_Number &a, const Geom_Number &b, double tol=EPSILON)
bool between(const Point &a, const Point &b, const Point &c)
Base class for all geometric objects.