codac 1.5.6
Loading...
Searching...
No Matches
codac2_Segment.h File Reference
#include <vector>
#include <utility>
#include "codac2_Vector.h"
#include "codac2_BoolInterval.h"
#include "codac2_IntervalVector.h"
Include dependency graph for codac2_Segment.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  codac2::Segment
 Represents a geometric segment defined by two points enclosed in IntervalVectors. More...
 

Functions

IntervalVector codac2::operator& (const Segment &e1, const Segment &e2)
 Computes the intersection of two segments.
 
IntervalVector codac2::proj_intersection (const Segment &e1, const Segment &e2)
 Computes the projected intersection of two segments.
 
BoolInterval codac2::colinear (const Segment &e1, const Segment &e2)
 Checks if two segments are colinear.
 
std::ostream & codac2::operator<< (std::ostream &str, const Segment &e)
 Stream output operator for Segment.
 

Detailed Description

Date
2025
Author
Simon Rohou
License: GNU Lesser General Public License (LGPL)

Function Documentation

◆ operator&()

IntervalVector codac2::operator& ( const Segment & e1,
const Segment & e2 )

Computes the intersection of two segments.

If the segments do not intersect, an empty IntervalVector is returned. If the segments are colinear, the set of intersection points is returned as a box.

Parameters
e1The first segment.
e2The second segment.
Returns
An IntervalVector enclosing the intersection point.

◆ proj_intersection()

IntervalVector codac2::proj_intersection ( const Segment & e1,
const Segment & e2 )

Computes the projected intersection of two segments.

This corresponds to the intersection of the two lines related to the two segments. Therefore, the intersection point may not belong to the segments.

If the segments are parallel but not colinear, an empty IntervalVector is returned. If the segments are colinear, the set of intersection points is returned as a box.

Parameters
e1The first segment.
e2The second segment.
Returns
An IntervalVector enclosing the intersection point.

◆ colinear()

BoolInterval codac2::colinear ( const Segment & e1,
const Segment & e2 )

Checks if two segments are colinear.

Parameters
e1The first segment.
e2The second segment.
Returns
A BoolInterval indicating possible colinearity.

◆ operator<<()

std::ostream & codac2::operator<< ( std::ostream & str,
const Segment & e )

Stream output operator for Segment.

Parameters
strOutput stream.
eThe segment to print.
Returns
The output stream with the segment information.