Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Point Class Reference

Represents a point with rectangular coordinates in a 2D plane. More...

#include <point.H>

Inheritance diagram for Aleph::Point:
[legend]
Collaboration diagram for Aleph::Point:
[legend]

Public Member Functions

 Point ()
 Default constructor.
 
 Point (const Geom_Number &x, const Geom_Number &y)
 Constructs a point from Cartesian coordinates.
 
 Point (const Polar_Point &pp)
 Constructs a point from polar coordinates.
 
bool operator== (const Point &point) const noexcept
 Checks for exact equality between two points.
 
bool operator!= (const Point &point) const noexcept
 Checks for inequality between two points.
 
bool operator< (const Point &point) const noexcept
 Defines a strict lexicographical ordering for points.
 
Point operator+ (const Point &p) const
 Vector addition.
 
Point & operator+= (const Point &p)
 Vector addition and assignment.
 
Point operator- (const Point &p) const
 Vector subtraction.
 
Point & operator-= (const Point &p)
 Vector subtraction and assignment.
 
Point operator- () const
 Unary negation (vector inversion).
 
Point operator* (const Geom_Number &s) const
 Scalar multiplication.
 
Point operator/ (const Geom_Number &s) const
 Scalar division.
 
Geom_Number dot (const Point &p) const
 Dot product.
 
Geom_Number cross (const Point &p) const
 2D cross-product (z-component of the 3D cross-product).
 
Geom_Number norm_squared () const
 Squared Euclidean norm.
 
Geom_Number norm () const
 Euclidean norm (vector magnitude).
 
Point normalize () const
 Returns a normalized copy of this vector (magnitude 1).
 
Point rotate (const Geom_Number &angle) const
 Rotates the point around the origin by a given angle.
 
Point lerp (const Point &other, const Geom_Number &t) const
 Linear interpolation between this point and another.
 
Point midpoint (const Point &other) const
 Calculates the midpoint between this point and another.
 
const Geom_Number & get_x () const noexcept
 Gets the x-coordinate value.
 
const Geom_Number & get_y () const noexcept
 Gets the y-coordinate value.
 
bool is_colinear_with (const Point &p1, const Point &p2) const
 Checks if this point is collinear with two other points.
 
bool is_colinear_with (const Segment &s) const
 Checks if this point is collinear with a segment.
 
bool is_left_of (const Point &p1, const Point &p2) const
 Checks if this point is to the left of the directed line from p1 to p2.
 
bool is_to_left_from (const Point &p1, const Point &p2) const
 
bool is_to_right_from (const Point &p1, const Point &p2) const
 Checks if this point is to the right of the directed line from p1 to p2.
 
bool is_to_left_on_from (const Point &p1, const Point &p2) const
 Checks if this point is to the left of or on the line from p1 to p2.
 
bool is_right_on_of (const Point &p1, const Point &p2) const
 Checks if this point is to the right of or on the line from p1 to p2.
 
bool is_to_right_on_from (const Point &p1, const Point &p2) const
 
bool is_clockwise_with (const Point &p1, const Point &p2) const
 Determines if the sequence of three points (this, p1, p2) makes a clockwise turn.
 
bool is_left_of (const Segment &s) const
 Checks if this point is to the left of a directed segment.
 
bool is_right_of (const Segment &s) const
 Checks if this point is to the right of a directed segment.
 
bool is_to_left_from (const Segment &s) const
 
bool is_to_right_from (const Segment &s) const
 
bool is_clockwise_with (const Segment &s) const
 Determines if the sequence (this, s.src, s.tgt) makes a clockwise turn.
 
bool is_between (const Point &p1, const Point &p2) const
 Checks if this point is on the bounding box of p1 and p2 and is collinear with them.
 
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.
 
bool is_inside (const Segment &s) const
 Checks if this point is contained within a segment.
 
bool is_inside (const Ellipse &e) const
 Checks if this point is contained within an ellipse.
 
bool intersects_with (const Ellipse &e) const
 Checks if this point lies exactly on the boundary of an ellipse.
 
std::string to_string () const
 Returns a string representation of the point as "(x,y)".
 
 operator std::string () const
 Cast operator to std::string.
 
Geom_Number distance_squared_to (const Point &that) const
 Calculates the squared Euclidean distance to another point.
 
Geom_Number distance_to (const Point &p) const
 Calculates the Euclidean distance to another point.
 
Geom_Number distance_with (const Point &p) const
 
const Point & highest_point () const
 Returns the highest point (largest y-coordinate).
 
const Point & lowest_point () const
 Returns the lowest point (smallest y-coordinate).
 
