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.
 
Pointoperator+= (const Point &p)
 Vector addition and assignment.
 
Point operator- (const Point &p) const
 Vector subtraction.
 
Pointoperator-= (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_Numberget_x () const noexcept
 Gets the x-coordinate value.
 
const Geom_Numberget_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 Pointnearest_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 Pointhighest_point () const
 Returns the highest point (largest y-coordinate).
 
const Pointlowest_point () const
 Returns the lowest point (smallest y-coordinate).
 
const Pointleftmost_point () const
 Returns the leftmost point (smallest x-coordinate).
 
const Pointrightmost_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 228 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 242 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 251 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 811 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 383 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 1463 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 679 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 373 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 457 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::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::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(), 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 466 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::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::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(), 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 688 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 2366 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 599 of file point.H.

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

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

◆ 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 553 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 1447 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 477 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 1429 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 2360 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 1423 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 495 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 1435 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 1441 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 535 of file point.H.

References Aleph::divide_and_conquer_partition_dp(), 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 502 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 574 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 524 of file point.H.

References Aleph::divide_and_conquer_partition_dp(), 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 513 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 581 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 542 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 700 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 437 of file point.H.

References Aleph::divide_and_conquer_partition_dp().

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 694 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 448 of file point.H.

References Aleph::divide_and_conquer_partition_dp(), 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 618 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 402 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 393 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 412 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 661 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 278 of file point.H.

References Aleph::divide_and_conquer_partition_dp().

◆ 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 353 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 298 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 308 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 343 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 321 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 331 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 363 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 288 of file point.H.

References Aleph::and, Aleph::divide_and_conquer_partition_dp(), 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 268 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 424 of file point.H.

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

Referenced by TEST_F(), and TEST_F().

◆ to_string()

Friends And Related Symbol Documentation

◆ Polar_Point

Definition at line 232 of file point.H.

◆ Segment

Definition at line 230 of file point.H.

◆ Triangle

Definition at line 231 of file point.H.

Member Data Documentation

◆ x_

◆ y_


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