|
Mantid
|
A ConvexPolygon with only 4 vertices. More...
#include <Quadrilateral.h>
Public Member Functions | |
| double | area () const override |
| Compute the area of the polygon using triangulation. More... | |
| const Kernel::V2D & | at (const size_t index) const override |
| Bounds-checked index access. More... | |
| bool | contains (const ConvexPolygon &poly) const override |
| Is a the given polygon completely encosed by this one. More... | |
| bool | contains (const Kernel::V2D &point) const override |
| Is a point inside this polygon. More... | |
| 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 N=number of vertices. More... | |
| double | maxX () const override |
| Return the max X value in the polygon. More... | |
| double | maxY () const override |
| Return the max Y value in the polygon. More... | |
| double | minX () const override |
| Return the lowest X value in the polygon. More... | |
| double | minY () const override |
| Return the lowest Y value in the polygon. More... | |
| size_t | npoints () const override |
| Return the number of vertices. More... | |
| Quadrilateral & | operator= (const Quadrilateral &)=default |
| Quadrilateral & | operator= (Quadrilateral &&)=default |
| const Kernel::V2D & | operator[] (const size_t index) const override |
| Index access. More... | |
| Quadrilateral (const double lowerX, const double upperX, const double lowerY, const double upperY) | |
| Special constructor for a rectangle. More... | |
| Quadrilateral (const Kernel::V2D &lowerLeft, const Kernel::V2D &lowerRight, const Kernel::V2D &upperRight, const Kernel::V2D &upperLeft) | |
| Constructor with the four vertices. More... | |
| Quadrilateral (const Quadrilateral &)=default | |
| Quadrilateral (Quadrilateral &&)=default | |
| virtual void | shiftVertexesClockwise () |
| Shifts the vertexes in a clockwise manner. More... | |
| ConvexPolygon | toPoly () const override |
| Return a new Polygon based on the current Quadrilateral. More... | |
Public Member Functions inherited from Mantid::Geometry::ConvexPolygon | |
| virtual double | area () const |
| Compute the area of the polygon using triangulation. More... | |
| virtual const Kernel::V2D & | at (const size_t index) const |
| Bounds-checked index access. More... | |
| void | clear () |
| Clears all points. More... | |
| virtual bool | contains (const ConvexPolygon &poly) const |
| Is a the given polygon completely encosed by this one. More... | |
| virtual bool | contains (const Kernel::V2D &point) const |
| Is a point inside this polygon. More... | |
| ConvexPolygon () | |
| Default constructor. More... | |
| ConvexPolygon (const ConvexPolygon &)=default | |
| ConvexPolygon (ConvexPolygon &&)=default | |
| ConvexPolygon (Vertices vertices) | |
| Construct a polygon from a collection of points. More... | |
| virtual double | determinant () const |
| Compute the 'determinant' of the points. More... | |
| void | insert (const Kernel::V2D &pt) |
| Insert a new vertex. More... | |
| void | insert (double x, double y) |
| Insert a new vertex based on x,y values. More... | |
| bool | isValid () const |
| Check if polygon is valid. More... | |
| virtual double | maxX () const |
| Return the largest X value in the polygon. More... | |
| virtual double | maxY () const |
| Return the largest Y value in the polygon. More... | |
| virtual double | minX () const |
| Return the lowest X value in the polygon. More... | |
| virtual double | minY () const |
| Return the lowest Y value in the polygon. More... | |
| virtual size_t | npoints () const |
| Return the number of vertices. More... | |
| ConvexPolygon & | operator= (const ConvexPolygon &)=default |
| ConvexPolygon & | operator= (ConvexPolygon &&)=default |
| virtual const Kernel::V2D & | operator[] (const size_t index) const |
| Index access. More... | |
| virtual ConvexPolygon | toPoly () const |
| Return a new Polygon based on the current type. More... | |
| virtual | ~ConvexPolygon ()=default |
| Destructor. More... | |
Private Member Functions | |
| const Kernel::V2D & | lowerLeft () const |
| const Kernel::V2D & | lowerRight () const |
| const Kernel::V2D & | upperLeft () const |
| const Kernel::V2D & | upperRight () const |
Private Attributes | |
| std::array< Kernel::V2D, 4 > | m_vertices |
Additional Inherited Members | |
Public Types inherited from Mantid::Geometry::ConvexPolygon | |
| using | Vertices = std::vector< Kernel::V2D > |
| Type of the point list. More... | |
A ConvexPolygon with only 4 vertices.
Better performance as no dynamic allocation
Definition at line 24 of file Quadrilateral.h.
| Mantid::Geometry::Quadrilateral::Quadrilateral | ( | const Kernel::V2D & | lowerLeft, |
| const Kernel::V2D & | lowerRight, | ||
| const Kernel::V2D & | upperRight, | ||
| const Kernel::V2D & | upperLeft | ||
| ) |
Constructor with the four vertices.
Constructor.
Definition at line 19 of file Quadrilateral.cpp.
References lowerLeft(), lowerRight(), upperLeft(), and upperRight().
| Mantid::Geometry::Quadrilateral::Quadrilateral | ( | const double | lowerX, |
| const double | upperX, | ||
| const double | lowerY, | ||
| const double | upperY | ||
| ) |
Special constructor for a rectangle.
Definition at line 25 of file Quadrilateral.cpp.
|
default |
|
default |
|
inlineoverridevirtual |
Compute the area of the polygon using triangulation.
As this is a convex polygon the calculation is exact. The algorithm uses one vertex as a common vertex and sums the areas of the triangles formed by this and two other vertices, moving in an anti-clockwise direction.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 53 of file Quadrilateral.h.
References rhs, Mantid::Kernel::V2D::X(), and Mantid::Kernel::V2D::Y().
Referenced by Mantid::DataObjects::FractionalRebinning::rebinToFractionalOutput(), and Mantid::DataObjects::FractionalRebinning::rebinToOutput().
|
overridevirtual |
Bounds-checked index access.
Return the vertex at the given index.
| index | :: An index, starting at 0 |
| Exception::IndexError | if the index is out of range |
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 35 of file Quadrilateral.cpp.
References index, and npoints().
Referenced by Mantid::DataObjects::CalculateReflectometryKiKf::createQuad(), Mantid::DataObjects::CalculateReflectometryP::createQuad(), and Mantid::DataObjects::CalculateReflectometryQxQz::createQuad().
|
overridevirtual |
Is a the given polygon completely encosed by this one.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 52 of file Quadrilateral.cpp.
References Mantid::Geometry::ConvexPolygon::contains(), and toPoly().
|
overridevirtual |
Is a point inside this polygon.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 44 of file Quadrilateral.cpp.
References Mantid::Geometry::ConvexPolygon::contains(), and toPoly().
|
inlineoverridevirtual |
Compute the determinant of the set of points as if they were contained in an (N+1)x(N+1) matrix where N=number of vertices.
Each row contains the [X,Y] values of the vertex padded with zeroes to the column length.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 67 of file Quadrilateral.h.
|
inlineprivate |
Definition at line 82 of file Quadrilateral.h.
Referenced by Quadrilateral(), and toPoly().
|
inlineprivate |
Definition at line 85 of file Quadrilateral.h.
Referenced by Quadrilateral(), and toPoly().
|
inlineoverridevirtual |
Return the max X value in the polygon.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 71 of file Quadrilateral.h.
References Mantid::Geometry::X.
Referenced by Mantid::DataObjects::FractionalRebinning::calcRectangleIntersections(), and Mantid::DataObjects::FractionalRebinning::getIntersectionRegion().
|
inlineoverridevirtual |
Return the max Y value in the polygon.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 75 of file Quadrilateral.h.
References Mantid::Geometry::Y.
Referenced by Mantid::DataObjects::FractionalRebinning::calcRectangleIntersections(), and Mantid::DataObjects::FractionalRebinning::getIntersectionRegion().
|
inlineoverridevirtual |
Return the lowest X value in the polygon.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 69 of file Quadrilateral.h.
References Mantid::Geometry::X.
Referenced by Mantid::DataObjects::FractionalRebinning::calcRectangleIntersections(), and Mantid::DataObjects::FractionalRebinning::getIntersectionRegion().
|
inlineoverridevirtual |
Return the lowest Y value in the polygon.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 73 of file Quadrilateral.h.
References Mantid::Geometry::Y.
Referenced by Mantid::DataObjects::FractionalRebinning::calcRectangleIntersections(), and Mantid::DataObjects::FractionalRebinning::getIntersectionRegion().
|
inlineoverridevirtual |
Return the number of vertices.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 41 of file Quadrilateral.h.
Referenced by at().
|
default |
|
default |
|
inlineoverridevirtual |
Index access.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 37 of file Quadrilateral.h.
References index.
|
virtual |
Shifts the vertexes in a clockwise manner.
Definition at line 68 of file Quadrilateral.cpp.
References m_vertices.
Referenced by Mantid::DataObjects::CalculateReflectometryKiKf::createQuad(), Mantid::DataObjects::CalculateReflectometryP::createQuad(), and Mantid::DataObjects::CalculateReflectometryQxQz::createQuad().
|
overridevirtual |
Return a new Polygon based on the current Quadrilateral.
Reimplemented from Mantid::Geometry::ConvexPolygon.
Definition at line 58 of file Quadrilateral.cpp.
References Mantid::Geometry::ConvexPolygon::ConvexPolygon(), lowerLeft(), lowerRight(), upperLeft(), and upperRight().
Referenced by contains().
|
inlineprivate |
Definition at line 83 of file Quadrilateral.h.
Referenced by Quadrilateral(), and toPoly().
|
inlineprivate |
Definition at line 84 of file Quadrilateral.h.
Referenced by Quadrilateral(), and toPoly().
|
private |
Definition at line 88 of file Quadrilateral.h.
Referenced by shiftVertexesClockwise().