5#include "affine_matrix_2d.hpp"
6#include "matrix_2d.hpp"
47 CExports::CoordinateMapTransformArea(*
reinterpret_cast<CExports::TArea *
>(&area),
48 *
reinterpret_cast<CExports::TCoordinateMap *
>(&affineMatrix),
49 reinterpret_cast<CExports::TArea &
>(*
this));
62 Area2D(
double x0,
double y0,
double x1,
double y1,
double x2,
double y2) noexcept
73 :
Area2D(rect.Left(), rect.Top(), rect.Right(), rect.Top(), rect.Left(), rect.Bottom())
82 Area2D(
double radius) noexcept :
Area2D(-radius, -radius, -radius, radius, radius, -radius) {}
141 ExpandBBByPoint(bb, p1_);
142 ExpandBBByPoint(bb, p2_);
143 ExpandBBByPoint(bb,
P3());
155 auto vP0P2 = p2_ - p0_;
156 auto vP0P1 = p1_ - p0_;
169 auto vP0P2 = p2_ - p0_;
170 auto vP0P1 = p1_ - p0_;
171 return abs(vP0P2.X() * vP0P1.Y() - vP0P2.Y() * vP0P1.X());
193 p0_ = affineMatrix * p0_;
194 p1_ = affineMatrix * p1_;
195 p2_ = affineMatrix * p2_;
224 bool operator==(
const Area2D &area)
const noexcept {
return p0_ == area.p0_ && p1_ == area.p1_ && p2_ == area.p2_; }
237 if (p.
X() < bb.
Left())
239 else if (p.
X() > bb.
Right())
241 if (p.
Y() < bb.
Top())
Compacted affine matrix describing the Common Vision Blox coordinate system.
Definition: affine_matrix_2d.hpp:18
Structure that represents an area of interest in the image.
Definition: area_2d.hpp:21
Point2D< double > P2() const noexcept
Gets P2 of the area (top right corner).
Definition: area_2d.hpp:117
void SetP2(Point2D< double > p2) noexcept
Sets P2 of the area (top right corner).
Definition: area_2d.hpp:124
Point2D< double > P0() const noexcept
Gets P0 of the area (top left corner).
Definition: area_2d.hpp:89
double Area() const noexcept
Size (in pixels) of the area of interest.
Definition: area_2d.hpp:167
void Transform(AffineMatrix2D affineMatrix) noexcept
Transform this Area2D using a AffineMatrix2D.
Definition: area_2d.hpp:191
Area2D(double radius) noexcept
Constructor for Area2D.
Definition: area_2d.hpp:82
void Transform(Matrix2D matrix) noexcept
Transform this Area2D using a matrix.
Definition: area_2d.hpp:179
bool operator==(const Area2D &area) const noexcept
Compares to an other area.
Definition: area_2d.hpp:224
Point2D< double > P3() const noexcept
Gets the calculated P3 of the area (lower right corner).
Definition: area_2d.hpp:131
void SetP1(Point2D< double > p1) noexcept
Sets P1 of the area (lower left corner).
Definition: area_2d.hpp:110
bool operator!=(const Area2D &area) const noexcept
Compares to an other area.
Definition: area_2d.hpp:232
Area2D(Rect< double > rect, AffineMatrix2D affineMatrix) noexcept
Creates an area from the given rectangle using a transformation.
Definition: area_2d.hpp:44
Area2D(double x0, double y0, double x1, double y1, double x2, double y2) noexcept
Constructor for Area2D.
Definition: area_2d.hpp:62
Area2D() noexcept=default
Default constructor for an empty area.
void SetP0(Point2D< double > p0) noexcept
Sets P0 of the area (top left corner).
Definition: area_2d.hpp:96
CoordinateSystemType CoordinateSystem() const noexcept
Indicates the coordinate system, in which this object is being measured (when used as an area of inte...
Definition: area_2d.hpp:216
Area2D(Rect< double > rect) noexcept
Create an area from the given rectangle.
Definition: area_2d.hpp:72
Rect< double > BoundingRectangle() const noexcept
Gets the bounding box of this area.
Definition: area_2d.hpp:138
Size2D< double > Size() const noexcept
Size (width and height) of the area of interest.
Definition: area_2d.hpp:153
void SwapOrientation() noexcept
Let the vertices P1 and P2 swap their place.
Definition: area_2d.hpp:204
Point2D< double > P1() const noexcept
Gets P1 of the area (lower left corner).
Definition: area_2d.hpp:103
Double precision 2x2 matrix class.
Definition: matrix_2d.hpp:16
Multi-purpose 2D vector class.
Definition: point_2d.hpp:20
T X() const noexcept
Gets the x-component of the point.
Definition: point_2d.hpp:86
T Y() const noexcept
Gets the y-component of the point.
Definition: point_2d.hpp:106
Rectangle object.
Definition: rect.hpp:26
T Bottom() const noexcept
Gets bottom row of the rectangle (still inside the rectangle).
Definition: rect.hpp:151
void SetRight(T right) noexcept
Sets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:141
void SetBottom(T bottom) noexcept
Sets bottom row of the rectangle (still inside the rectangle).
Definition: rect.hpp:161
void SetLeft(T left) noexcept
Sets first column of the rectangle.
Definition: rect.hpp:101
T Top() const noexcept
Gets first row of the rectangle.
Definition: rect.hpp:111
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:131
T Left() const noexcept
Gets first column of the rectangle.
Definition: rect.hpp:91
void SetTop(T top) noexcept
Sets first row of the rectangle.
Definition: rect.hpp:121
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
CoordinateSystemType
Enumeration of the different available coordinate systems that an Area of interest may be defined in.
Definition: global.hpp:264