homog2d library
|
Namespaces | |
base | |
Holds base classes, not part of API. | |
detail | |
This namespace holds some private stuff, types here are not to be used directly by end-user code. | |
err | |
Holds static counters, for runtime errors and warnings. | |
fct | |
Holds functors, used to manage runtime polymorphism using std::variant . See https://github.com/skramm/homog2d/blob/master/docs/homog2d_manual.md#section_rtp. | |
img | |
Holds drawing related code, independent of back-end library. | |
ppair | |
Holds free functions returning a pair of points. | |
priv | |
Holds private stuff. | |
rtp | |
Holds pointer-based runtime polymorphism stuff. | |
svg | |
Holds stuff related to SVG import. | |
thr | |
Holds threshold values and api to access these. | |
trait | |
Holds traits classes. | |
typ | |
Holds the types needed for policy based design. | |
Classes | |
class | Circle_ |
A circle. More... | |
class | Ellipse_ |
Ellipse as a conic in matrix form. More... | |
class | FRect_ |
A Flat Rectangle, modeled by its two opposite points. More... | |
class | Hmatrix_ |
A 2D homography, defining a planar transformation. More... | |
struct | OffsetPolyParams |
Parameters for base::PolylineBase::getOffsetPoly() More... | |
Typedefs | |
using | Circle = Circle_< HOMOG2D_INUMTYPE > |
Default circle type. More... | |
using | CircleD = Circle_< double > |
using | CircleF = Circle_< float > |
using | CircleL = Circle_< long double > |
using | CommonType = CommonType_< HOMOG2D_INUMTYPE > |
template<typename FPT > | |
using | CommonType_ = std::variant< Segment_< FPT >, OSegment_< FPT >, Point2d_< FPT >, Line2d_< FPT >, Circle_< FPT >, Ellipse_< FPT >, FRect_< FPT >, CPolyline_< FPT >, OPolyline_< FPT > > |
A variant type, holding all possible types. Used to achieve runtime polymorphism. More... | |
using | CommonTypeD = CommonType_< double > |
using | CommonTypeF = CommonType_< float > |
using | CommonTypeL = CommonType_< long double > |
using | CPolyline = CPolyline_< HOMOG2D_INUMTYPE > |
Default polyline type. More... | |
template<typename T > | |
using | CPolyline_ = base::PolylineBase< typ::IsClosed, T > |
using | CPolylineD = CPolyline_< double > |
using | CPolylineF = CPolyline_< float > |
using | CPolylineL = CPolyline_< long double > |
using | Ellipse = Ellipse_< HOMOG2D_INUMTYPE > |
Default ellipse type. More... | |
using | EllipseD = Ellipse_< double > |
using | EllipseF = Ellipse_< float > |
using | EllipseL = Ellipse_< long double > |
using | Epipmat = Hmatrix_< typ::IsEpipmat, HOMOG2D_INUMTYPE > |
Default homogeneous matrix, uses double as numerical type. More... | |
using | FRect = FRect_< HOMOG2D_INUMTYPE > |
Default rectangle type. More... | |
using | FRectD = FRect_< double > |
using | FRectF = FRect_< float > |
using | FRectL = FRect_< long double > |
using | Homogr = Homogr_< HOMOG2D_INUMTYPE > |
Default homography (3x3 matrix) type, uses double as numerical type. More... | |
template<typename T > | |
using | Homogr_ = Hmatrix_< typ::IsHomogr, T > |
using | HomogrD = Homogr_< double > |
using | HomogrF = Homogr_< float > |
using | HomogrL = Homogr_< long double > |
using | Line2d = Line2d_< HOMOG2D_INUMTYPE > |
Default line type, uses double as numerical type. More... | |
template<typename T > | |
using | Line2d_ = base::LPBase< typ::IsLine, T > |
using | Line2dD = Line2d_< double > |
using | Line2dF = Line2d_< float > |
using | Line2dL = Line2d_< long double > |
using | OPolyline = OPolyline_< HOMOG2D_INUMTYPE > |
template<typename T > | |
using | OPolyline_ = base::PolylineBase< typ::IsOpen, T > |
using | OPolylineD = OPolyline_< double > |
using | OPolylineF = OPolyline_< float > |
using | OPolylineL = OPolyline_< long double > |
using | OSegment = OSegment_< HOMOG2D_INUMTYPE > |
template<typename T > | |
using | OSegment_ = base::SegVec< typ::IsOSeg, T > |
using | OSegmentD = OSegment_< double > |
using | OSegmentF = OSegment_< float > |
using | OSegmentL = OSegment_< long double > |
using | Point2d = Point2d_< HOMOG2D_INUMTYPE > |
Default point type, uses double as numerical type. More... | |
template<typename T > | |
using | Point2d_ = base::LPBase< typ::IsPoint, T > |
using | Point2dD = Point2d_< double > |
using | Point2dF = Point2d_< float > |
using | Point2dL = Point2d_< long double > |
using | PointPair = PointPair_< double > |
template<typename T1 , typename T2 > | |
using | PointPair2_ = std::pair< Point2d_< T1 >, Point2d_< T2 > > |
template<typename T > | |
using | PointPair_ = std::pair< Point2d_< T >, Point2d_< T > > |
using | PointPairD = PointPair_< double > |
using | PointPairF = PointPair_< float > |
using | PointPairL = PointPair_< long double > |
using | Segment = Segment_< HOMOG2D_INUMTYPE > |
Default segment type. More... | |
template<typename T > | |
using | Segment_ = base::SegVec< typ::IsSegment, T > |
using | SegmentD = Segment_< double > |
using | SegmentF = Segment_< float > |
using | SegmentL = Segment_< long double > |
Functions | |
template<typename FPT > | |
HOMOG2D_INUMTYPE | angle (const Ellipse_< FPT > &ell) |
Return angle of ellipse (free function) More... | |
template<typename T > | |
HOMOG2D_INUMTYPE | area (const T &elem) |
Returns area of element or variant (free function) More... | |
template<typename FPT > | |
bool | areCollinear (const Point2d_< FPT > &pt1, const Point2d_< FPT > &pt2, const Point2d_< FPT > &pt3) |
Returns true if the 3 points are on the same line. More... | |
template<typename T1 , typename T2 > | |
bool | areParallel (const T1 &t1, const T2 &t2) |
Returns true is lines (or segments) are parallel. More... | |
template<typename FPT > | |
Homogr_< FPT > | buildFrom4Points (const std::vector< Point2d_< FPT >> &vpt1, const std::vector< Point2d_< FPT >> &vpt2, int method=1) |
Build Homography from 2 sets of 4 points (free function) More... | |
template<typename FPT > | |
Point2d_< FPT > & | center (Circle_< FPT > &cir) |
Returns reference on center of circle (free function), non-const version. More... | |
template<typename FPT > | |
const Point2d_< FPT > & | center (const Circle_< FPT > &cir) |
Returns reference on center of circle (free function), const version. More... | |
template<typename PLT , typename FPT > | |
base::LPBase< typ::IsPoint, FPT > | centroid (const base::PolylineBase< PLT, FPT > &pl) |
Returns centroid of Polyline (free function) More... | |
template<typename CT , typename FPT > | |
CPolyline_< FPT > | convexHull (const base::PolylineBase< CT, FPT > &input) |
Compute Convex Hull of a Polyline (free function) More... | |
template<typename FPT1 , typename FPT2 > | |
HOMOG2D_INUMTYPE | dist (const Point2d_< FPT1 > &pt1, const Point2d_< FPT2 > &pt2) |
Free function, distance between points. More... | |
template<typename U , typename Prim , typename std::enable_if< trait::IsDrawable< Prim >::value, Prim >::type * = nullptr> | |
void | draw (img::Image< U > &img, const Prim &prim, const img::DrawParams &dp=img::DrawParams()) |
Free function, draws any of the primitives by calling the relevant member function. More... | |
template<typename U , typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr> | |
void | draw (img::Image< U > &img, const T &cont, const img::DrawParams &dp=img::DrawParams()) |
Free function, draws a set of primitives. More... | |
template<typename U , typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr> | |
void | draw (img::Image< U > &img, const T &cont, std::function< img::DrawParams(int)> &func) |
This version holds a std::function as 3th parameter. It can be used to pass a function that will return a different img::DrawParams for a given index of the container. More... | |
template<typename T1 , typename T2 , typename U > | |
void | draw (img::Image< U > &img, const std::pair< T1, T2 > &pa, const img::DrawParams &dp=img::DrawParams()) |
Free function, draws a pair of objects. More... | |
template<typename U , typename FPT > | |
void | drawText (img::Image< U > &im, std::string str, Point2d_< FPT > pt, img::DrawParams dp=img::DrawParams()) |
Free function, draws text str at position pt . More... | |
template<typename T > | |
std::pair< int, int > | dsize (const T &t) |
Get data size expressed as number of bits for, respectively, mantissa and exponent. More... | |
template<typename T > | |
Dtype | dtype (const T &elem) |
Returns the underlying data type of object or variant. More... | |
template<typename FPT , typename T > | |
size_t | findFarthestPoint (const Point2d_< FPT > &pt, const T &cont) |
Returns index of point in container cont that is the farthest to pt . More... | |
template<typename FPT , typename T > | |
auto | findNearestFarthestPoint (const Point2d_< FPT > &pt, const T &cont) |
Returns indexes of points in container cont that are nearest/farthest. More... | |
template<typename FPT , typename T > | |
size_t | findNearestPoint (const Point2d_< FPT > &pt, const T &cont) |
Returns index of point in container cont that is the nearest to pt . More... | |
template<typename FPT > | |
std::array< Point2d_< FPT >, 4 > | get4Pts (const FRect_< FPT > &rect) |
Returns the 4 points of the rectangle (free function) More... | |
template<typename T1 , typename T2 > | |
HOMOG2D_INUMTYPE | getAngle (const T1 &t1, const T2 &t2) |
Free function, returns angle between two segments/lines. More... | |
template<typename FPT > | |
std::pair< Line2d_< FPT >, Line2d_< FPT > > | getAxisLines (const Ellipse_< FPT > &ell) |
Returns ellipse axis lines. More... | |
template<typename T > | |
FRect_< HOMOG2D_INUMTYPE > | getBB (const T &t) |
Return Bounding Box of primitive or container holding primitives (free function) More... | |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
auto | getBB (const PointPair2_< T1, T2 > &pp1, const PointPair2_< T3, T4 > &pp2) |
Returns bounding box of two pairs of points. More... | |
template<typename T1 , typename T2 > | |
auto | getBB (const T1 &elem1, const T2 &elem2) |
Overload 1/3. This one is called if NONE of the args are a Line2d. More... | |
template<typename FPT > | |
Line2d_< FPT > | getBisector (const Segment_< FPT > &seg) |
Free function, returns bisector line of segment. More... | |
template<typename PLT , typename FPT > | |
std::vector< Line2d_< HOMOG2D_INUMTYPE > > | getBisectorLines (const base::PolylineBase< PLT, FPT > &pl) |
Returns bisector lines of a Polyline. More... | |
template<typename T > | |
auto | getBmPoint (const T &t) |
Return Bottom-most point of container holding points. More... | |
template<typename PLT , typename FPT > | |
Point2d_< FPT > | getBmPoint (const base::PolylineBase< PLT, FPT > &poly) |
Return Bottom-most point of Polyline (free function) More... | |
template<typename FPT > | |
Circle_< FPT > | getBoundingCircle (const FRect_< FPT > &rect) |
Returns circle passing through 4 points of flat rectangle (free function) More... | |
template<typename FPT > | |
Point2d_< FPT > | getCenter (const Segment_< FPT > &seg) |
Free function, returns middle point of segment. More... | |
template<typename T > | |
Point2d_< typename T::FType > | getCenter (const T &other) |
Return center of Segment_, FRect_, or Ellipse_ (free function) More... | |
template<typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr> | |
auto | getCenters (const T &vsegs) |
Free function, returns middle points of set of segments/circles. More... | |
template<typename PLT1 , typename FPT1 , typename PLT2 , typename FPT2 > | |
priv::ClosestPoints< PLT1, FPT1, PLT2, FPT2 > | getClosestPoints (const base::PolylineBase< PLT1, FPT1 > &poly1, const base::PolylineBase< PLT2, FPT2 > &poly2) |
Computes the closest points between two polylines (types can be different) More... | |
template<typename FPT > | |
cv::Point2d | getCvPtd (const Point2d_< FPT > &pt) |
Free function to return an OpenCv point (double) More... | |
template<typename FPT > | |
cv::Point2f | getCvPtf (const Point2d_< FPT > &pt) |
Free function to return an OpenCv point (float) More... | |
template<typename FPT > | |
cv::Point2i | getCvPti (const Point2d_< FPT > &pt) |
Free function to return an OpenCv point (integer) More... | |
template<typename FPT > | |
std::pair< Segment_< FPT >, Segment_< FPT > > | getDiagonals (const FRect_< FPT > &rect) |
Free function. More... | |
template<typename FPT > | |
Segment_< FPT > | getExtended (const Segment_< FPT > &seg) |
Returns Extended Segment (free function) More... | |
template<typename FPT > | |
FRect_< FPT > | getExtended (const FRect_< FPT > &rect) |
Free function. More... | |
template<typename T > | |
auto | getExtremePoint (CardDir dir, const T &t) |
Get Top-most / Bottom-most / Left-most / Right-most point, depending on dir (free function) More... | |
template<typename FPT > | |
FRect_< FPT > | getFRect (cv::Mat &mat) |
template<typename FPT > | |
Circle_< FPT > | getInscribedCircle (const FRect_< FPT > &rect) |
Return circle inscribed in rectangle. More... | |
template<typename FPT > | |
Line2d_< FPT > | getLine (const Segment_< FPT > &seg) |
Returns Segment supporting line (free function) More... | |
template<typename FPT1 , typename FPT2 , typename FPT3 > | |
Line2d_< FPT1 > | getLine (const Circle_< FPT2 > &c1, const Circle_< FPT3 > &c2) |
Free function, returns line between two circle centers. More... | |
template<typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr> | |
auto | getLines (const T &vsegs) |
Free function, returns a set of lines from a set of segments. More... | |
template<typename T > | |
auto | getLmPoint (const T &t) |
Return Left-most point of container as a pair holding: More... | |
template<typename PLT , typename FPT > | |
Point2d_< FPT > | getLmPoint (const base::PolylineBase< PLT, FPT > &poly) |
Return Left-most point of Polyline (free function) More... | |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
auto | getMinMax (const PointPair2_< T1, T2 > &pp1, const PointPair2_< T3, T4 > &pp2) |
Returns a pair of points holding min and max coordinates of the two input pair of points. More... | |
template<typename FPT > | |
CPolyline_< FPT > | getOBB (const Ellipse_< FPT > &ell) |
Returns Bounding Box of Ellipse_ (free function) More... | |
template<typename FPT > | |
std::array< Point2d_< FPT >, 4 > | getOrthogPts (const Segment_< FPT > &seg) |
Returns the 4 orthogonal points to the segment. More... | |
template<typename FPT > | |
std::array< Segment_< FPT >, 4 > | getOrthogSegs (const Segment_< FPT > &seg) |
Returns the 4 orthogonal segments to the segment. More... | |
template<typename FPT > | |
HOMOG2D_INUMTYPE | getParallelDistance (const Line2d_< FPT > &li1, const Line2d_< FPT > &li2) |
Returns the distance between 2 parallel lines (free function) More... | |
template<typename FPT , typename T > | |
std::pair< Line2d_< FPT >, Line2d_< FPT > > | getParallelLines (const Line2d_< FPT > &li, T dist) |
Returns the 2 parallel lines at distance dist from li (free function) More... | |
template<typename FPT , typename T > | |
std::pair< Segment_< FPT >, Segment_< FPT > > | getParallelSegs (const Segment_< FPT > &seg, T dist) |
Free function, returns a pair of parallel segments at a distance dist . More... | |
template<typename RT , typename FPT > | |
RT | getPt (const Point2d_< FPT > &pt) |
Generic free function to return a point of other type. More... | |
template<typename RT , typename FPT > | |
std::vector< RT > | getPts (const std::vector< Point2d_< FPT >> &vpt) |
Free function, returns a vector of points of other type from a vector of h2d points. More... | |
template<typename FPT > | |
auto | getPts (const Segment_< FPT > &seg) |
Returns the points of Segment as a std::pair (free function) More... | |
template<typename FPT > | |
auto | getPts (const FRect_< FPT > &rect) |
Returns the 2 major points of the rectangle (free function) More... | |
template<typename CONT , typename PRIM > | |
CONT | getPtsInside (const CONT &input_set, const PRIM &prim) |
Returns set of points that are inside primitive prim . More... | |
template<typename T > | |
auto | getRmPoint (const T &t) |
Return Right-most point of container holding points. More... | |
template<typename PLT , typename FPT > | |
Point2d_< FPT > | getRmPoint (const base::PolylineBase< PLT, FPT > &poly) |
Return Right-most point of Polyline (free function) More... | |
template<typename T1 , typename T2 > | |
Segment_< typename T1::FType > | getSegment (const T1 &c1, const T2 &c2) |
Free function, returns segment between two circle centers (or ellipse) More... | |
template<typename PLT , typename FPT > | |
std::vector< Segment_< FPT > > | getSegs (const base::PolylineBase< PLT, FPT > &pl) |
Returns the segments of the polyline (free function) More... | |
template<typename FPT > | |
std::array< Segment_< FPT >, 4 > | getSegs (const FRect_< FPT > &seg) |
Free function, returns segments of the rectangle. More... | |
const char * | getString (Type t) |
Returns stringified version of type() More... | |
const char * | getString (Dtype t) |
const char * | getString (PointSide t) |
template<typename FPT1 , typename FPT2 > | |
std::pair< Segment_< FPT1 >, Segment_< FPT1 > > | getTanSegs (const Circle_< FPT1 > &c1, const Circle_< FPT2 > &c2) |
Free function, returns the pair of segments tangential to the two circles. More... | |
template<typename T > | |
auto | getTmPoint (const T &t) |
Return Top-most point of container. More... | |
template<typename PLT , typename FPT > | |
Point2d_< FPT > | getTmPoint (const base::PolylineBase< PLT, FPT > &poly) |
Return Top-most point of Polyline (free function) More... | |
template<typename FPT > | |
FPT | getX (const Point2d_< FPT > &pt) |
template<typename FPT > | |
FPT | getY (const Point2d_< FPT > &pt) |
template<typename FPT > | |
HOMOG2D_INUMTYPE | height (const FRect_< FPT > &rect) |
Free function. More... | |
template<typename FPT1 , typename FPT2 > | |
detail::RectArea< FPT1 > | intersectArea (const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2) |
Free function, see FRect_::intersectArea() More... | |
template<typename FPT1 , typename FPT2 > | |
HOMOG2D_INUMTYPE | IoU (const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2) |
Intersection area over Union area (free function) More... | |
template<typename FPT > | |
bool | isCircle (const Ellipse_< FPT > &ell, HOMOG2D_INUMTYPE thres=1.E-10) |
Returns true if ellipse is a circle. More... | |
template<typename PLT , typename FPT > | |
bool | isConvex (const base::PolylineBase< PLT, FPT > &poly) |
Returns true if polygon is convex (free function) More... | |
template<typename PLT , typename FPT > | |
bool | isSimple (const base::PolylineBase< PLT, FPT > &pl) |
Returns true if is a polygon (free function) Â More... | |
template<typename T > | |
HOMOG2D_INUMTYPE | length (const T &elem) |
Returns length of element or variant (free function) More... | |
template<typename T , typename FP > | |
void | moveTo (T &prim, const Point2d_< FP > &pt) |
Move primitive to other location (free function) More... | |
template<typename T , typename FP1 , typename FP2 > | |
void | moveTo (T &prim, FP1 x, FP2 y) |
Move primitive to other location (free function) More... | |
template<typename PLT , typename FPT > | |
size_t | nbSegs (const base::PolylineBase< PLT, FPT > &pl) |
Returns the number of segments (free function) More... | |
template<typename T , typename U > | |
Line2d_< T > | operator* (const Homogr_< U > &h, const Line2d_< T > &in) |
Free function, apply homography to a line. More... | |
template<typename FPT , typename FPT2 > | |
Line2d_< FPT > | operator* (const Point2d_< FPT > &lhs, const Point2d_< FPT2 > &rhs) |
Free function template, product of two points, returns a line. More... | |
template<typename FPT1 , typename FPT2 > | |
Line2d_< FPT1 > | operator* (const Point2d_< FPT1 > &, const Point2d_< FPT2 > &) |
template<typename FPT1 , typename FPT2 > | |
Point2d_< FPT1 > | operator* (const Line2d_< FPT1 > &, const Line2d_< FPT2 > &) |
template<typename FPT1 , typename FPT2 > | |
CPolyline_< FPT1 > | operator* (const h2d::Homogr_< FPT2 > &h, const h2d::FRect_< FPT1 > &rin) |
Apply homography to a flat rectangle produces a closed polyline. More... | |
template<typename FPT1 , typename FPT2 , typename PLT2 > | |
auto | operator* (const Homogr_< FPT2 > &, const base::PolylineBase< PLT2, FPT1 > &) -> base::PolylineBase< PLT2, FPT1 > |
template<typename FPT , typename FPT2 > | |
Point2d_< FPT > | operator* (const Line2d_< FPT > &lhs, const Line2d_< FPT2 > &rhs) |
Free function template, product of two lines, returns a point. More... | |
template<typename SV1 , typename SV2 , typename FPT1 , typename FPT2 > | |
Point2d_< FPT1 > | operator* (const base::SegVec< SV1, FPT1 > &lhs, const base::SegVec< SV2, FPT2 > &rhs) |
Free function template, product of two segments/vector, returns a point. More... | |
template<typename T , typename U > | |
Point2d_< T > | operator* (const Homogr_< U > &h, const Point2d_< T > &in) |
Free function, apply homography to a point. More... | |
template<typename SV , typename FPT1 , typename FPT2 > | |
Segment_< FPT1 > | operator* (const Homogr_< FPT1 > &h, const base::SegVec< SV, FPT2 > &seg) |
Apply homography to a Segment. More... | |
template<typename FPT1 , typename FPT2 , typename PLT > | |
base::PolylineBase< PLT, FPT1 > | operator* (const Homogr_< FPT2 > &h, const base::PolylineBase< PLT, FPT1 > &pl) |
Apply homography to a Polyline. More... | |
template<typename FPT1 , typename FPT2 > | |
Ellipse_< FPT1 > | operator* (const Homogr_< FPT2 > &h, const Ellipse_< FPT1 > &ell_in) |
Apply homography to a Ellipse, produces an Ellipse. More... | |
template<typename FPT1 , typename FPT2 > | |
Ellipse_< FPT1 > | operator* (const Homogr_< FPT2 > &h, const Circle_< FPT1 > &cir) |
Apply homography to a Circle, produces an Ellipse. More... | |
template<typename FPT , typename Cont > | |
std::enable_if< trait::IsContainer< Cont >::value, Cont >::type | operator* (const Hmatrix_< typ::IsHomogr, FPT > &h, const Cont &vin) |
Used to proceed multiple products, whatever the container (std::list , std::vector , or std::array ). Returned container is of same type as given input. More... | |
template<typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr> | |
std::ostream & | operator<< (std::ostream &f, const T &vec) |
Stream operator for a container of points/lines, free function. More... | |
template<typename LP1 , typename LP2 , typename FPT > | |
std::ostream & | operator<< (std::ostream &f, const std::pair< base::LPBase< LP1, FPT >, base::LPBase< LP2, FPT >> &pr) |
Stream operator for a pair of points/lines, free function. More... | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &f, const FRect_< T > &r) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &f, const Circle_< T > &r) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &f, const Ellipse_< T > &ell) |
template<typename FPT > | |
FPT & | radius (Circle_< FPT > &cir) |
Returns reference on radius of circle (free function), non-const version. More... | |
template<typename FPT > | |
const FPT & | radius (const Circle_< FPT > &cir) |
Returns reference on radius of circle (free function), const version. More... | |
template<typename T > | |
void | rotate (T &prim, Rotate rot) |
Rotates the primitive (only available for Polyline and FRect) around (0,0) More... | |
template<typename T , typename FPT > | |
void | rotate (T &prim, Rotate rot, const Point2d_< FPT > &refpt) |
Rotates the primitive (only available for Polyline and FRect) around refpt . More... | |
template<typename FPT1 , typename FPT2 > | |
int | side (const Point2d_< FPT1 > &pt, const Line2d_< FPT2 > &li) |
Free function, returns -1 or +1 depending on the side of pt , related to li . More... | |
template<typename T > | |
HOMOG2D_INUMTYPE | size (const T &elem) |
Returns size of element or variant (free function) More... | |
template<typename SV , typename FPT > | |
std::pair< base::SegVec< SV, FPT >, base::SegVec< SV, FPT > > | split (const base::SegVec< SV, FPT > &seg) |
Returns a pair of segments, corresponding to the input segment split by middle point (free function) More... | |
template<typename FPT , typename T > | |
std::pair< OSegment_< FPT >, OSegment_< FPT > > | split (const OSegment_< FPT > &seg, T dist) |
Returns a pair of segments, corresponding to the input segment split by point at distance dist (free function) More... | |
template<typename T , typename FPT > | |
CommonType_< FPT > | transform (const Homogr_< FPT > &h, const T &elem) |
Apply homography to primitive. More... | |
template<typename T , typename FP1 , typename FP2 > | |
void | translate (T &prim, FP1 dx, FP2 dy) |
Translate primitive prim (free function) More... | |
template<typename T , typename FP1 , typename FP2 > | |
void | translate (T &prim, const std::pair< FP1, FP2 > &ppt) |
Translate primitive prim with values in a std::pair (free function) More... | |
template<typename T > | |
Type | type (const T &elem) |
Free function. Returns the type of object or variant. More... | |
template<typename FPT1 , typename FPT2 > | |
CPolyline_< FPT1 > | unionArea (const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2) |
Free function, see FRect_::unionArea() More... | |
template<typename FPT > | |
HOMOG2D_INUMTYPE | width (const FRect_< FPT > &rect) |
Free function. More... | |
using h2d::Circle = typedef Circle_<HOMOG2D_INUMTYPE> |
Default circle type.
using h2d::CircleD = typedef Circle_<double> |
using h2d::CircleF = typedef Circle_<float> |
using h2d::CircleL = typedef Circle_<long double> |
using h2d::CommonType = typedef CommonType_<HOMOG2D_INUMTYPE> |
using h2d::CommonType_ = typedef std::variant< Segment_<FPT>, OSegment_<FPT>, Point2d_<FPT>, Line2d_<FPT>, Circle_<FPT>, Ellipse_<FPT>, FRect_<FPT>, CPolyline_<FPT>, OPolyline_<FPT> > |
A variant type, holding all possible types. Used to achieve runtime polymorphism.
See https://github.com/skramm/homog2d/blob/master/docs/homog2d_manual.md#section_rtp
using h2d::CommonTypeD = typedef CommonType_<double> |
using h2d::CommonTypeF = typedef CommonType_<float> |
using h2d::CommonTypeL = typedef CommonType_<long double> |
using h2d::CPolyline = typedef CPolyline_<HOMOG2D_INUMTYPE> |
Default polyline type.
using h2d::CPolyline_ = typedef base::PolylineBase<typ::IsClosed,T> |
using h2d::CPolylineD = typedef CPolyline_<double> |
using h2d::CPolylineF = typedef CPolyline_<float> |
using h2d::CPolylineL = typedef CPolyline_<long double> |
using h2d::Ellipse = typedef Ellipse_<HOMOG2D_INUMTYPE> |
Default ellipse type.
using h2d::EllipseD = typedef Ellipse_<double> |
using h2d::EllipseF = typedef Ellipse_<float> |
using h2d::EllipseL = typedef Ellipse_<long double> |
using h2d::Epipmat = typedef Hmatrix_<typ::IsEpipmat,HOMOG2D_INUMTYPE> |
Default homogeneous matrix, uses double
as numerical type.
using h2d::FRect = typedef FRect_<HOMOG2D_INUMTYPE> |
Default rectangle type.
using h2d::FRectD = typedef FRect_<double> |
using h2d::FRectF = typedef FRect_<float> |
using h2d::FRectL = typedef FRect_<long double> |
using h2d::Homogr = typedef Homogr_<HOMOG2D_INUMTYPE> |
Default homography (3x3 matrix) type, uses double
as numerical type.
using h2d::Homogr_ = typedef Hmatrix_<typ::IsHomogr,T> |
using h2d::HomogrD = typedef Homogr_<double> |
using h2d::HomogrF = typedef Homogr_<float> |
using h2d::HomogrL = typedef Homogr_<long double> |
using h2d::Line2d = typedef Line2d_<HOMOG2D_INUMTYPE> |
Default line type, uses double
as numerical type.
using h2d::Line2d_ = typedef base::LPBase<typ::IsLine,T> |
using h2d::Line2dD = typedef Line2d_<double> |
using h2d::Line2dF = typedef Line2d_<float> |
using h2d::Line2dL = typedef Line2d_<long double> |
using h2d::OPolyline = typedef OPolyline_<HOMOG2D_INUMTYPE> |
using h2d::OPolyline_ = typedef base::PolylineBase<typ::IsOpen,T> |
using h2d::OPolylineD = typedef OPolyline_<double> |
using h2d::OPolylineF = typedef OPolyline_<float> |
using h2d::OPolylineL = typedef OPolyline_<long double> |
using h2d::OSegment = typedef OSegment_<HOMOG2D_INUMTYPE> |
using h2d::OSegment_ = typedef base::SegVec<typ::IsOSeg,T> |
using h2d::OSegmentD = typedef OSegment_<double> |
using h2d::OSegmentF = typedef OSegment_<float> |
using h2d::OSegmentL = typedef OSegment_<long double> |
using h2d::Point2d = typedef Point2d_<HOMOG2D_INUMTYPE> |
Default point type, uses double
as numerical type.
using h2d::Point2d_ = typedef base::LPBase<typ::IsPoint,T> |
using h2d::Point2dD = typedef Point2d_<double> |
using h2d::Point2dF = typedef Point2d_<float> |
using h2d::Point2dL = typedef Point2d_<long double> |
using h2d::PointPair = typedef PointPair_<double> |
using h2d::PointPair2_ = typedef std::pair<Point2d_<T1>,Point2d_<T2> > |
using h2d::PointPair_ = typedef std::pair<Point2d_<T>,Point2d_<T> > |
using h2d::PointPairD = typedef PointPair_<double> |
using h2d::PointPairF = typedef PointPair_<float> |
using h2d::PointPairL = typedef PointPair_<long double> |
using h2d::Segment = typedef Segment_<HOMOG2D_INUMTYPE> |
Default segment type.
using h2d::Segment_ = typedef base::SegVec<typ::IsSegment,T> |
using h2d::SegmentD = typedef Segment_<double> |
using h2d::SegmentF = typedef Segment_<float> |
using h2d::SegmentL = typedef Segment_<long double> |
|
strong |
|
strong |
Type of underlying floating point, see LPBase::dtype(). Maybe printed out with getString()
Enumerator | |
---|---|
Float | |
Double | |
LongDouble | |
Other | |
Ttmath | only if HOMOG2D_USE_TTMATH is defined, see manual |
|
strong |
|
strong |
|
strong |
|
strong |
Used in base::PolylineBase_::rotate() member function.
Enumerator | |
---|---|
CCW | Counter ClockWise rotation. |
CW | ClockWise rotation. |
Full | 180° rotation |
VMirror | vertical symmetry |
HMirror | horizontal symmetry |
|
strong |
Type of Root object, see rtp::Root::type(). Maybe printed out with getString()
Enumerator | |
---|---|
Line2d | |
Point2d | |
Segment | |
OSegment | |
FRect | |
Circle | |
Ellipse | |
OPolyline | |
CPolyline |
HOMOG2D_INUMTYPE h2d::angle | ( | const Ellipse_< FPT > & | ell | ) |
Return angle of ellipse (free function)
bool h2d::areCollinear | ( | const Point2d_< FPT > & | pt1, |
const Point2d_< FPT > & | pt2, | ||
const Point2d_< FPT > & | pt3 | ||
) |
Returns true if the 3 points are on the same line.
bool h2d::areParallel | ( | const T1 & | t1, |
const T2 & | t2 | ||
) |
Homogr_<FPT> h2d::buildFrom4Points | ( | const std::vector< Point2d_< FPT >> & | vpt1, |
const std::vector< Point2d_< FPT >> & | vpt2, | ||
int | method = 1 |
||
) |
Build Homography from 2 sets of 4 points (free function)
vpt1 | source points |
vpt2 | destination points |
method | 0: Eigen, 1: Opencv |
Returns reference on center of circle (free function), non-const version.
Returns reference on center of circle (free function), const version.
base::LPBase<typ::IsPoint,FPT> h2d::centroid | ( | const base::PolylineBase< PLT, FPT > & | pl | ) |
Returns centroid of Polyline (free function)
CPolyline_<FPT> h2d::convexHull | ( | const base::PolylineBase< CT, FPT > & | input | ) |
Compute Convex Hull of a Polyline (free function)
T:
can be either OPolyline, CPolyline, or std::vector<Point2d>HOMOG2D_INUMTYPE h2d::dist | ( | const Point2d_< FPT1 > & | pt1, |
const Point2d_< FPT2 > & | pt2 | ||
) |
Free function, distance between points.
void h2d::draw | ( | img::Image< U > & | img, |
const Prim & | prim, | ||
const img::DrawParams & | dp = img::DrawParams() |
||
) |
Free function, draws any of the primitives by calling the relevant member function.
void h2d::draw | ( | img::Image< U > & | img, |
const T & | cont, | ||
std::function< img::DrawParams(int)> & | func | ||
) |
This version holds a std::function
as 3th parameter. It can be used to pass a function that will return a different img::DrawParams for a given index of the container.
At present, cannot be used with container holding variants...
void h2d::draw | ( | img::Image< U > & | img, |
const std::pair< T1, T2 > & | pa, | ||
const img::DrawParams & | dp = img::DrawParams() |
||
) |
void h2d::drawText | ( | img::Image< U > & | im, |
std::string | str, | ||
Point2d_< FPT > | pt, | ||
img::DrawParams | dp = img::DrawParams() |
||
) |
std::pair<int,int> h2d::dsize | ( | const T & | t | ) |
Get data size expressed as number of bits for, respectively, mantissa and exponent.
size_t h2d::findFarthestPoint | ( | const Point2d_< FPT > & | pt, |
const T & | cont | ||
) |
Returns index of point in container cont
that is the farthest to pt
.
auto h2d::findNearestFarthestPoint | ( | const Point2d_< FPT > & | pt, |
const T & | cont | ||
) |
Returns indexes of points in container cont
that are nearest/farthest.
size_t h2d::findNearestPoint | ( | const Point2d_< FPT > & | pt, |
const T & | cont | ||
) |
Returns index of point in container cont
that is the nearest to pt
.
add some sfinae and/or checking on type T
perform some speed analysis, and check if usage of squared distance is really better
add other distance computations (Manhattan?)
Would it be better to return an iterator?
Returns the 4 points of the rectangle (free function)
HOMOG2D_INUMTYPE h2d::getAngle | ( | const T1 & | t1, |
const T2 & | t2 | ||
) |
Free function, returns angle between two segments/lines.
std::pair<Line2d_<FPT>,Line2d_<FPT> > h2d::getAxisLines | ( | const Ellipse_< FPT > & | ell | ) |
Returns ellipse axis lines.
auto h2d::getBB | ( | const PointPair2_< T1, T2 > & | pp1, |
const PointPair2_< T3, T4 > & | pp2 | ||
) |
Returns bounding box of two pairs of points.
auto h2d::getBB | ( | const T1 & | elem1, |
const T2 & | elem2 | ||
) |
Overload 1/3. This one is called if NONE of the args are a Line2d.
Overload 3/3. Called if one of the args is a Line2d (=> no build!)
Free function, returns bisector line of segment.
std::vector< Line2d_< HOMOG2D_INUMTYPE > > h2d::getBisectorLines | ( | const base::PolylineBase< PLT, FPT > & | pl | ) |
Returns bisector lines of a Polyline.
Size of vector will be:
auto h2d::getBmPoint | ( | const T & | t | ) |
Return Bottom-most point of container holding points.
Point2d_<FPT> h2d::getBmPoint | ( | const base::PolylineBase< PLT, FPT > & | poly | ) |
Return Bottom-most point of Polyline (free function)
Returns circle passing through 4 points of flat rectangle (free function)
Free function, returns middle point of segment.
Point2d_<typename T::FType> h2d::getCenter | ( | const T & | other | ) |
auto h2d::getCenters | ( | const T & | vsegs | ) |
Free function, returns middle points of set of segments/circles.
priv::ClosestPoints< PLT1, FPT1, PLT2, FPT2 > h2d::getClosestPoints | ( | const base::PolylineBase< PLT1, FPT1 > & | poly1, |
const base::PolylineBase< PLT2, FPT2 > & | poly2 | ||
) |
Computes the closest points between two polylines (types can be different)
cv::Point2d h2d::getCvPtd | ( | const Point2d_< FPT > & | pt | ) |
cv::Point2f h2d::getCvPtf | ( | const Point2d_< FPT > & | pt | ) |
cv::Point2i h2d::getCvPti | ( | const Point2d_< FPT > & | pt | ) |
auto h2d::getExtremePoint | ( | CardDir | dir, |
const T & | t | ||
) |
Get Top-most / Bottom-most / Left-most / Right-most point, depending on dir
(free function)
Type T
can be either a Polyline (open or closed), or a container holding points, or a FRect_
FRect_<FPT> h2d::getFRect | ( | cv::Mat & | mat | ) |
Return circle inscribed in rectangle.
Returns Segment supporting line (free function)
auto h2d::getLines | ( | const T & | vsegs | ) |
Free function, returns a set of lines from a set of segments.
auto h2d::getLmPoint | ( | const T & | t | ) |
Return Left-most point of container as a pair holding:
Point2d_<FPT> h2d::getLmPoint | ( | const base::PolylineBase< PLT, FPT > & | poly | ) |
Return Left-most point of Polyline (free function)
auto h2d::getMinMax | ( | const PointPair2_< T1, T2 > & | pp1, |
const PointPair2_< T3, T4 > & | pp2 | ||
) |
Returns a pair of points holding min and max coordinates of the two input pair of points.
Tests: search for [minmax]
CPolyline_<FPT> h2d::getOBB | ( | const Ellipse_< FPT > & | ell | ) |
Returns Bounding Box of Ellipse_ (free function)
std::array<Point2d_<FPT>,4> h2d::getOrthogPts | ( | const Segment_< FPT > & | seg | ) |
Returns the 4 orthogonal points to the segment.
std::array<Segment_<FPT>,4> h2d::getOrthogSegs | ( | const Segment_< FPT > & | seg | ) |
Returns the 4 orthogonal segments to the segment.
HOMOG2D_INUMTYPE h2d::getParallelDistance | ( | const Line2d_< FPT > & | li1, |
const Line2d_< FPT > & | li2 | ||
) |
Returns the distance between 2 parallel lines (free function)
We first check that the two lines are indeed parallel. This should ensure that a1=a2 and b1=b2. But due to numeric issues they could by slightly different. In order to gain accuracy, we use the geometric mean of these.
std::pair<Line2d_<FPT>,Line2d_<FPT> > h2d::getParallelLines | ( | const Line2d_< FPT > & | li, |
T | dist | ||
) |
Returns the 2 parallel lines at distance dist
from li
(free function)
std::pair<Segment_<FPT>,Segment_<FPT> > h2d::getParallelSegs | ( | const Segment_< FPT > & | seg, |
T | dist | ||
) |
Free function, returns a pair of parallel segments at a distance dist
.
RT h2d::getPt | ( | const Point2d_< FPT > & | pt | ) |
Generic free function to return a point of other type.
User code needs to provide the requested type as template argument, for example:
std::vector<RT> h2d::getPts | ( | const std::vector< Point2d_< FPT >> & | vpt | ) |
Free function, returns a vector of points of other type from a vector of h2d points.
User code needs to provide the requested type as template argument.
auto h2d::getPts | ( | const Segment_< FPT > & | seg | ) |
Returns the points of Segment as a std::pair (free function)
auto h2d::getPts | ( | const FRect_< FPT > & | rect | ) |
Returns the 2 major points of the rectangle (free function)
CONT h2d::getPtsInside | ( | const CONT & | input_set, |
const PRIM & | prim | ||
) |
Returns set of points that are inside primitive prim
.
Output container will be of same type as input container (vector, list or array
prim | geometrical primitive (FRect, Circle, ...?) |
auto h2d::getRmPoint | ( | const T & | t | ) |
Return Right-most point of container holding points.
Point2d_<FPT> h2d::getRmPoint | ( | const base::PolylineBase< PLT, FPT > & | poly | ) |
Return Right-most point of Polyline (free function)
Segment_<typename T1::FType> h2d::getSegment | ( | const T1 & | c1, |
const T2 & | c2 | ||
) |
std::vector<Segment_<FPT> > h2d::getSegs | ( | const base::PolylineBase< PLT, FPT > & | pl | ) |
Returns the segments of the polyline (free function)
Free function, returns segments of the rectangle.
|
inline |
Returns stringified version of type()
|
inline |
|
inline |
std::pair<Segment_<FPT1>,Segment_<FPT1> > h2d::getTanSegs | ( | const Circle_< FPT1 > & | c1, |
const Circle_< FPT2 > & | c2 | ||
) |
Free function, returns the pair of segments tangential to the two circles.
Sources:
auto h2d::getTmPoint | ( | const T & | t | ) |
Return Top-most point of container.
Point2d_<FPT> h2d::getTmPoint | ( | const base::PolylineBase< PLT, FPT > & | poly | ) |
Return Top-most point of Polyline (free function)
FPT h2d::getX | ( | const Point2d_< FPT > & | pt | ) |
FPT h2d::getY | ( | const Point2d_< FPT > & | pt | ) |
HOMOG2D_INUMTYPE h2d::height | ( | const FRect_< FPT > & | rect | ) |
detail::RectArea<FPT1> h2d::intersectArea | ( | const FRect_< FPT1 > & | r1, |
const FRect_< FPT2 > & | r2 | ||
) |
Free function, see FRect_::intersectArea()
HOMOG2D_INUMTYPE h2d::IoU | ( | const FRect_< FPT1 > & | r1, |
const FRect_< FPT2 > & | r2 | ||
) |
Intersection area over Union area (free function)
bool h2d::isCircle | ( | const Ellipse_< FPT > & | ell, |
HOMOG2D_INUMTYPE | thres = 1.E-10 |
||
) |
Returns true if ellipse is a circle.
bool h2d::isConvex | ( | const base::PolylineBase< PLT, FPT > & | poly | ) |
Returns true if polygon is convex (free function)
bool h2d::isSimple | ( | const base::PolylineBase< PLT, FPT > & | pl | ) |
Returns true if is a polygon (free function) Â
void h2d::moveTo | ( | T & | prim, |
const Point2d_< FP > & | pt | ||
) |
void h2d::moveTo | ( | T & | prim, |
FP1 | x, | ||
FP2 | y | ||
) |
size_t h2d::nbSegs | ( | const base::PolylineBase< PLT, FPT > & | pl | ) |
Returns the number of segments (free function)
Line2d_< T > h2d::operator* | ( | const Homogr_< U > & | h, |
const Line2d_< T > & | in | ||
) |
Free function, apply homography to a line.
Line2d_<FPT> h2d::operator* | ( | const Point2d_< FPT > & | lhs, |
const Point2d_< FPT2 > & | rhs | ||
) |
Free function template, product of two points, returns a line.
Line2d_<FPT1> h2d::operator* | ( | const Point2d_< FPT1 > & | , |
const Point2d_< FPT2 > & | |||
) |
Point2d_<FPT1> h2d::operator* | ( | const Line2d_< FPT1 > & | , |
const Line2d_< FPT2 > & | |||
) |
CPolyline_< FPT1 > h2d::operator* | ( | const Homogr_< FPT2 > & | h, |
const FRect_< FPT1 > & | rin | ||
) |
Apply homography to a flat rectangle produces a closed polyline.
auto h2d::operator* | ( | const Homogr_< FPT2 > & | , |
const base::PolylineBase< PLT2, FPT1 > & | |||
) | -> base::PolylineBase< PLT2, FPT1 > |
using namespace std;
. This was the case for the streaming operator... Point2d_<FPT> h2d::operator* | ( | const Line2d_< FPT > & | lhs, |
const Line2d_< FPT2 > & | rhs | ||
) |
Free function template, product of two lines, returns a point.
Point2d_<FPT1> h2d::operator* | ( | const base::SegVec< SV1, FPT1 > & | lhs, |
const base::SegVec< SV2, FPT2 > & | rhs | ||
) |
Point2d_<T> h2d::operator* | ( | const Homogr_< U > & | h, |
const Point2d_< T > & | in | ||
) |
Free function, apply homography to a point.
Segment_<FPT1> h2d::operator* | ( | const Homogr_< FPT1 > & | h, |
const base::SegVec< SV, FPT2 > & | seg | ||
) |
Apply homography to a Segment.
base::PolylineBase<PLT,FPT1> h2d::operator* | ( | const Homogr_< FPT2 > & | h, |
const base::PolylineBase< PLT, FPT1 > & | pl | ||
) |
Ellipse_<FPT1> h2d::operator* | ( | const Homogr_< FPT2 > & | h, |
const Ellipse_< FPT1 > & | ell_in | ||
) |
Apply homography to a Ellipse, produces an Ellipse.
\[ Q' = H^{-T} \cdot Q \cdot H^{-1} \]
std::enable_if<trait::IsContainer<Cont>::value,Cont>::type h2d::operator* | ( | const Hmatrix_< typ::IsHomogr, FPT > & | h, |
const Cont & | vin | ||
) |
Used to proceed multiple products, whatever the container (std::list
, std::vector
, or std::array
). Returned container is of same type as given input.
h | Matrix |
vin | Input container |
std::ostream& h2d::operator<< | ( | std::ostream & | f, |
const T & | vec | ||
) |
std::ostream& h2d::operator<< | ( | std::ostream & | f, |
const std::pair< base::LPBase< LP1, FPT >, base::LPBase< LP2, FPT >> & | pr | ||
) |
Stream operator for a pair of points/lines, free function.
std::ostream& h2d::operator<< | ( | std::ostream & | f, |
const FRect_< T > & | r | ||
) |
std::ostream& h2d::operator<< | ( | std::ostream & | f, |
const Circle_< T > & | r | ||
) |
std::ostream& h2d::operator<< | ( | std::ostream & | f, |
const Ellipse_< T > & | ell | ||
) |
FPT& h2d::radius | ( | Circle_< FPT > & | cir | ) |
Returns reference on radius of circle (free function), non-const version.
const FPT& h2d::radius | ( | const Circle_< FPT > & | cir | ) |
Returns reference on radius of circle (free function), const version.
void h2d::rotate | ( | T & | prim, |
Rotate | rot | ||
) |
int h2d::side | ( | const Point2d_< FPT1 > & | pt, |
const Line2d_< FPT2 > & | li | ||
) |
Free function, returns -1 or +1 depending on the side of pt
, related to li
.
std::pair<base::SegVec<SV,FPT>,base::SegVec<SV,FPT> > h2d::split | ( | const base::SegVec< SV, FPT > & | seg | ) |
Returns a pair of segments, corresponding to the input segment split by middle point (free function)
std::pair<OSegment_<FPT>,OSegment_<FPT> > h2d::split | ( | const OSegment_< FPT > & | seg, |
T | dist | ||
) |
Returns a pair of segments, corresponding to the input segment split by point at distance dist
(free function)
void h2d::translate | ( | T & | prim, |
FP1 | dx, | ||
FP2 | dy | ||
) |
void h2d::translate | ( | T & | prim, |
const std::pair< FP1, FP2 > & | ppt | ||
) |
CPolyline_<FPT1> h2d::unionArea | ( | const FRect_< FPT1 > & | r1, |
const FRect_< FPT2 > & | r2 | ||
) |
Free function, see FRect_::unionArea()
HOMOG2D_INUMTYPE h2d::width | ( | const FRect_< FPT > & | rect | ) |