codac 1.5.6
Loading...
Searching...
No Matches
codac2::Segment Class Reference

Represents a geometric segment defined by two points enclosed in IntervalVectors. More...

#include <codac2_Segment.h>

Public Member Functions

 Segment (const std::array< IntervalVector, 2 > &x)
 Constructs a Segment from an array of two IntervalVectors.
 
 Segment (const IntervalVector &x1, const IntervalVector &x2)
 Constructs a Segment from two IntervalVectors.
 
IntervalVector box () const
 Computes the bounding box of the segment.
 
BoolInterval intersects (const Segment &e) const
 Checks whether the segment intersects with another segment.
 
BoolInterval contains (const IntervalVector &p) const
 Checks whether the segment contains a given point.
 
bool operator== (const Segment &p) const
 Comparison operator.
 

Detailed Description

Represents a geometric segment defined by two points enclosed in IntervalVectors.

Inherits from std::array<IntervalVector, 2>.

Constructor & Destructor Documentation

◆ Segment() [1/2]

codac2::Segment::Segment ( const std::array< IntervalVector, 2 > & x)

Constructs a Segment from an array of two IntervalVectors.

Parameters
xAn array of two IntervalVectors enclosing the segment endpoints.

◆ Segment() [2/2]

codac2::Segment::Segment ( const IntervalVector & x1,
const IntervalVector & x2 )

Constructs a Segment from two IntervalVectors.

Parameters
x1The first endpoint \(\mathbf{x}_1\) of the segment.
x2The second endpoint \(\mathbf{x}_2\) of the segment.

Member Function Documentation

◆ box()

IntervalVector codac2::Segment::box ( ) const

Computes the bounding box of the segment.

Returns
The IntervalVector hull box.

◆ intersects()

BoolInterval codac2::Segment::intersects ( const Segment & e) const

Checks whether the segment intersects with another segment.

Parameters
eAnother segment.
Returns
A BoolInterval indicating possible intersection.

◆ contains()

BoolInterval codac2::Segment::contains ( const IntervalVector & p) const

Checks whether the segment contains a given point.

Parameters
pThe point to check, enclosed in a IntervalVector.
Returns
A BoolInterval indicating possible containment.

◆ operator==()

bool codac2::Segment::operator== ( const Segment & p) const

Comparison operator.

Equality means that boxes enclosing the endpoints are strictly equal.

Parameters
pAnother segment.
Returns
True if both segments are equal.

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