30 Quadrilateral(
const double lowerX,
const double upperX,
const double lowerY,
const double upperY);
41 inline size_t npoints()
const override {
return 4; }
43 bool contains(
const Kernel::V2D &point)
const override;
53 inline double area()
const override {
54 const double lhs = lowerLeft().
Y() * upperLeft().
X() + upperLeft().
Y() * upperRight().
X() +
55 upperRight().
Y() * lowerRight().
X() + lowerRight().
Y() * lowerLeft().
X();
56 const double rhs = lowerLeft().
X() * upperLeft().
Y() + upperLeft().
X() * upperRight().
Y() +
57 upperRight().
X() * lowerRight().
Y() + lowerRight().
X() * lowerLeft().
Y();
58 return 0.5 * (lhs -
rhs);
67 inline double determinant()
const override {
return 2.0 * area(); }
69 inline double minX()
const override {
return std::min(lowerLeft().
X(), upperLeft().
X()); }
71 inline double maxX()
const override {
return std::max(lowerRight().
X(), upperRight().
X()); }
73 inline double minY()
const override {
return std::min(lowerLeft().
Y(), lowerRight().
Y()); }
75 inline double maxY()
const override {
return std::max(upperLeft().
Y(), upperRight().
Y()); }
79 virtual void shiftVertexesClockwise();
const std::vector< double > & rhs
std::map< DeltaEMode::Type, std::string > index
An implementation of a convex polygon.
A ConvexPolygon with only 4 vertices.
Quadrilateral & operator=(const Quadrilateral &)=default
const Kernel::V2D & lowerRight() const
Quadrilateral(const Quadrilateral &)=default
const Kernel::V2D & upperLeft() const
const Kernel::V2D & operator[](const size_t index) const override
Index access.
double area() const override
Compute the area of the polygon using triangulation.
double minX() const override
Return the lowest X value in the polygon.
std::array< Kernel::V2D, 4 > m_vertices
const Kernel::V2D & upperRight() const
Quadrilateral & operator=(Quadrilateral &&)=default
size_t npoints() const override
Return the number of vertices.
double maxX() const override
Return the max X value in the polygon.
double minY() const override
Return the lowest Y value in the polygon.
double maxY() const override
Return the max Y value in the polygon.
Quadrilateral(Quadrilateral &&)=default
const Kernel::V2D & lowerLeft() const
double determinant() const override
Compute the determinant of the set of points as if they were contained in an (N+1)x(N+1) matrix where...
Implements a 2-dimensional vector embedded in a 3D space, i.e.
double Y() const
Y position.
double X() const
X position.
Helper class which provides the Collimation Length for SANS instruments.