const Point & leftmost_point () const
 Returns the leftmost point (smallest x-coordinate).
 
const Point & rightmost_point () const
 Returns the rightmost point (largest x-coordinate).
 
- Public Member Functions inherited from Aleph::Geom_Object
 Geom_Object ()=default
 
virtual ~Geom_Object ()=default
 

Private Attributes

Geom_Number x_
 
Geom_Number y_
 

Friends

class Segment
 
class Triangle
 
class Polar_Point
 

Detailed Description

Represents a point with rectangular coordinates in a 2D plane.

Fundamental class defining a point in a Cartesian coordinate plane. It provides vector operations, transformations, and geometric predicates. Uses the Geom_Number type for exact-precision arithmetic.

Definition at line 220 of file point.H.

Constructor & Destructor Documentation

◆ Point() [1/3]

Aleph::Point::Point ( )
inline

Default constructor.

Note
Initializes the point at the origin (0, 0).

Definition at line 234 of file point.H.

◆ Point() [2/3]

Aleph::Point::Point ( const Geom_Number &  x,
const Geom_Number &  y 
)
inline

Constructs a point from Cartesian coordinates.

Parameters
xThe x-coordinate.
yThe y-coordinate.

Definition at line 243 of file point.H.

◆ Point() [3/3]

Point::Point ( const Polar_Point &  pp)
inline

Constructs a point from polar coordinates.

Parameters
ppThe point in polar coordinates (Polar_Point) to be converted.

Definition at line 822 of file point.H.

Member Function Documentation

◆ cross()

Geom_Number Aleph::Point::cross ( const Point &  p) const
inline

2D cross-product (z-component of the 3D cross-product).

Parameters
pThe other vector (point).
Returns
The scalar x1*y2 - y1*x2. Its sign indicates orientation.

Definition at line 374 of file point.H.

References x_, and y_.

Referenced by Aleph::Segment::intersection_with().

◆ distance_squared_to()

◆ distance_to()

Geom_Number Point::distance_to ( const Point &  p) const
inline

Calculates the Euclidean distance to another point.

Parameters
pThe other point.
Returns
The Euclidean distance.

Definition at line 1498 of file point.H.

References Aleph::euclidean_distance(), x_, and y_.

Referenced by Aleph::Segment::distance_to(), distance_with(), Aleph::Euclidian_Graph< __Euclidian_Node, __Euclidian_Arc >::get_distance(), Aleph::Triangle::incenter(), and Aleph::Triangle::perimeter().

◆ distance_with()

Geom_Number Aleph::Point::distance_with ( const Point &  p) const
inline
Deprecated:
Use distance_to() instead.

Definition at line 670 of file point.H.

References distance_to().

◆ dot()

Geom_Number Aleph::Point::dot ( const Point &  p) const
inline

Dot product.

Parameters
pThe other vector (point).
Returns
The scalar result of the dot product (x1*x2 + y1*y2).

Definition at line 364 of file point.H.

References x_, and y_.

Referenced by Aleph::Segment::get_perpendicular(), and Aleph::Segment::project().

◆ get_x()

const Geom_Number & Aleph::Point::get_x ( ) const
inlinenoexcept

Gets the x-coordinate value.

Returns
A const reference to the x-coordinate.

Definition at line 448 of file point.H.

References x_.

