#include <Polygon.h>
inet::Polygon::Polygon |
( |
| ) |
|
|
inline |
inet::Polygon::Polygon |
( |
const std::vector< Coord > & |
points | ) |
|
27 throw cRuntimeError(
"A Euclidean polygon has at least three points");
std::vector< Coord > points
Definition: Polygon.h:33
bool inet::Polygon::computeIntersection |
( |
const LineSegment & |
lineSegment, |
|
|
Coord & |
intersection1, |
|
|
Coord & |
intersection2, |
|
|
Coord & |
normal1, |
|
|
Coord & |
normal2 |
|
) |
| const |
|
virtual |
86 Coord p0 = lineSegment.getPoint1();
87 Coord p1 = lineSegment.getPoint2();
93 Coord segmentDirection = p1 - p0;
97 if (polygonNormal * segmentDirection != 0 || (p0 -
points[0]) * polygonNormal != 0)
101 unsigned int pointSize =
points.size();
102 for (
unsigned int i = 0; i < pointSize; i++)
105 double N = normalVec * (
points[i] - p0);
106 double D = normalVec * segmentDirection;
139 intersection1 = p0 + segmentDirection * tE;
140 intersection2 = p0 + segmentDirection * tL;
141 if (intersection1 == intersection2)
static const Coord NIL
Constant with all values set to 0.
Definition: Coord.h:40
Coord getEdgeOutwardNormalVector(const Coord &edgeP1, const Coord &edgeP2) const
Definition: Polygon.cc:71
compose< m, compose< kg, pow< s,-2 > > > N
Definition: Units.h:767
Coord getNormalUnitVector() const
Definition: Polygon.cc:40
std::vector< Coord > points
Definition: Polygon.h:33
Coord inet::Polygon::computeSize |
( |
| ) |
const |
|
virtual |
64 for (
const auto & elem :
points) {
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SCTPAssociation.h:270
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
std::vector< Coord > points
Definition: Polygon.h:33
Coord inet::Polygon::getEdgeOutwardNormalVector |
( |
const Coord & |
edgeP1, |
|
|
const Coord & |
edgeP2 |
|
) |
| const |
|
protected |
Referenced by computeIntersection().
74 Coord vectorA = edgeP1 - polygonNormal;
75 Coord vectorB = edgeP2 - polygonNormal;
76 Coord vectorC(vectorA.y * vectorB.z - vectorA.z * vectorB.y,
77 vectorA.z * vectorB.x - vectorA.x * vectorB.z,
78 vectorA.x * vectorB.y - vectorA.y * vectorB.x);
80 return vectorC - polygonNormal * (vectorC * polygonNormal);
Coord getNormalUnitVector() const
Definition: Polygon.cc:40
Coord inet::Polygon::getNormalUnitVector |
( |
| ) |
const |
Coord inet::Polygon::getNormalVector |
( |
| ) |
const |
Referenced by inet::Prism::computeOutwardNormalVector(), and getNormalUnitVector().
52 Coord vectorA = point2 - point1;
53 Coord vectorB = point3 - point1;
54 Coord vectorC(vectorA.y * vectorB.z - vectorA.z * vectorB.y,
55 vectorA.z * vectorB.x - vectorA.x * vectorB.z,
56 vectorA.x * vectorB.y - vectorA.y * vectorB.x);
std::vector< Coord > points
Definition: Polygon.h:33
const std::vector<Coord>& inet::Polygon::getPoints |
( |
| ) |
const |
|
inline |
virtual bool inet::Polygon::isNil |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns true if this geometric object is the same as the unspecified singleton instance of this type.
Implements inet::GeometricObjectBase.
44 {
return this == &
NIL; }
static const Polygon NIL
Definition: Polygon.h:30
bool inet::Polygon::isUnspecified |
( |
| ) |
const |
|
overridevirtual |
Returns true if this geometric object is not completely specified.
Implements inet::GeometricObjectBase.
33 for (
const auto & elem :
points) {
std::vector< Coord > points
Definition: Polygon.h:33
virtual bool isUnspecified() const override
Returns true if this geometric object is not completely specified.
Definition: Polygon.cc:31
std::vector<Coord> inet::Polygon::points |
|
protected |
The documentation for this class was generated from the following files: