codac 2.0.0
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{
20 class ConvexPolygon;
27 class Segment : public std::array<IntervalVector,2>
28 {
29 public:
30
36 Segment(const std::array<IntervalVector,2>& x);
37
44 Segment(const IntervalVector& x1, const IntervalVector& x2);
45
51 IntervalVector box() const;
52
60
67 BoolInterval contains(const IntervalVector& p) const;
68
77 bool operator==(const Segment& p) const;
78 };
79
91 IntervalVector operator&(const Segment& e1, const Segment& e2);
92
93 Segment operator&(const Segment& e1, const ConvexPolygon& p2);
94
110 IntervalVector proj_intersection(const Segment& e1, const Segment& e2);
111
119 BoolInterval colinear(const Segment& e1, const Segment& e2);
120
128 std::ostream& operator<<(std::ostream& str, const Segment& e);
129}
Represents a convex polygon defined by vertices enclosed in IntervalVectors.
Definition codac2_ConvexPolygon.h:25
Represents a geometric segment defined by two points enclosed in IntervalVectors.
Definition codac2_Segment.h:28
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.