codac 1.5.6
Loading...
Searching...
No Matches
codac2_Segment.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <vector>
13#include <utility>
14#include "codac2_Vector.h"
15#include "codac2_BoolInterval.h"
17
18namespace codac2
19{
26 class Segment : public std::array<IntervalVector,2>
27 {
28 public:
29
35 Segment(const std::array<IntervalVector,2>& x);
36
43 Segment(const IntervalVector& x1, const IntervalVector& x2);
44
50 IntervalVector box() const;
51
59
66 BoolInterval contains(const IntervalVector& p) const;
67
76 bool operator==(const Segment& p) const;
77 };
78
90 IntervalVector operator&(const Segment& e1, const Segment& e2);
91
107 IntervalVector proj_intersection(const Segment& e1, const Segment& e2);
108
116 BoolInterval colinear(const Segment& e1, const Segment& e2);
117
125 std::ostream& operator<<(std::ostream& str, const Segment& e);
126}
Represents a geometric segment defined by two points enclosed in IntervalVectors.
Definition codac2_Segment.h:27
BoolInterval intersects(const Segment &e) const
Checks whether the segment intersects with another segment.
bool operator==(const Segment &p) const
Comparison operator.
Segment(const IntervalVector &x1, const IntervalVector &x2)
Constructs a Segment from two IntervalVectors.
Segment(const std::array< IntervalVector, 2 > &x)
Constructs a Segment from an array of two IntervalVectors.
IntervalVector box() const
Computes the bounding box of the segment.
BoolInterval contains(const IntervalVector &p) const
Checks whether the segment contains a given point.
std::ostream & operator<<(std::ostream &os, const BoolInterval &x)
Streams out a BoolInterval.
Definition codac2_BoolInterval.h:45
BoolInterval
Enumeration representing a boolean interval.
Definition codac2_BoolInterval.h:23
IntervalVector proj_intersection(const Segment &e1, const Segment &e2)
Computes the projected intersection of two segments.
BoolInterval colinear(const Segment &e1, const Segment &e2)
Checks if two segments are colinear.