Referenced by Aleph::Abstract_Euclidian_Plane< __Euclidian_Graph >::Abstract_Euclidian_Plane(), Aleph::Polar_Point::Polar_Point(), Aleph::Abstract_Euclidian_Plane< __Euclidian_Graph >::add_point(), Aleph::Polygon::add_vertex(), Aleph::VisibilityPolygon::angle_less(), Aleph::area_of_parallelogram(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::VoronoiDiagramFromDelaunay::bisector_halfplane_for_site(), Aleph::AABBTree::box_contains_point(), K2Tree< T >::bu_insert(), K2Tree< T >::build(), Aleph::RangeTree2D::build(), K2Tree< T >::build_balanced(), Aleph::MonotonePolygonTriangulation::build_faces_from_diagonals(), build_poly_graph(), Aleph::SweepLineSegmentIntersection::canonicalize(), Aleph::Polygon::centroid(), Aleph::Triangle::circumcenter(), Aleph::VoronoiDiagramFromDelaunay::circumcenter(), Aleph::ConvexPolygonDistanceGJK::closest_from_simplex(), Aleph::BruteForceConvexHull::CmpSegment::cmp_point(), Aleph::SegmentSegmentIntersection::collinear_overlap(), Eepic_Plane::compute_extreme_points(), Eepic_Plane::compute_geom_plane(), Aleph::Ellipse::compute_radius(), Aleph::Segment::compute_slope(), Aleph::Segment::compute_tgt_point(), Aleph::TrapezoidalMapPointLocation::Result::contains(), Aleph::BezierCurve::control_bbox(), Aleph::Segment::counterclockwise_angle_with(), Aleph::MinkowskiSumConvex::cross(), Aleph::ShortestPathInPolygon::cross(), Aleph::BezierCurve::cubic(), Aleph::KDTreePointSearch::debug_snapshot(), demo_convex_hull_cities(), demo_coverage_area(), Eepic_Triangle::draw(), Eepic_Plane::draw_cartesian_axis(), Eepic_Plane::draw_ellipse(), Eepic_Plane::draw_point(), Eepic_Plane::draw_point_text(), Aleph::Tikz_Plane::draw_rotated_ellipse(), Eepic_Plane::draw_text(), Eepic_Plane::draw_vertex_numbers_in_polygon(), Aleph::HalfPlaneIntersection::HalfPlane::dx(), Aleph::MonotonePolygonTriangulation::edge_x_at_y(), Aleph::VoronoiDiagramFortune::enqueue_circle_event(), Aleph::SweepLineSegmentIntersection::event_less(), export_csv(), Aleph::RotatedEllipse::extremal_points(), Aleph::Point3D::from_2d(), Aleph::Point3D::from_2d(), Aleph::MinimumEnclosingCircle::from_three_points(), Aleph::GiftWrappingConvexHull::get_lowest_point(), Aleph::Polar_Point::get_quadrant(), Aleph::Abstract_Euclidian_Plane< __Euclidian_Graph >::get_width(), Aleph::Ellipse::highest_point(), hull_signature(), Aleph::in_circle_determinant(), Aleph::Ellipse::intersection_with(), Aleph::Ellipse::intersects_with(), Aleph::MonotonePolygonTriangulation::is_above(), is_between(), Aleph::MonotonePolygonTriangulation::EdgeStatusTree::left_edge_of_point(), Aleph::Triangle::leftmost_point(), Aleph::Ellipse::leftmost_point(), Aleph::Segment::leftmost_point(), Aleph::Segment::length(), Aleph::ConvexPolygonDistanceGJK::lerp_point(), Aleph::RegularTriangulationBowyerWatson::lex_less(), Aleph::KDTreePointSearch::lexicographic_less(), Aleph::DelaunayTriangulationBowyerWatson::lexicographic_less(), Aleph::ConstrainedDelaunayTriangulation::lexicographic_less(), Aleph::ConvexPolygonOffset::line_intersect(), Aleph::HalfPlaneIntersection::line_intersection(), Aleph::ConvexPolygonIntersectionBasic::line_intersection(), Aleph::Ellipse::lowest_point(), K2Tree< T >::lr_insert(), main(), main(), Aleph::Tikz_Plane::map_point(), Aleph::Segment::mid_perpendicular(), Aleph::Segment::mid_point(), objective(), Aleph::HalfPlaneIntersection::HalfPlane::offset(), Aleph::ConvexPolygonOffset::offset_edge(), std::hash< Aleph::Point >::operator()(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::SegmentArrangement::operator()(), Aleph::DelaunayTriangulationRandomizedIncremental::operator()(), Aleph::ClosestPairDivideAndConquer::LexicographicCmp::operator()(), Aleph::ClosestPairDivideAndConquer::ByYCmp::operator()(), Aleph::AndrewMonotonicChainConvexHull::LexicographicCmp::operator()(), Aleph::GrahamScanConvexHull::LexicographicCmp::operator()(), Aleph::VisibilityPolygon::operator()(), Aleph::operator<<(), Aleph::LineEq::perpendicular_through(), Aleph::RegularTriangulationBowyerWatson::point_in_power_circle(), Aleph::SegmentSegmentIntersection::point_less_on_axis(), Eepic_Plane::point_string(), points_equal(), polygon_area(), Aleph::PowerDiagram::power_center(), print_point(), print_point(), print_point(), print_polygon(), print_polygon(), print_triangle(), Aleph::SegmentArrangement::pt_less(), Aleph::put_trapezoidal_map_result(), Aleph::BezierCurve::quadratic(), Aleph::VisibilityPolygon::ray_edge_hit(), Aleph::ray_endpoint(), Aleph::VisibilityPolygon::ray_param(), Aleph::ClosestPairDivideAndConquer::recurse(), Aleph::Polygon::remove_vertex(), Aleph::Triangle::rightmost_point(), Aleph::Ellipse::rightmost_point(), Aleph::Segment::rightmost_point(), Aleph::Ellipse::sample(), scenario_exact_intersection(), Aleph::QuickHull::search_extremes(), Aleph::Segment::sense(), Aleph::Polygon::signed_area(), Aleph::GeomPolygonUtils::signed_double_area(), Aleph::Segment::slope_exact(), Aleph::SweepLineSegmentIntersection::slope_less(), sorted_hull_vertices(), Aleph::BezierCurve::split_cubic(), Aleph::detail::spp_cross(), Aleph::PolygonOffset::sq_dist(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::GeomSerializer::to_geojson(), Aleph::GeomSerializer::to_geojson(), Aleph::GeomSerializer::to_geojson(), Aleph::RotatedEllipse::to_local(), Aleph::GeomSerializer::to_wkt(), Aleph::GeomSerializer::to_wkt(), Aleph::GeomSerializer::to_wkt(), Aleph::RotatedEllipse::to_world(), triangle_area(), Aleph::Polygon::update_extreme_points(), write_polygon_wkt(), write_polygon_wkt(), write_polygon_wkt(), K2Tree< T >::Node::x(), and Aleph::SweepLineSegmentIntersection::y_at_x().

◆ get_y()

const Geom_Number & Aleph::Point::get_y ( ) const
inlinenoexcept

Gets the y-coordinate value.

Returns
A const reference to the y-coordinate.

Definition at line 457 of file point.H.

References y_.

Referenced by Aleph::Abstract_Euclidian_Plane< __Euclidian_Graph >::Abstract_Euclidian_Plane(), Aleph::Polar_Point::Polar_Point(), Aleph::Abstract_Euclidian_Plane< __Euclidian_Graph >::add_point(), Aleph::Polygon::add_vertex(), Aleph::VisibilityPolygon::angle_less(), Aleph::area_of_parallelogram(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::Tikz_Plane::bbox_of(), Aleph::VoronoiDiagramFromDelaunay::bisector_halfplane_for_site(), Aleph::AABBTree::box_contains_point(), K2Tree< T >::bu_insert(), K2Tree< T >::build(), Aleph::RangeTree2D::build(), K2Tree< T >::build_balanced(), Aleph::MonotonePolygonTriangulation::build_faces_from_diagonals(), build_poly_graph(), Aleph::SweepLineSegmentIntersection::canonicalize(), Aleph::Polygon::centroid(), Aleph::Triangle::circumcenter(), Aleph::VoronoiDiagramFromDelaunay::circumcenter(), Aleph::ConvexPolygonDistanceGJK::closest_from_simplex(), Aleph::BruteForceConvexHull::CmpSegment::cmp_point(), Eepic_Plane::compute_extreme_points(), Eepic_Plane::compute_geom_plane(), Aleph::Ellipse::compute_radius(), Aleph::Segment::compute_slope(), Aleph::Segment::compute_tgt_point(), Aleph::TrapezoidalMapPointLocation::Result::contains(), Aleph::BezierCurve::control_bbox(), Aleph::Segment::counterclockwise_angle_with(), Aleph::MinkowskiSumConvex::cross(), Aleph::ShortestPathInPolygon::cross(), Aleph::BezierCurve::cubic(), Aleph::KDTreePointSearch::debug_snapshot(), demo_convex_hull_cities(), demo_coverage_area(), Eepic_Triangle::draw(), Eepic_Plane::draw_cartesian_axis(), Eepic_Plane::draw_ellipse(), Eepic_Plane::draw_point(), Eepic_Plane::draw_point_text(), Aleph::Tikz_Plane::draw_rotated_ellipse(), Eepic_Plane::draw_text(), Eepic_Plane::draw_vertex_numbers_in_polygon(), Aleph::HalfPlaneIntersection::HalfPlane::dy(), Aleph::MonotonePolygonTriangulation::edge_x_at_y(), Aleph::VoronoiDiagramFortune::enqueue_circle_event(), Aleph::SweepLineSegmentIntersection::event_less(), export_csv(), Aleph::RotatedEllipse::extremal_points(), Aleph::Point3D::from_2d(), Aleph::Point3D::from_2d(), Aleph::MinimumEnclosingCircle::from_three_points(), Aleph::Abstract_Euclidian_Plane< __Euclidian_Graph >::get_height(), Aleph::GiftWrappingConvexHull::get_lowest_point(), Aleph::Polar_Point::get_quadrant(), Aleph::Triangle::highest_point(), Aleph::Ellipse::highest_point(), Aleph::Segment::highest_point(), hull_signature(), Aleph::in_circle_determinant(), Aleph::Ellipse::intersection_with(), Aleph::Ellipse::intersects_with(), Aleph::MonotonePolygonTriangulation::is_above(), is_between(), Aleph::Ellipse::leftmost_point(), Aleph::Segment::length(), Aleph::ConvexPolygonDistanceGJK::lerp_point(), Aleph::RegularTriangulationBowyerWatson::lex_less(), Aleph::KDTreePointSearch::lexicographic_less(), Aleph::DelaunayTriangulationBowyerWatson::lexicographic_less(), Aleph::ConstrainedDelaunayTriangulation::lexicographic_less(), Aleph::ConvexPolygonOffset::line_intersect(), Aleph::HalfPlaneIntersection::line_intersection(), Aleph::ConvexPolygonIntersectionBasic::line_intersection(), Aleph::Polygon::locate_point(), Aleph::Triangle::lowest_point(), Aleph::Ellipse::lowest_point(), Aleph::Segment::lowest_point(), K2Tree< T >::lr_insert(), main(), main(), Aleph::Tikz_Plane::map_point(), Aleph::Segment::mid_perpendicular(), Aleph::Segment::mid_point(), objective(), Aleph::HalfPlaneIntersection::HalfPlane::offset(), Aleph::ConvexPolygonOffset::offset_edge(), std::hash< Aleph::Point >::operator()(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::DelaunayTriangulationRandomizedIncremental::operator()(), Aleph::ClosestPairDivideAndConquer::LexicographicCmp::operator()(), Aleph::ClosestPairDivideAndConquer::ByYCmp::operator()(), Aleph::AndrewMonotonicChainConvexHull::LexicographicCmp::operator()(), Aleph::GrahamScanConvexHull::LexicographicCmp::operator()(), Aleph::VisibilityPolygon::operator()(), Aleph::operator<<(), Aleph::LineEq::perpendicular_through(), Aleph::RegularTriangulationBowyerWatson::point_in_power_circle(), Aleph::BooleanPolygonOperations::point_inside_ccw(), Aleph::SegmentSegmentIntersection::point_less_on_axis(), Eepic_Plane::point_string(), points_equal(), polygon_area(), Aleph::PowerDiagram::power_center(), print_point(), print_point(), print_point(), print_polygon(), print_polygon(), print_triangle(), Aleph::SegmentArrangement::pt_less(), Aleph::put_trapezoidal_map_result(), Aleph::BezierCurve::quadratic(), Aleph::VisibilityPolygon::ray_edge_hit(), Aleph::ray_endpoint(), Aleph::VisibilityPolygon::ray_param(), Aleph::Polygon::remove_vertex(), Aleph::Ellipse::rightmost_point(), Aleph::Ellipse::sample(), scenario_exact_intersection(), Aleph::Segment::sense(), Aleph::Polygon::signed_area(), Aleph::GeomPolygonUtils::signed_double_area(), Aleph::Segment::slope_exact(), Aleph::SweepLineSegmentIntersection::slope_less(), sorted_hull_vertices(), Aleph::BezierCurve::split_cubic(), Aleph::detail::spp_cross(), Aleph::PolygonOffset::sq_dist(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::GeomSerializer::to_geojson(), Aleph::GeomSerializer::to_geojson(), Aleph::GeomSerializer::to_geojson(), Aleph::RotatedEllipse::to_local(), Aleph::GeomSerializer::to_wkt(), Aleph::GeomSerializer::to_wkt(), Aleph::GeomSerializer::to_wkt(), Aleph::RotatedEllipse::to_world(), triangle_area(), Aleph::Polygon::update_extreme_points(), write_polygon_wkt(), write_polygon_wkt(), write_polygon_wkt(), K2Tree< T >::Node::y(), and Aleph::SweepLineSegmentIntersection::y_at_x().

◆ highest_point()

const Point & Aleph::Point::highest_point ( ) const
inline

Returns the highest point (largest y-coordinate).

For a Point, it's itself.

Returns
A const reference to itself.

Definition at line 679 of file point.H.

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ intersects_with()

bool Point::intersects_with ( const Ellipse &  e) const
inline

Checks if this point lies exactly on the boundary of an ellipse.

Parameters
eThe ellipse to check against.
Returns
true if the point is on the boundary.
See also
Ellipse::intersects_with()

Definition at line 2436 of file point.H.

References Aleph::Ellipse::intersects_with().

◆ is_between()

bool Aleph::Point::is_between ( const Point &  p1,
const Point &  p2 
) const
inline

Checks if this point is on the bounding box of p1 and p2 and is collinear with them.

Parameters
p1First point of the segment.
p2Second point of the segment.
Returns
true if this point lies on the segment joining p1 and p2.

Definition at line 588 of file point.H.

References Aleph::and, Aleph::blossom_maximum_cardinality_matching(), get_x(), get_y(), and is_colinear_with().

Referenced by Aleph::between(), Aleph::Segment::contains(), and Aleph::intersect_improp().

◆ is_clockwise_with() [1/2]

bool Aleph::Point::is_clockwise_with ( const Point &  p1,
const Point &  p2 
) const
inline

Determines if the sequence of three points (this, p1, p2) makes a clockwise turn.

Parameters
p1The second point in the sequence.
p2The third point in the sequence.
Returns
true if the orientation is clockwise.

Definition at line 544 of file point.H.

References Aleph::area_of_parallelogram().

Referenced by is_clockwise_with().

◆ is_clockwise_with() [2/2]

bool Point::is_clockwise_with ( const Segment &  s) const
inline

Determines if the sequence (this, s.src, s.tgt) makes a clockwise turn.

Parameters
sThe segment.
Returns
true if the orientation is clockwise.

Definition at line 1484 of file point.H.

References is_clockwise_with(), Aleph::Segment::src_, and Aleph::Segment::tgt_.

◆ is_colinear_with() [1/2]

bool Aleph::Point::is_colinear_with ( const Point &  p1,
const Point &  p2 
) const
inline

Checks if this point is collinear with two other points.

Parameters
p1The first point.
p2The second point.
Returns
true if all three points lie on the same line.

Definition at line 468 of file point.H.

References Aleph::area_of_parallelogram().

Referenced by Aleph::Polygon::add_vertex(), is_between(), Aleph::Segment::is_colinear_with(), is_colinear_with(), and TEST_F().

◆ is_colinear_with() [2/2]

bool Point::is_colinear_with ( const Segment &  s) const
inline

Checks if this point is collinear with a segment.

Parameters
sThe segment.
Returns
true if the point lies on the infinite line defined by the segment.

Definition at line 1466 of file point.H.

References is_colinear_with(), Aleph::Segment::src_, and Aleph::Segment::tgt_.

◆ is_inside() [1/2]

bool Point::is_inside ( const Ellipse &  e) const
inline

Checks if this point is contained within an ellipse.

Parameters
eThe ellipse to check against.
Returns
true if the point is inside or on the boundary of the ellipse.
See also
Ellipse::contains()

Definition at line 2430 of file point.H.

References Aleph::Ellipse::contains().

◆ is_inside() [2/2]

bool Point::is_inside ( const Segment &  s) const
inline

Checks if this point is contained within a segment.

Parameters
sThe segment to check against.
Returns
true if the point is on the segment.
See also
Segment::contains()

Definition at line 1460 of file point.H.

References Aleph::Segment::contains().

Referenced by Aleph::Polygon::add_vertex().

◆ is_left_of() [1/2]

bool Aleph::Point::is_left_of ( const Point &  p1,
const Point &  p2 
) const
inline

Checks if this point is to the left of the directed line from p1 to p2.

Parameters
p1The starting point of the line.
p2The ending point of the line.
Returns
true if the point is to the left.

Definition at line 486 of file point.H.

References Aleph::area_of_parallelogram().

Referenced by Aleph::Triangle::contains(), Aleph::CuttingEarsTriangulation::in_cone(), is_left_of(), Aleph::Segment::is_right_of(), is_right_on_of(), is_to_left_from(), and is_to_left_from().

◆ is_left_of() [2/2]

bool Point::is_left_of ( const Segment &  s) const
inline

Checks if this point is to the left of a directed segment.

Parameters
sThe segment.
Returns
true if the point is to the left.

Definition at line 1472 of file point.H.

References is_left_of(), Aleph::Segment::src_, and Aleph::Segment::tgt_.

◆ is_right_of()

bool Point::is_right_of ( const Segment &  s) const
inline

Checks if this point is to the right of a directed segment.

Parameters
sThe segment.
Returns
true if the point is to the right.

Definition at line 1478 of file point.H.

References Aleph::area_of_parallelogram(), Aleph::Segment::src_, and Aleph::Segment::tgt_.

Referenced by Aleph::Segment::is_left_of(), and is_to_right_from().

◆ is_right_on_of()

bool Aleph::Point::is_right_on_of ( const Point &  p1,
const Point &  p2 
) const
inline

Checks if this point is to the right of or on the line from p1 to p2.

Parameters
p1The starting point of the line.
p2The ending point of the line.
Returns
true if the point is not to the left.

Definition at line 526 of file point.H.

References Aleph::blossom_maximum_cardinality_matching(), and is_left_of().

Referenced by is_to_right_on_from().

◆ is_to_left_from() [1/2]

bool Aleph::Point::is_to_left_from ( const Point &  p1,
const Point &  p2 
) const
inline
Deprecated:
Use is_left_of() instead.

Definition at line 492 of file point.H.

References is_left_of().

◆ is_to_left_from() [2/2]

bool Aleph::Point::is_to_left_from ( const Segment &  s) const
inline
Deprecated:
Use is_left_of() instead.

Definition at line 564 of file point.H.

References is_left_of().

◆ is_to_left_on_from()

bool Aleph::Point::is_to_left_on_from ( const Point &  p1,
const Point &  p2 
) const
inline

Checks if this point is to the left of or on the line from p1 to p2.

Parameters
p1The starting point of the line.
p2The ending point of the line.
Returns
true if the point is not to the right.

Definition at line 515 of file point.H.

References Aleph::blossom_maximum_cardinality_matching(), and is_to_right_from().

Referenced by Aleph::CuttingEarsTriangulation::in_cone().

◆ is_to_right_from() [1/2]

bool Aleph::Point::is_to_right_from ( const Point &  p1,
const Point &  p2 
) const
inline

Checks if this point is to the right of the directed line from p1 to p2.

Parameters
p1The starting point of the line.
p2The ending point of the line.
Returns
true if the point is to the right.

Definition at line 504 of file point.H.

References Aleph::area_of_parallelogram().

Referenced by Aleph::Triangle::contains(), and is_to_left_on_from().

◆ is_to_right_from() [2/2]

bool Aleph::Point::is_to_right_from ( const Segment &  s) const
inline
Deprecated:
Use is_right_of() instead.

Definition at line 570 of file point.H.

References is_right_of().

◆ is_to_right_on_from()

bool Aleph::Point::is_to_right_on_from ( const Point &  p1,
const Point &  p2 
) const
inline
Deprecated:
Use is_right_on_of() instead.

Definition at line 532 of file point.H.

References is_right_on_of().

◆ leftmost_point()

const Point & Aleph::Point::leftmost_point ( ) const
inline

Returns the leftmost point (smallest x-coordinate).

For a Point, it's itself.

Returns
A const reference to itself.

Definition at line 697 of file point.H.

Referenced by TEST_F().

◆ lerp()

Point Aleph::Point::lerp ( const Point &  other,
const Geom_Number &  t 
) const
inline

Linear interpolation between this point and another.

Parameters
otherThe other point for interpolation.
tThe interpolation parameter, typically in [0, 1].
Returns
this * (1-t) + other * t.

Definition at line 428 of file point.H.

References Aleph::blossom_maximum_cardinality_matching().

Referenced by Aleph::Segment::at(), Aleph::Segment::get_perpendicular(), and midpoint().

◆ lowest_point()

const Point & Aleph::Point::lowest_point ( ) const
inline

Returns the lowest point (smallest y-coordinate).

For a Point, it's itself.

Returns
A const reference to itself.

Definition at line 688 of file point.H.

Referenced by TEST_F().

◆ midpoint()

Point Aleph::Point::midpoint ( const Point &  other) const
inline

Calculates the midpoint between this point and another.

Parameters
otherThe other point.
Returns
The midpoint, equivalent to lerp(other, 0.5).

Definition at line 439 of file point.H.

References Aleph::blossom_maximum_cardinality_matching(), and lerp().

Referenced by Aleph::MinimumEnclosingCircle::from_two_points().

◆ nearest_point()

const Point & Aleph::Point::nearest_point ( const Point &  p1,
const Point &  p2 
) const
inline

Returns which of the two points, p1 or p2, is nearer to this point.

Parameters
p1The first candidate point.
p2The second candidate point.
Returns
A const reference to the nearest point (p1 or p2).

Definition at line 607 of file point.H.

References distance_squared_to().

Referenced by arc_segment(), arc_trigon(), Aleph::Segment::nearest_point(), and TEST_F().

◆ norm()

Geom_Number Aleph::Point::norm ( ) const
inline

Euclidean norm (vector magnitude).

Returns
The square root of the sum of the squares of the coordinates.

Definition at line 393 of file point.H.

References Aleph::euclidean_distance(), x_, and y_.

Referenced by normalize().

◆ norm_squared()

Geom_Number Aleph::Point::norm_squared ( ) const
inline

Squared Euclidean norm.

Returns
The sum of the squares of the coordinates (x*x + y*y).
Note
This is more efficient than norm() if only needed for magnitude comparisons.

Definition at line 384 of file point.H.

References x_, and y_.

◆ normalize()

Point Aleph::Point::normalize ( ) const
inline

Returns a normalized copy of this vector (magnitude 1).

Returns
A new Point representing the unit vector.
Exceptions
std::domain_errorif normalizing the zero vector is attempted.

Definition at line 403 of file point.H.

References ah_domain_error_if, and norm().

Referenced by TEST_F().

◆ operator std::string()

Aleph::Point::operator std::string ( ) const
inline

Cast operator to std::string.

Returns
The result of to_string().

Definition at line 650 of file point.H.

References to_string().

◆ operator!=()

bool Aleph::Point::operator!= ( const Point &  point) const
inlinenoexcept

Checks for inequality between two points.

Parameters
pointThe other point to compare against.
Returns
true if either the x or y coordinate is different.

Definition at line 269 of file point.H.

References Aleph::blossom_maximum_cardinality_matching().

◆ operator*()

Point Aleph::Point::operator* ( const Geom_Number &  s) const
inline

Scalar multiplication.

Parameters
sThe scalar value to multiply by.
Returns
A new point with each coordinate multiplied by s.

Definition at line 344 of file point.H.

References x_, and y_.

◆ operator+()

Point Aleph::Point::operator+ ( const Point &  p) const
inline

Vector addition.

Parameters
pThe other point (vector) to add.
Returns
A new point representing the sum of the corresponding coordinates.

Definition at line 289 of file point.H.

References x_, and y_.

◆ operator+=()

Point & Aleph::Point::operator+= ( const Point &  p)
inline

Vector addition and assignment.

Parameters
pThe other point (vector) to add.
Returns
A reference to this modified point.

Definition at line 299 of file point.H.

References x_, and y_.

◆ operator-() [1/2]

Point Aleph::Point::operator- ( ) const
inline

Unary negation (vector inversion).

Returns
A new point with both coordinates negated.

Definition at line 334 of file point.H.

References x_, and y_.

◆ operator-() [2/2]

Point Aleph::Point::operator- ( const Point &  p) const
inline

Vector subtraction.

Parameters
pThe point (vector) to subtract.
Returns
A new point representing the difference of the coordinates.

Definition at line 312 of file point.H.

References x_, and y_.

◆ operator-=()

Point & Aleph::Point::operator-= ( const Point &  p)
inline

Vector subtraction and assignment.

Parameters
pThe point (vector) to subtract.
Returns
A reference to this modified point.

Definition at line 322 of file point.H.

References x_, and y_.

◆ operator/()

Point Aleph::Point::operator/ ( const Geom_Number &  s) const
inline

Scalar division.

Parameters
sThe scalar value to divide by.
Returns
A new point with each coordinate divided by s.

Definition at line 354 of file point.H.

References x_, and y_.

◆ operator<()

bool Aleph::Point::operator< ( const Point &  point) const
inlinenoexcept

Defines a strict lexicographical ordering for points.

Parameters
pointThe other point to compare against.
Returns
true if this point is less than point (first by x, then by y).

Definition at line 279 of file point.H.

References Aleph::and, Aleph::blossom_maximum_cardinality_matching(), x_, and y_.

◆ operator==()

bool Aleph::Point::operator== ( const Point &  point) const
inlinenoexcept

Checks for exact equality between two points.

Parameters
pointThe other point to compare against.
Returns
true if both x and y coordinates are identical, false otherwise.

Definition at line 259 of file point.H.

References Aleph::and, x_, and y_.

Referenced by TEST().

◆ rightmost_point()

const Point & Aleph::Point::rightmost_point ( ) const
inline

Returns the rightmost point (largest x-coordinate).

For a Point, it's itself.

Returns
A const reference to itself.

Definition at line 706 of file point.H.

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ rotate()

Point Aleph::Point::rotate ( const Geom_Number &  angle) const
inline

Rotates the point around the origin by a given angle.

Parameters
angleThe rotation angle in radians.
Returns
A new Point with the rotated coordinates.

Definition at line 415 of file point.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::cosinus(), Aleph::sinus(), x_, and y_.

Referenced by TEST_F(), and TEST_F().

◆ to_string()

Friends And Related Symbol Documentation

◆ Polar_Point

Definition at line 224 of file point.H.

◆ Segment

Definition at line 222 of file point.H.

◆ Triangle

Definition at line 223 of file point.H.

Member Data Documentation

◆ x_

◆ y_


The documentation for this class was generated from the following file: