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

Dedicated exact intersection for a single pair of segments. More...

#include <geom_algorithms.H>

Classes

struct  Result
 Detailed result of a segment-segment intersection test. More...
 

Public Types

enum class  Kind { NONE , POINT , OVERLAP }
 Types of intersection between two segments. More...
 

Public Member Functions

Result operator() (const Segment &s1, const Segment &s2) const
 Computes the intersection of two line segments.
 

Static Private Member Functions

static bool point_less_on_axis (const Point &a, const Point &b, const bool vertical_axis)
 
static Point point_max_on_axis (const Point &a, const Point &b, const bool vertical_axis)
 
static Point point_min_on_axis (const Point &a, const Point &b, const bool vertical_axis)
 
static Segment collinear_overlap (const Segment &s1, const Segment &s2)
 

Detailed Description

Dedicated exact intersection for a single pair of segments.

This utility solves the 2-segment case directly in constant time using exact predicates from point.H, instead of routing through a sweep-line structure meant for many segments.

Returned intersection kinds:

  • Kind::NONE: no intersection.
  • Kind::POINT: unique intersection point (proper cross, endpoint touch, or degenerate point-on-segment).
  • Kind::OVERLAP: collinear overlap interval (non-zero length).

Complexity

  • Time: O(1)
  • Space: O(1)

Definition at line 5572 of file geom_algorithms.H.

Member Enumeration Documentation

◆ Kind

Types of intersection between two segments.

Enumerator
NONE 

No intersection.

POINT 

Intersection at a single point.

OVERLAP 

Intersection over a collinear interval.

Definition at line 5578 of file geom_algorithms.H.

Member Function Documentation

◆ collinear_overlap()

static Segment Aleph::SegmentSegmentIntersection::collinear_overlap ( const Segment s1,
const Segment s2 
)
inlinestaticprivate

◆ operator()()

Result Aleph::SegmentSegmentIntersection::operator() ( const Segment s1,
const Segment s2 
) const
inline

Computes the intersection of two line segments.

Parameters
s1First segment.
s2Second segment.
Returns
Result structure with intersection type and details.

Definition at line 5659 of file geom_algorithms.H.

References collinear_overlap(), Aleph::divide_and_conquer_partition_dp(), Aleph::SegmentSegmentIntersection::Result::kind, OVERLAP, POINT, and Aleph::segments_intersect().

◆ point_less_on_axis()

static bool Aleph::SegmentSegmentIntersection::point_less_on_axis ( const Point a,
const Point b,
const bool  vertical_axis 
)
inlinestaticprivate

◆ point_max_on_axis()

static Point Aleph::SegmentSegmentIntersection::point_max_on_axis ( const Point a,
const Point b,
const bool  vertical_axis 
)
inlinestaticprivate

◆ point_min_on_axis()

static Point Aleph::SegmentSegmentIntersection::point_min_on_axis ( const Point a,
const Point b,
const bool  vertical_axis 
)
inlinestaticprivate

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