homog2d library
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
homog2d.hpp File Reference

single header file, implements some 2D homogeneous stuff. See https://github.com/skramm/homog2d More...

#include <cmath>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <numeric>
#include <array>
#include <set>
#include <list>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <cassert>
#include <sstream>
#include <type_traits>
#include <functional>
#include <limits>
#include <cstdint>
#include <memory>
#include "tinyxml2.h"
#include <variant>
#include <ttmath/ttmath.h>
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <boost/geometry.hpp>
Include dependency graph for homog2d.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  h2d::detail::AlwaysFalse< T >
 A trick used in static_assert, so it aborts only if function is instanciated. More...
 
struct  h2d::fct::AreaFunct
 A functor to get the area of an object in a std::variant, call with std::visit() More...
 
struct  h2d::detail::BaseHelper< typename >
 Helper class for Root (Point/Line) type, used as a trick to allow partial specialization of member functions. More...
 
struct  h2d::fct::BBFunct
 A functor to get the Bounding Box. More...
 
struct  h2d::priv::runion::Cell
 A wrapper around a bool, that gets set if that point defined by indexes ix and iy is a corner in the table. More...
 
class  h2d::Circle_< FPT >
 A circle. More...
 
class  h2d::Circle_< FPT >
 A circle. More...
 
class  h2d::priv::ClosestPoints< PLT1, FPT1, PLT2, FPT2 >
 Used in getClosestPoints() More...
 
class  h2d::priv::ClosestPoints< PLT1, FPT1, PLT2, FPT2 >
 Used in getClosestPoints() More...
 
struct  h2d::img::Color
 Color type , see DrawParams. More...
 
class  h2d::detail::Common< FPT >
 Common templated class for all the geometric primitives. More...
 
struct  h2d::detail::DataFpType< typename >
 Helper class for used to get the underlying floating-point type, see Dtype and Common::dtype() More...
 
struct  h2d::fct::DrawFunct< IMG >
 A functor used to draw objects. To use with std::variant and std::visit() More...
 
class  h2d::img::DrawParams
 Draw parameters, independent of back-end library. More...
 
struct  h2d::fct::DTypeFunct
 
class  h2d::Ellipse_< FPT >
 Ellipse as a conic in matrix form. More...
 
class  h2d::Ellipse_< FPT >
 Ellipse as a conic in matrix form. More...
 
struct  h2d::detail::EllParams< T >
 Holds 9 parameters of Ellipse_. More...
 
struct  h2d::priv::F_MAX
 
struct  h2d::priv::F_MIN
 used in findPoint() More...
 
class  h2d::FRect_< FPT >
 A Flat Rectangle, modeled by its two opposite points. More...
 
class  h2d::FRect_< FPT >
 A Flat Rectangle, modeled by its two opposite points. More...
 
struct  h2d::trait::HasArea< T >
 Traits class, used to determine if we can use some "isInside()" function. More...
 
struct  h2d::trait::HasArea< base::PolylineBase< typename typ::IsClosed, T > >
 
struct  h2d::trait::HasArea< Circle_< T > >
 
struct  h2d::trait::HasArea< Ellipse_< T > >
 
struct  h2d::trait::HasArea< FRect_< T > >
 
struct  h2d::trait::HasBB< class >
 Traits class, used to check if type has a Bounding Box. More...
 
struct  h2d::trait::HasBB< base::PolylineBase< T1, T2 > >
 
struct  h2d::trait::HasBB< Circle_< T > >
 
struct  h2d::trait::HasBB< Ellipse_< T > >
 
struct  h2d::trait::HasBB< FRect_< T > >
 
struct  h2d::detail::HelperPL< typename >
 
struct  h2d::detail::HelperPL< typ::IsLine >
 
struct  h2d::detail::HelperPL< typ::IsPoint >
 
class  h2d::Hmatrix_< M, FPT >
 A 2D homography, defining a planar transformation. More...
 
class  h2d::Hmatrix_< M, FPT >
 A 2D homography, defining a planar transformation. More...
 
class  h2d::img::Image< T >
 Opaque data structure, will hold the image type, depending on back-end library. This type is the one used in all the drawing functions. More...
 
struct  h2d::priv::runion::Index< T >
 Holds x or y coordinate value of rectangle during computation of intersection area. More...
 
class  h2d::detail::Inters_1
 
class  h2d::detail::Inters_2
 
class  h2d::detail::Intersect< T, FPT >
 Base class for intersection, gets specialized. More...
 
class  h2d::detail::Intersect< Inters_1, FPT >
 One point intersection. More...
 
class  h2d::detail::Intersect< Inters_2, FPT >
 Two points intersection. More...
 
struct  h2d::detail::IntersectCommon
 Common stuff for intersection code. More...
 
class  h2d::detail::IntersectM< FPT >
 Multiple points intersections. More...
 
struct  h2d::trait::IsArray< T >
 Traits class used to detect if container T is a std::array. More...
 
struct  h2d::trait::IsArray< std::array< V, n > >
 
struct  h2d::trait::IsBigNumType< typename >
 
struct  h2d::trait::IsBigNumType< ttmath::Big< T1, T2 > >
 
struct  h2d::typ::IsClosed
 Used to determine the type of polyline (CPolyline_ or OPolyline_), see base::PolylineBase. More...
 
struct  h2d::trait::IsContainer< T >
 Traits class used in operator * ( const Hmatrix_<typ::IsHomogr,FPT>& h, const Cont& vin ), used to detect if container is valid. More...
 
struct  h2d::trait::IsContainer< std::array< T, N > >
 
struct  h2d::trait::IsContainer< std::list< Ts... > >
 
struct  h2d::trait::IsContainer< std::vector< Ts... > >
 
struct  h2d::trait::IsDrawable< T >
 Traits class, used in generic draw() function. More...
 
struct  h2d::trait::IsDrawable< base::PolylineBase< T1, T2 > >
 
struct  h2d::trait::IsDrawable< Circle_< T > >
 
struct  h2d::trait::IsDrawable< Ellipse_< T > >
 
struct  h2d::trait::IsDrawable< FRect_< T > >
 
struct  h2d::trait::IsDrawable< Line2d_< T > >
 
struct  h2d::trait::IsDrawable< OSegment_< T > >
 
struct  h2d::trait::IsDrawable< Point2d_< T > >
 
struct  h2d::trait::IsDrawable< Segment_< T > >
 
struct  h2d::typ::IsEpipmat
 
struct  h2d::typ::IsHomogr
 
struct  h2d::typ::IsLine
 Used to determine if line or point, see base::LPBase. More...
 
struct  h2d::typ::IsOpen
 
struct  h2d::typ::IsOSeg
 
struct  h2d::trait::IsPoint< class >
 
struct  h2d::typ::IsPoint
 
struct  h2d::trait::IsPoint< Point2d_< T > >
 
struct  h2d::trait::IsSegment< class >
 Traits class, used for getBB() set of functions. More...
 
struct  h2d::typ::IsSegment
 Used to determine the type of "point pair (segment or vector), see base::SegVec. More...
 
struct  h2d::trait::IsSegment< Segment_< T > >
 
struct  h2d::trait::IsShape< T >
 Traits class, used in intersects() for Polyline. More...
 
struct  h2d::trait::IsShape< base::PolylineBase< T1, T2 > >
 
struct  h2d::trait::IsShape< Circle_< T > >
 
struct  h2d::trait::IsShape< FRect_< T > >
 
struct  h2d::trait::IsShape< Line2d_< T > >
 
struct  h2d::trait::IsShape< OSegment_< T > >
 
struct  h2d::trait::IsShape< Segment_< T > >
 
struct  h2d::trait::IsVariant< T >
 
struct  h2d::trait::IsVariant< std::variant< Args... > >
 
struct  h2d::fct::LengthFunct
 A functor to get the length of an object in a std::variant, call with std::visit() More...
 
class  h2d::base::LPBase< LP, FPT >
 Base class, will be instanciated as Point2d_ or Line2d_. More...
 
class  h2d::base::LPBase< LP, FPT >
 Base class, will be instanciated as Point2d_ or Line2d_. More...
 
class  h2d::detail::Matrix_< FPT >
 A simple wrapper over a 3x3 matrix, provides root functionalities. More...
 
class  h2d::detail::Matrix_< FPT >
 A simple wrapper over a 3x3 matrix, provides root functionalities. More...
 
struct  h2d::priv::chull::Mystack
 Inherits std::stack<> and adds a member function to fetch the underlying std::vector. Used in h2d::convexHull() More...
 
struct  h2d::OffsetPolyParams
 Parameters for base::PolylineBase::getOffsetPoly() More...
 
struct  h2d::detail::PlHelper< typename >
 Helper class for PolylineBase, used as a trick to allow partial specialization of member functions. More...
 
struct  h2d::trait::PolIsClosed< T >
 This one is used in base;;PolylineBase::isInside() More...
 
struct  h2d::trait::PolIsClosed< base::PolylineBase< typename typ::IsClosed, T > >
 
struct  h2d::priv::PolylineAttribs
 Holds attribute of a Polyline, allows storage of last computed value through the use of ValueFlag. More...
 
class  h2d::base::PolylineBase< PLT, FPT >
 Polyline, will be instanciated either as OPolyline_ (open polyline) or CPolyline_. More...
 
class  h2d::base::PolylineBase< PLT, FPT >
 Polyline, will be instanciated either as OPolyline_ (open polyline) or CPolyline_. More...
 
struct  h2d::fct::PtPairFunct
 A functor to get pair of points englobing the element. More...
 
class  h2d::detail::RectArea< FPT >
 Helper class, holds result of intersections of two FRect_. More...
 
class  h2d::rtp::Root
 Non-templated root class, to achieve dynamic (runtime) polymorphism. More...
 
class  h2d::base::SegVec< SV, FPT >
 A line segment, oriented (OSegment_) or not (Segment_). Holds the two points. More...
 
class  h2d::base::SegVec< SV, FPT >
 A line segment, oriented (OSegment_) or not (Segment_). Holds the two points. More...
 
struct  h2d::fct::SizeFunct
 A functor to get the size (nb of points) of an object in a std::variant, call with std::visit() More...
 
struct  h2d::img::SvgImage
 A svg image as a wrapper around a string, see manual, "Drawing things" section. More...
 
struct  h2d::svg::svgp::SvgPathCommand
 Holds the current SVG "path" command, and the number of required numerical values. More...
 
struct  h2d::svg::svgp::SvgValuesBuffer
 This will hold the values read from the SVG Path parsing code, before they are converted to points. More...
 
struct  h2d::typ::T_Circle
 
struct  h2d::typ::T_CPol
 
struct  h2d::typ::T_Ellipse
 
struct  h2d::typ::T_FRect
 
struct  h2d::typ::T_Line
 
struct  h2d::typ::T_OPol
 
struct  h2d::typ::T_OSeg
 
struct  h2d::typ::T_Point
 
struct  h2d::typ::T_Segment
 
class  h2d::fct::TransformFunct< FPT >
 A functor used to apply a homography matrix to an object. More...
 
struct  h2d::fct::TypeFunct
 A functor to get the type of an object in a std::variant, call with std::visit() More...
 
class  h2d::priv::ValueFlag< T >
 A POD value that needs some computing, associated with its flag. Used to be able to retain a value needing complex calculation. More...
 
struct  h2d::fct::VariantUnwrapper< Ts >
 Convert std::variant object into the underlying type. More...
 
class  h2d::svg::Visitor
 Visitor class, derived from the tinyxml2 visitor class. Used to import SVG data. More...
 

Namespaces

 h2d
 
 h2d::base
 Holds base classes, not part of API.
 
 h2d::detail
 This namespace holds some private stuff, types here are not to be used directly by end-user code.
 
 h2d::err
 Holds static counters, for runtime errors and warnings.
 
 h2d::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.
 
 h2d::img
 Holds drawing related code, independent of back-end library.
 
 h2d::ppair
 Holds free functions returning a pair of points.
 
 h2d::priv
 Holds private stuff.
 
 h2d::priv::chull
 Holds convex hull code.
 
 h2d::priv::runion
 Common stuff for FRect_ union, see FRect_::unionArea()
 
 h2d::rtp
 Holds pointer-based runtime polymorphism stuff.
 
 h2d::svg
 Holds stuff related to SVG import.
 
 h2d::svg::svgp
 Private functions related to the SVG import code.
 
 h2d::thr
 Holds threshold values and api to access these.
 
 h2d::trait
 Holds traits classes.
 
 h2d::typ
 Holds the types needed for policy based design.
 

Macros

#define _USE_MATH_DEFINES
 
#define homog2d_abs   ttmath::Abs
 
#define homog2d_acos   ttmath::ACos
 
#define homog2d_asin   ttmath::ASin
 
#define HOMOG2D_ASSERT(a)
 
#define homog2d_atan   ttmath::ATan
 
#define HOMOG2D_BIND_X   x
 Internal type used for numerical computations, possible values: double, long double More...
 
#define HOMOG2D_BIND_Y   y
 
#define HOMOG2D_CHECK_IS_NUMBER(T)
 
#define HOMOG2D_CHECK_ROW_COL
 
#define homog2d_cos   ttmath::Cos
 
#define HOMOG2D_DEBUG_ASSERT(a, b)
 Assert debug macro, used internally if HOMOG2D_DEBUGMODE is defined. More...
 
#define HOMOG2D_ENABLE_VRTP
 
#define HOMOG2D_INUMTYPE   ttmath::Big<2,2>
 
#define HOMOG2D_LOG(a)   {;}
 
#define HOMOG2D_LOG_WARNING(a)
 
#define HOMOG2D_MAXITER_PIP   5
 Max number of iterations for "Point inside Polygon" algorithm. May be adjusted, see manual. More...
 
#define HOMOG2D_PRETTY_FUNCTION   __PRETTY_FUNCTION__
 
#define homog2d_sin   ttmath::Sin
 
#define homog2d_sqrt   ttmath::Sqrt
 
#define HOMOG2D_START
 
#define HOMOG2D_THR_ZERO_ANGLE   0.001
 
#define HOMOG2D_THR_ZERO_DENOM   1E-10
 
#define HOMOG2D_THR_ZERO_DETER   1E-15
 
#define HOMOG2D_THR_ZERO_DIST   1E-10
 
#define HOMOG2D_THR_ZERO_ORTHO_DIST   1E-14
 
#define HOMOG2D_THROW_ERROR_1(msg)
 Error throw wrapper macro. More...
 
#define HOMOG2D_THROW_ERROR_2(func, msg)
 Error throw wrapper macro, first arg is the function name. More...
 
#define HOMOG2D_VERSION   "2.13.1"
 
#define M_PI   3.14159265358979323846
 

Typedefs

using h2d::Circle = Circle_< HOMOG2D_INUMTYPE >
 Default circle type. More...
 
using h2d::CircleD = Circle_< double >
 
using h2d::CircleF = Circle_< float >
 
using h2d::CircleL = Circle_< long double >
 
using h2d::CommonType = CommonType_< HOMOG2D_INUMTYPE >
 
template<typename FPT >
using h2d::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 h2d::CommonTypeD = CommonType_< double >
 
using h2d::CommonTypeF = CommonType_< float >
 
using h2d::CommonTypeL = CommonType_< long double >
 
using h2d::CPolyline = CPolyline_< HOMOG2D_INUMTYPE >
 Default polyline type. More...
 
template<typename T >
using h2d::CPolyline_ = base::PolylineBase< typ::IsClosed, T >
 
using h2d::CPolylineD = CPolyline_< double >
 
using h2d::CPolylineF = CPolyline_< float >
 
using h2d::CPolylineL = CPolyline_< long double >
 
using h2d::Ellipse = Ellipse_< HOMOG2D_INUMTYPE >
 Default ellipse type. More...
 
using h2d::EllipseD = Ellipse_< double >
 
using h2d::EllipseF = Ellipse_< float >
 
using h2d::EllipseL = Ellipse_< long double >
 
using h2d::Epipmat = Hmatrix_< typ::IsEpipmat, HOMOG2D_INUMTYPE >
 Default homogeneous matrix, uses double as numerical type. More...
 
using h2d::FRect = FRect_< HOMOG2D_INUMTYPE >
 Default rectangle type. More...
 
using h2d::FRectD = FRect_< double >
 
using h2d::FRectF = FRect_< float >
 
using h2d::FRectL = FRect_< long double >
 
using h2d::Homogr = Homogr_< HOMOG2D_INUMTYPE >
 Default homography (3x3 matrix) type, uses double as numerical type. More...
 
template<typename T >
using h2d::Homogr_ = Hmatrix_< typ::IsHomogr, T >
 
using h2d::HomogrD = Homogr_< double >
 
using h2d::HomogrF = Homogr_< float >
 
using h2d::HomogrL = Homogr_< long double >
 
using h2d::Line2d = Line2d_< HOMOG2D_INUMTYPE >
 Default line type, uses double as numerical type. More...
 
template<typename T >
using h2d::Line2d_ = base::LPBase< typ::IsLine, T >
 
using h2d::Line2dD = Line2d_< double >
 
using h2d::Line2dF = Line2d_< float >
 
using h2d::Line2dL = Line2d_< long double >
 
template<typename T >
using h2d::detail::matrix_t = std::array< std::array< T, 3 >, 3 >
 An alias used to hold data of a 3x3 matrix, see detail::Matrix_. More...
 
using h2d::OPolyline = OPolyline_< HOMOG2D_INUMTYPE >
 
template<typename T >
using h2d::OPolyline_ = base::PolylineBase< typ::IsOpen, T >
 
using h2d::OPolylineD = OPolyline_< double >
 
using h2d::OPolylineF = OPolyline_< float >
 
using h2d::OPolylineL = OPolyline_< long double >
 
using h2d::OSegment = OSegment_< HOMOG2D_INUMTYPE >
 
template<typename T >
using h2d::OSegment_ = base::SegVec< typ::IsOSeg, T >
 
using h2d::OSegmentD = OSegment_< double >
 
using h2d::OSegmentF = OSegment_< float >
 
using h2d::OSegmentL = OSegment_< long double >
 
using h2d::priv::runion::PCoord = std::pair< uint8_t, uint8_t >
 
using h2d::Point2d = Point2d_< HOMOG2D_INUMTYPE >
 Default point type, uses double as numerical type. More...
 
template<typename T >
using h2d::Point2d_ = base::LPBase< typ::IsPoint, T >
 
using h2d::Point2dD = Point2d_< double >
 
using h2d::Point2dF = Point2d_< float >
 
using h2d::Point2dL = Point2d_< long double >
 
using h2d::PointPair = PointPair_< double >
 
template<typename T1 , typename T2 >
using h2d::PointPair2_ = std::pair< Point2d_< T1 >, Point2d_< T2 > >
 
template<typename T >
using h2d::PointPair_ = std::pair< Point2d_< T >, Point2d_< T > >
 
using h2d::PointPairD = PointPair_< double >
 
using h2d::PointPairF = PointPair_< float >
 
using h2d::PointPairL = PointPair_< long double >
 
using h2d::Segment = Segment_< HOMOG2D_INUMTYPE >
 Default segment type. More...
 
template<typename T >
using h2d::Segment_ = base::SegVec< typ::IsSegment, T >
 
using h2d::SegmentD = Segment_< double >
 
using h2d::SegmentF = Segment_< float >
 
using h2d::SegmentL = Segment_< long double >
 
using h2d::priv::runion::Table = std::array< std::array< Cell, 4 >, 4 >
 

Enumerations

enum  h2d::CardDir : int8_t { h2d::CardDir::Bottom, h2d::CardDir::Top, h2d::CardDir::Left, h2d::CardDir::Right }
 
enum  h2d::priv::runion::Direction : uint8_t { h2d::priv::runion::Direction::N, h2d::priv::runion::Direction::E, h2d::priv::runion::Direction::S, h2d::priv::runion::Direction::W }
 
enum  h2d::Dtype : uint8_t {
  h2d::Dtype::Float, h2d::Dtype::Double, h2d::Dtype::LongDouble, h2d::Dtype::Other,
  h2d::Dtype::Ttmath
}
 Type of underlying floating point, see LPBase::dtype(). Maybe printed out with getString() More...
 
enum  h2d::GivenCoord : uint8_t { h2d::GivenCoord::X, h2d::GivenCoord::Y }
 Used in Line2d::getValue() and getOrthogLine() More...
 
enum  h2d::LineDir : uint8_t { h2d::LineDir::H, h2d::LineDir::V }
 Used in line constructor, to instanciate a H or V line, see base::LPBase( LineDir, T ) More...
 
enum  h2d::svg::svgp::PathMode { h2d::svg::svgp::PathMode::Absolute, h2d::svg::svgp::PathMode::Relative }
 
enum  h2d::PointSide : uint8_t { h2d::PointSide::Left, h2d::PointSide::Right, h2d::PointSide::Neither }
 Point related to a OSegment. More...
 
enum  h2d::img::PtStyle : uint8_t {
  h2d::img::PtStyle::Plus, h2d::img::PtStyle::Times, h2d::img::PtStyle::Star, h2d::img::PtStyle::Diam,
  h2d::img::PtStyle::Squ, h2d::img::PtStyle::Dot
}
 Point drawing style, see DrawParams. More...
 
enum  h2d::detail::PtTag : uint8_t { h2d::detail::PtTag::Inside, h2d::detail::PtTag::Outside, h2d::detail::PtTag::OnEdge }
 See getPtLabel( const Point2d_<FPT>& pt, const Circle_<FPT2>& circle ) More...
 
enum  h2d::Rotate : int8_t {
  h2d::Rotate::CCW, h2d::Rotate::CW, h2d::Rotate::Full, h2d::Rotate::VMirror,
  h2d::Rotate::HMirror
}
 Used in base::PolylineBase_::rotate() member function. More...
 
enum  h2d::priv::runion::Turn : uint8_t { h2d::priv::runion::Turn::Left, h2d::priv::runion::Turn::Right }
 
enum  h2d::Type : uint8_t {
  h2d::Type::Line2d, h2d::Type::Point2d, h2d::Type::Segment, h2d::Type::OSegment,
  h2d::Type::FRect, h2d::Type::Circle, h2d::Type::Ellipse, h2d::Type::OPolyline,
  h2d::Type::CPolyline
}
 Type of Root object, see rtp::Root::type(). Maybe printed out with getString() More...
 

Functions

template<typename Cont , typename std::enable_if< trait::IsArray< Cont >::value, Cont >::type * = nullptr>
Cont h2d::priv::alloc (std::size_t)
 Allocation for std::array container. More...
 
template<typename FPT >
HOMOG2D_INUMTYPE h2d::angle (const Ellipse_< FPT > &ell)
 Return angle of ellipse (free function) More...
 
template<typename T >
HOMOG2D_INUMTYPE h2d::area (const T &elem)
 Returns area of element or variant (free function) More...
 
template<typename FPT >
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. More...
 
template<typename T1 , typename T2 >
bool h2d::areParallel (const T1 &t1, const T2 &t2)
 Returns true is lines (or segments) are parallel. More...
 
template<typename FPT >
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) More...
 
template<typename FPT >
Homogr_< FPT > h2d::detail::buildFrom4Points_Opencv (const std::vector< Point2d_< FPT >> &vpt1, const std::vector< Point2d_< FPT >> &vpt2)
 Build Homography from 2 sets of 4 points, using Opencv. More...
 
template<typename FPT >
Point2d_< FPT > & h2d::center (Circle_< FPT > &cir)
 Returns reference on center of circle (free function), non-const version. More...
 
template<typename FPT >
const Point2d_< FPT > & h2d::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 > h2d::centroid (const base::PolylineBase< PLT, FPT > &pl)
 Returns centroid of Polyline (free function) More...
 
template<typename FPT >
CPolyline_< FPT > h2d::priv::runion::convertToCoord (const std::vector< PCoord > &v_coord, const std::array< Index< FPT >, 4 > &v_x, const std::array< Index< FPT >, 4 > &v_y)
 Helper function, used in FRect_<FPT>::unionArea() More...
 
template<typename CT , typename FPT >
CPolyline_< FPT > h2d::convexHull (const base::PolylineBase< CT, FPT > &input)
 Compute Convex Hull of a Polyline (free function) More...
 
template<typename FPT >
CPolyline_< FPT > h2d::base::convexHull (const std::vector< Point2d_< FPT >> &input)
 Computes and returns the convex hull of a set of points (free function) More...
 
template<typename T1 , typename T2 , typename FPT1 , typename FPT2 >
base::LPBase< T1, FPT1 > h2d::detail::crossProduct (const base::LPBase< T2, FPT1 > &, const base::LPBase< T2, FPT2 > &)
 
template<typename Out , typename In , typename FPT1 , typename FPT2 >
base::LPBase< Out, FPT1 > h2d::detail::crossProduct (const base::LPBase< In, FPT1 > &r1, const base::LPBase< In, FPT2 > &r2)
 Cross product of points * points or line * line. More...
 
template<typename FPT1 , typename FPT2 >
HOMOG2D_INUMTYPE h2d::detail::crossProductV (const base::SegVec< typ::IsOSeg, FPT1 > &v1, const base::SegVec< typ::IsOSeg, FPT2 > &v2)
 Cross product of two oriented segments, return a scalar. More...
 
template<typename FPT1 , typename FPT2 >
HOMOG2D_INUMTYPE h2d::dist (const Point2d_< FPT1 > &pt1, const Point2d_< FPT2 > &pt2)
 Free function, distance between points. More...
 
static bool & h2d::thr::doNotCheckRadius ()
 This one is used for the Welzl minimum enclosing circle. More...
 
template<typename U , typename Prim , typename std::enable_if< trait::IsDrawable< Prim >::value, Prim >::type * = nullptr>
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. More...
 
template<typename U , typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr>
void h2d::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 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. More...
 
template<typename T1 , typename T2 , typename U >
void h2d::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 T >
void h2d::detail::drawPt (img::Image< T > &img, img::PtStyle ps, std::vector< Point2d_< float >> vpt, const img::DrawParams &dp, bool drawDiag=false)
 Private helper function, used by LPBase<IsPoint>::draw(). Draw point on image. More...
 
template<typename T >
void h2d::priv::drawSvgSeg (img::Image< img::SvgImage > &im, const Point2d_< T > &pt1, const Point2d_< T > &pt2, std::string color, int thickness, std::string attribs=std::string())
 Helper function to draw SVG segment. More...
 
template<typename T >
void h2d::priv::drawSvgSeg (img::Image< img::SvgImage > &im, const std::pair< Point2d_< T >, Point2d_< T >> &ppts, std::string color, int thickness, std::string attribs=std::string())
 
template<typename U , typename FPT >
void h2d::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 > h2d::dsize (const T &t)
 Get data size expressed as number of bits for, respectively, mantissa and exponent. More...
 
template<typename T >
Dtype h2d::dtype (const T &elem)
 Returns the underlying data type of object or variant. More...
 
size_t & h2d::err::errorCount ()
 Used to count the errors. More...
 
template<typename FPT , typename T >
size_t h2d::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 h2d::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 h2d::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 , typename CONT , typename S_WHAT >
size_t h2d::priv::findPoint (const Point2d_< FPT > &qpt, const CONT &cont, const S_WHAT &)
 Private. Common function for searching nearest of farthest point. More...
 
template<typename FPT >
void h2d::priv::fix_order (Point2d_< FPT > &ptA, Point2d_< FPT > &ptB)
 Private free function, swap the points so that ptA.x <= ptB.x, and if equal, sorts on y. More...
 
Point2d_< double > h2d::svg::svgp::generateNewPoint (SvgPathCommand mode, Point2d_< double > prevPt, const std::vector< double > &val)
 Generate new point from current mode and previous point, handles absolute/relative coordinates. More...
 
std::vector< img::Color > h2d::img::genRandomColors (size_t nb, int minval=20, int maxval=250)
 Helper function, will generate a vector of nb random RGB colors. More...
 
template<typename FPT >
std::array< Point2d_< FPT >, 4 > h2d::get4Pts (const FRect_< FPT > &rect)
 Returns the 4 points of the rectangle (free function) More...
 
template<typename T1 , typename T2 >
HOMOG2D_INUMTYPE h2d::getAngle (const T1 &t1, const T2 &t2)
 Free function, returns angle between two segments/lines. More...
 
template<typename FPT >
std::array< PointPair_< double >, 3 > h2d::priv::getArrowSegments (const base::SegVec< typ::IsOSeg, FPT > &vec)
 
const char * h2d::svg::svgp::getAttribString (const char *attribName, const tinyxml2::XMLElement &e)
 Helper function for SVG import. More...
 
double h2d::svg::svgp::getAttribValue (const tinyxml2::XMLElement &e, const char *str, std::string e_name)
 Fetch attribute from XML element. Tag e_name is there just in case of trouble. More...
 
template<typename FPT >
std::pair< Line2d_< FPT >, Line2d_< FPT > > h2d::getAxisLines (const Ellipse_< FPT > &ell)
 Returns ellipse axis lines. More...
 
template<typename T >
FRect_< HOMOG2D_INUMTYPEh2d::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 h2d::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 h2d::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 >
auto h2d::priv::getBB_CommonType (const std::vector< CommonType_< FPT >> &v_var)
 Get Bounding Box for a container holding variant objects. More...
 
template<typename FPT >
auto h2d::priv::getBB_FRect (const std::vector< FRect_< FPT >> &v_rects)
 get BB for a set of FRect_ objects More...
 
template<typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr>
PointPair_< typename T::value_type::FType > h2d::priv::getBB_Points (const T &vpts)
 Returns the bounding box of points in vector/list/array of points vpts (free function) More...
 
template<typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr>
FRect_< typename T::value_type::FType > h2d::priv::getBB_Segments (const T &vsegs)
 Returns the bounding box of segments in vector/list/array of points vsegs. More...
 
template<typename FPT >
Line2d_< FPT > h2d::getBisector (const Segment_< FPT > &seg)
 Free function, returns bisector line of segment. More...
 
template<typename PLT , typename FPT >
std::vector< Line2d_< HOMOG2D_INUMTYPE > > h2d::getBisectorLines (const base::PolylineBase< PLT, FPT > &pl)
 Returns bisector lines of a Polyline. More...
 
template<typename T >
auto h2d::getBmPoint (const T &t)
 Return Bottom-most point of container holding points. More...
 
template<typename PLT , typename FPT >
Point2d_< FPT > h2d::getBmPoint (const base::PolylineBase< PLT, FPT > &poly)
 Return Bottom-most point of Polyline (free function) More...
 
template<typename T >
auto h2d::priv::getBmPoint_helper (const T &t)
 Return iterator on Bottom-most point of container holding points. More...
 
template<typename FPT >
Circle_< FPT > h2d::getBoundingCircle (const FRect_< FPT > &rect)
 Returns circle passing through 4 points of flat rectangle (free function) More...
 
template<typename FPT >
Point2d_< FPT > h2d::getCenter (const Segment_< FPT > &seg)
 Free function, returns middle point of segment. More...
 
template<typename T >
Point2d_< typename T::FType > h2d::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 h2d::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 > 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) More...
 
SvgPathCommand h2d::svg::svgp::getCommand (char c)
 
template<typename FPT >
PointPair_< FPT > h2d::detail::getCorrectPoints (const Point2d_< FPT > &p0, const Point2d_< FPT > &p1)
 Private free function, get top-left and bottom-right points from two arbitrary points. More...
 
template<typename FPT >
cv::Point2d h2d::getCvPtd (const Point2d_< FPT > &pt)
 Free function to return an OpenCv point (double) More...
 
template<typename FPT >
cv::Point2f h2d::getCvPtf (const Point2d_< FPT > &pt)
 Free function to return an OpenCv point (float) More...
 
template<typename FPT >
cv::Point2i h2d::getCvPti (const Point2d_< FPT > &pt)
 Free function to return an OpenCv point (integer) More...
 
template<typename FPT >
std::pair< Segment_< FPT >, Segment_< FPT > > h2d::getDiagonals (const FRect_< FPT > &rect)
 Free function. More...
 
std::pair< Point2d_< HOMOG2D_INUMTYPE >, HOMOG2D_INUMTYPEh2d::svg::svgp::getEllipseRotateAttr (const char *rot_str)
 Importing rotated ellipse from SVG data. More...
 
template<typename FPT >
Segment_< FPT > h2d::getExtended (const Segment_< FPT > &seg)
 Returns Extended Segment (free function) More...
 
template<typename FPT >
FRect_< FPT > h2d::getExtended (const FRect_< FPT > &rect)
 Free function. More...
 
template<typename T >
auto h2d::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 > h2d::getFRect (cv::Mat &mat)
 
auto h2d::svg::getImgSize (const tinyxml2::XMLDocument &doc)
 Fetch size of image in SVG file. More...
 
template<typename FPT >
Circle_< FPT > h2d::getInscribedCircle (const FRect_< FPT > &rect)
 Return circle inscribed in rectangle. More...
 
template<typename PT >
std::array< PT, 3 > h2d::priv::getLargestDistancePoints (PT pt1, PT pt2, PT pt3)
 Helper function, used to check for colinearity of three points. More...
 
template<typename FPT >
Line2d_< FPT > h2d::getLine (const Segment_< FPT > &seg)
 Returns Segment supporting line (free function) More...
 
template<typename FPT1 , typename FPT2 , typename FPT3 >
Line2d_< FPT1 > h2d::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 h2d::getLines (const T &vsegs)
 Free function, returns a set of lines from a set of segments. More...
 
template<typename T >
auto h2d::getLmPoint (const T &t)
 Return Left-most point of container as a pair holding: More...
 
template<typename PLT , typename FPT >
Point2d_< FPT > h2d::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 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. More...
 
std::string h2d::svg::svgp::getNextElem (const std::string &str, std::string::const_iterator &it)
 Get next element in svg path string. More...
 
template<typename FPT >
CPolyline_< FPT > h2d::getOBB (const Ellipse_< FPT > &ell)
 Returns Bounding Box of Ellipse_ (free function) More...
 
template<typename T1 , typename T2 >
Line2d_< T1 > h2d::priv::getOrthogonalLine_B2 (const Point2d_< T2 > &pt, const Line2d_< T1 > &li)
 Helper function for impl_getOrthogonalLine_A() and impl_getOrthogonalLine_B(), Compute orthogonal line to li at point pt (that must lie on the line) More...
 
template<typename FPT >
std::array< Point2d_< FPT >, 4 > h2d::getOrthogPts (const Segment_< FPT > &seg)
 Returns the 4 orthogonal points to the segment. More...
 
template<typename FPT >
std::array< Segment_< FPT >, 4 > h2d::getOrthogSegs (const Segment_< FPT > &seg)
 Returns the 4 orthogonal segments to the segment. More...
 
template<typename FPT >
HOMOG2D_INUMTYPE h2d::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 > > h2d::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 > > h2d::getParallelSegs (const Segment_< FPT > &seg, T dist)
 Free function, returns a pair of parallel segments at a distance dist. More...
 
template<typename FPT >
size_t h2d::priv::chull::getPivotPoint (const std::vector< Point2d_< FPT >> &in)
 Used int the convex hull algorithm. More...
 
template<typename T >
auto h2d::ppair::getPointPair (const T &elem)
 Returns pair of points defining a BB of a primitive Overload 1/4, private free function. More...
 
template<typename T , typename std::enable_if< std::is_same< T, Point2d_< typename T::FType >>::value, T >::type * = nullptr>
auto h2d::ppair::getPointPair (const T &elem)
 Returns pair of points defining a BB of a Point2d Overload 3/4, private free function. More...
 
template<typename FPT >
PointPair_< FPT > h2d::ppair::getPointPair (const Line2d_< FPT > &)
 Needed because of variant. More...
 
template<typename FPT , typename FPT2 , typename FPT3 >
auto h2d::priv::getPoints_B2 (const Point2d_< FPT > &pt, FPT2 dist, const Line2d_< FPT3 > &li)
 Helper function, factorized here for the two impl_getPoints_A() implementations. More...
 
template<typename RT , typename FPT >
RT h2d::getPt (const Point2d_< FPT > &pt)
 Generic free function to return a point of other type. More...
 
template<typename FPT , typename FPT2 >
PtTag h2d::detail::getPtLabel (const Point2d_< FPT > &pt, const Circle_< FPT2 > &circle)
 Returns a label characterizing point pt, related to circle: inside, outside, or on edge of circle. More...
 
template<typename RT , typename FPT >
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. More...
 
template<typename FPT >
auto h2d::getPts (const Segment_< FPT > &seg)
 Returns the points of Segment as a std::pair (free function) More...
 
template<typename FPT >
auto h2d::getPts (const FRect_< FPT > &rect)
 Returns the 2 major points of the rectangle (free function) More...
 
template<typename CONT , typename PRIM >
CONT h2d::getPtsInside (const CONT &input_set, const PRIM &prim)
 Returns set of points that are inside primitive prim. More...
 
template<typename T >
auto h2d::getRmPoint (const T &t)
 Return Right-most point of container holding points. More...
 
template<typename PLT , typename FPT >
Point2d_< FPT > h2d::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 > h2d::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 > > h2d::getSegs (const base::PolylineBase< PLT, FPT > &pl)
 Returns the segments of the polyline (free function) More...
 
template<typename FPT >
std::array< Segment_< FPT >, 4 > h2d::getSegs (const FRect_< FPT > &seg)
 Free function, returns segments of the rectangle. More...
 
const char * h2d::img::getString (PtStyle t)
 
const char * h2d::getString (Type t)
 Returns stringified version of type() More...
 
const char * h2d::getString (Dtype t)
 
const char * h2d::getString (PointSide t)
 
template<typename FPT1 , typename FPT2 >
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. More...
 
template<typename T >
auto h2d::getTmPoint (const T &t)
 Return Top-most point of container. More...
 
template<typename PLT , typename FPT >
Point2d_< FPT > h2d::getTmPoint (const base::PolylineBase< PLT, FPT > &poly)
 Return Top-most point of Polyline (free function) More...
 
template<typename FPT >
FPT h2d::getX (const Point2d_< FPT > &pt)
 
template<typename FPT >
FPT h2d::getY (const Point2d_< FPT > &pt)
 
template<typename FPT >
HOMOG2D_INUMTYPE h2d::height (const FRect_< FPT > &rect)
 Free function. More...
 
template<typename IMG , typename FPT >
void h2d::priv::impl_drawIndexes (img::Image< IMG > &img, size_t c, const img::DrawParams &dp, const Point2d_< FPT > &pt)
 Draw indexes for points. More...
 
template<typename IMG , typename FPT >
void h2d::priv::impl_drawIndexes (img::Image< IMG > &img, size_t c, const img::DrawParams &dp, const Segment_< FPT > &seg)
 Draw indexes for segment. More...
 
template<typename IMG , typename DUMMY >
void h2d::priv::impl_drawIndexes (img::Image< IMG > &, size_t, const img::DrawParams &, const DUMMY &)
 Default signature, will be instanciated if no other fits (and does nothing) More...
 
template<typename T >
std::pair< int, int > h2d::priv::impl_dsize (const detail::DataFpType< T > &)
 Implementation of dsize(), returns nb of bits of mantissa and exponent (default implementation) More...
 
template<long unsigned int M, long unsigned int E>
std::pair< int, int > h2d::priv::impl_dsize (const detail::DataFpType< ttmath::Big< M, E >> &)
 Implementation for ttmath types. More...
 
Dtype h2d::priv::impl_dtype (const detail::DataFpType< float > &)
 
Dtype h2d::priv::impl_dtype (const detail::DataFpType< double > &)
 
Dtype h2d::priv::impl_dtype (const detail::DataFpType< long double > &)
 
template<typename T >
Dtype h2d::priv::impl_dtype (const detail::DataFpType< T > &)
 
template<long unsigned int M, long unsigned int E>
Dtype h2d::priv::impl_dtype (const detail::DataFpType< ttmath::Big< M, E >> &)
 Implementation for ttmath types. More...
 
std::vector< Point2d > h2d::svg::svgp::importSvgPoints (const tinyxml2::XMLElement &e)
 Helper function called by Visitor::VisitExit() to process Polyline/Polygons. More...
 
template<typename FPT1 , typename FPT2 >
detail::RectArea< FPT1 > h2d::intersectArea (const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2)
 Free function, see FRect_::intersectArea() More...
 
template<typename FPT1 , typename FPT2 >
HOMOG2D_INUMTYPE h2d::IoU (const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2)
 Intersection area over Union area (free function) More...
 
template<typename FPT1 , typename PT >
bool h2d::priv::is_valid_circle (const Circle_< FPT1 > &circ, const std::vector< PT > &pts)
 Free Function to check whether a circle encloses the given points. More...
 
template<typename FPT >
bool h2d::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 h2d::isConvex (const base::PolylineBase< PLT, FPT > &poly)
 Returns true if polygon is convex (free function) More...
 
bool h2d::svg::svgp::isDigit (char c)
 
template<typename PLT , typename FPT >
bool h2d::isSimple (const base::PolylineBase< PLT, FPT > &pl)
 Returns true if is a polygon (free function)   More...
 
template<typename T >
HOMOG2D_INUMTYPE h2d::length (const T &elem)
 Returns length of element or variant (free function) More...
 
template<typename T , typename FP >
void h2d::moveTo (T &prim, const Point2d_< FP > &pt)
 Move primitive to other location (free function) More...
 
template<typename T , typename FP1 , typename FP2 >
void h2d::moveTo (T &prim, FP1 x, FP2 y)
 Move primitive to other location (free function) More...
 
void h2d::priv::runion::moveToNextCell (uint8_t &row, uint8_t &col, const Direction &dir)
 
template<typename PLT , typename FPT >
size_t h2d::nbSegs (const base::PolylineBase< PLT, FPT > &pl)
 Returns the number of segments (free function) More...
 
static HOMOG2D_INUMTYPEh2d::thr::nullAngleValue ()
 
static HOMOG2D_INUMTYPEh2d::thr::nullDenom ()
 
static HOMOG2D_INUMTYPEh2d::thr::nullDeter ()
 
static HOMOG2D_INUMTYPEh2d::thr::nullDistance ()
 
static HOMOG2D_INUMTYPEh2d::thr::nullOrthogDistance ()
 
std::map< char, int > & h2d::svg::svgp::numberValues ()
 Returns nb of expected values for a given SVG path command. Ref: https://www.w3.org/TR/SVG2/paths.html. More...
 
template<typename T , typename U >
Line2d_< T > h2d::operator* (const Homogr_< U > &h, const Line2d_< T > &in)
 Free function, apply homography to a line. More...
 
template<typename T1 , typename T2 >
Matrix_< T1 > h2d::detail::operator* (const Matrix_< T1 > &h1, const Matrix_< T2 > &h2)
 
template<typename FPT , typename FPT2 >
Line2d_< FPT > h2d::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 > h2d::operator* (const Point2d_< FPT1 > &, const Point2d_< FPT2 > &)
 
template<typename FPT1 , typename FPT2 >
Point2d_< FPT1 > h2d::operator* (const Line2d_< FPT1 > &, const Line2d_< FPT2 > &)
 
template<typename FPT1 , typename FPT2 >
CPolyline_< FPT1 > h2d::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 h2d::operator* (const Homogr_< FPT2 > &, const base::PolylineBase< PLT2, FPT1 > &) -> base::PolylineBase< PLT2, FPT1 >
 
template<typename FPT , typename FPT2 >
Point2d_< FPT > h2d::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 > h2d::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 > h2d::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 > h2d::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 > h2d::operator* (const Homogr_< FPT2 > &h, const base::PolylineBase< PLT, FPT1 > &pl)
 Apply homography to a Polyline. More...
 
template<typename FPT1 , typename FPT2 >
Ellipse_< FPT1 > h2d::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 > h2d::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 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. More...
 
template<typename LP , typename FPT >
auto h2d::base::operator<< (std::ostream &, const h2d::base::LPBase< LP, FPT > &) -> std::ostream &
 Stream operator, free function, call member function pseudo operator impl_op_stream() More...
 
template<typename T1 , typename T2 >
auto h2d::base::operator<< (std::ostream &, const h2d::base::PolylineBase< T1, T2 > &) -> std::ostream &
 
template<typename U >
std::ostream & h2d::detail::operator<< (std::ostream &f, const EllParams< U > &par)
 
template<typename LP , typename FPT >
std::ostream & h2d::base::operator<< (std::ostream &f, const h2d::base::LPBase< LP, FPT > &pl)
 Stream operator, free function, call member function pseudo operator impl_op_stream() More...
 
template<typename T , typename std::enable_if< trait::IsContainer< T >::value, T >::type * = nullptr>
std::ostream & h2d::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 & 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. More...
 
template<typename T >
std::ostream & h2d::operator<< (std::ostream &f, const FRect_< T > &r)
 
template<typename T >
std::ostream & h2d::operator<< (std::ostream &f, const Circle_< T > &r)
 
template<typename SV , typename T >
std::ostream & h2d::base::operator<< (std::ostream &f, const h2d::base::SegVec< SV, T > &seg)
 
template<typename PLT , typename FPT >
std::ostream & h2d::base::operator<< (std::ostream &f, const h2d::base::PolylineBase< PLT, FPT > &pl)
 
template<typename T >
std::ostream & h2d::operator<< (std::ostream &f, const Ellipse_< T > &ell)
 
std::ostream & h2d::img::operator<< (std::ostream &f, const Image< SvgImage > &im)
 Streaming operator (only defined for SVG) More...
 
std::ostream & h2d::rtp::operator<< (std::ostream &f, const Root &p)
 Stream operator for Root type. More...
 
template<typename T >
int h2d::priv::chull::orientation (Point2d_< T > p, Point2d_< T > q, Point2d_< T > r)
 To find orientation of ordered triplet of points (p, q, r). More...
 
template<typename ST , typename PLT , typename FPT >
std::vector< ST > h2d::priv::p_getSegs (const base::PolylineBase< PLT, FPT > &pl, const ST &)
 Private helper function for base::PolylineBase::getSegs() and base::PolylineBase::getOSegs() More...
 
auto h2d::svg::svgp::parsePath (const char *s)
 Parse a SVG "path" string and convert it to a vector holding a set (vector) of points. More...
 
std::vector< Point2d > h2d::svg::svgp::parsePoints (const char *pts)
 Svg import: Basic parsing of points that are in the format "10,20 30,40 50,60". More...
 
std::vector< PCoord > h2d::priv::runion::parseTable (Table &table)
 Helper function for FRect_<FPT>::unionArea() More...
 
void h2d::svg::printFileAttrib (const tinyxml2::XMLDocument &doc)
 
void h2d::thr::printThresholds (std::ostream &f)
 Helper function, could be needed. More...
 
bool & h2d::err::printWarnings ()
 User can use this to silence warnings at runtime. More...
 
template<typename FPT1 , typename FPT2 , typename FPT3 >
void h2d::detail::product (Matrix_< FPT1 > &out, const Matrix_< FPT2 > &h1, const Matrix_< FPT3 > &h2)
 Implementation of product 3x3 by 3x3. More...
 
template<typename T1 , typename T2 , typename FPT1 , typename FPT2 >
void h2d::detail::product (base::LPBase< T1, FPT1 > &out, const Matrix_< FPT2 > &h, const base::LPBase< T2, FPT1 > &in)
 Implementation of product 3x3 by 3x1. More...
 
template<typename FPT1 , typename FPT2 >
bool h2d::detail::ptIsInside (const Point2d_< FPT1 > &pt, const Point2d_< FPT2 > &p00, const Point2d_< FPT2 > &p11)
 Private free function, returns true if point pt is inside the rectangle defined by (p00 , p11) More...
 
template<typename FPT >
std::vector< Point2d_< FPT > > h2d::svg::svgp::purgeSetDupes (const std::vector< Point2d_< FPT >> &pts)
 Removes dupes in set of points. Needed when importing SVG files using a "path" command, because sometimes they hold duplicates points, and that can't be in polylines. More...
 
template<typename FPT >
FPT & h2d::radius (Circle_< FPT > &cir)
 Returns reference on radius of circle (free function), non-const version. More...
 
template<typename FPT >
const FPT & h2d::radius (const Circle_< FPT > &cir)
 Returns reference on radius of circle (free function), const version. More...
 
template<typename T >
void h2d::rotate (T &prim, Rotate rot)
 Rotates the primitive (only available for Polyline and FRect) around (0,0) More...
 
template<typename T , typename FPT >
void h2d::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 >
bool h2d::detail::shareCommonCoord (const Point2d_< FPT1 > &p1, const Point2d_< FPT2 > &p2)
 Returns true if one of the points share a common coordinate (thus making them unable to define a bounding box) More...
 
template<typename FPT1 , typename FPT2 >
bool h2d::detail::shareCommonCoord (const std::pair< Point2d_< FPT1 >, Point2d_< FPT2 >> &ppts)
 Returns true if one of the points share a common coordinate (thus making them unable to define a bounding box) More...
 
template<typename FPT1 , typename FPT2 >
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. More...
 
template<typename T >
int h2d::priv::sign (T val)
 Get sign of value. More...
 
template<typename T >
HOMOG2D_INUMTYPE h2d::size (const T &elem)
 Returns size of element or variant (free function) More...
 
template<typename FPT >
std::vector< size_t > h2d::priv::chull::sortPoints (const std::vector< Point2d_< FPT >> &in, size_t piv_idx)
 Sorts points by angle between the lines with horizontal axis. More...
 
template<typename SV , typename FPT >
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) More...
 
template<typename FPT , typename T >
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) More...
 
template<typename FPT1 , typename FPT2 >
HOMOG2D_INUMTYPE h2d::priv::sqDist (const Point2d_< FPT1 > &pt1, const Point2d_< FPT2 > &pt2)
 Free function, squared distance between points (sqrt not needed for comparisons, and can save some time) More...
 
bool h2d::svg::svgp::svgPathCommandIsAllowed (char c)
 
std::vector< std::string > h2d::svg::svgp::tokenize (const std::string &s, char delim)
 General string tokenizer, taken from http://stackoverflow.com/a/236803/193789. More...
 
template<typename T , typename FPT >
CommonType_< FPT > h2d::transform (const Homogr_< FPT > &h, const T &elem)
 Apply homography to primitive. More...
 
template<typename T , typename FP1 , typename FP2 >
void h2d::translate (T &prim, FP1 dx, FP2 dy)
 Translate primitive prim (free function) More...
 
template<typename T , typename FP1 , typename FP2 >
void h2d::translate (T &prim, const std::pair< FP1, FP2 > &ppt)
 Translate primitive prim with values in a std::pair (free function) More...
 
Direction h2d::priv::runion::turn (Direction dir, Turn turn)
 
template<typename T >
Type h2d::type (const T &elem)
 Free function. Returns the type of object or variant. More...
 
template<typename FPT1 , typename FPT2 >
CPolyline_< FPT1 > h2d::unionArea (const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2)
 Free function, see FRect_::unionArea() More...
 
template<typename... Ts>
 h2d::fct::VariantUnwrapper (const std::variant< Ts... > &) -> VariantUnwrapper< Ts... >
 Fix for the above VariantUnwrapper for C++17. More...
 
size_t & h2d::err::warningCount ()
 Used in macro HOMOG2D_LOG_WARNING. More...
 
template<typename FPT >
HOMOG2D_INUMTYPE h2d::width (const FRect_< FPT > &rect)
 Free function. More...
 

Detailed Description

single header file, implements some 2D homogeneous stuff. See https://github.com/skramm/homog2d

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

◆ homog2d_abs

#define homog2d_abs   ttmath::Abs

◆ homog2d_acos

#define homog2d_acos   ttmath::ACos

◆ homog2d_asin

#define homog2d_asin   ttmath::ASin

◆ HOMOG2D_ASSERT

#define HOMOG2D_ASSERT (   a)
Value:
if( !(a) ) \
{ \
std::cerr << "ASSERT FAILURE, line=" << __LINE__ << std::endl; \
std::exit(1); \
}

◆ homog2d_atan

#define homog2d_atan   ttmath::ATan

◆ HOMOG2D_BIND_X

#define HOMOG2D_BIND_X   x

Internal type used for numerical computations, possible values: double, long double

◆ HOMOG2D_BIND_Y

#define HOMOG2D_BIND_Y   y

◆ HOMOG2D_CHECK_IS_NUMBER

#define HOMOG2D_CHECK_IS_NUMBER (   T)

◆ HOMOG2D_CHECK_ROW_COL

#define HOMOG2D_CHECK_ROW_COL
Value:
if( r > 2 ) \
throw std::runtime_error( "Error: invalid row value: r=" + std::to_string(r) ); \
if( c > 2 ) \
throw std::runtime_error( "Error: invalid col value: r=" + std::to_string(r) )

◆ homog2d_cos

#define homog2d_cos   ttmath::Cos

◆ HOMOG2D_DEBUG_ASSERT

#define HOMOG2D_DEBUG_ASSERT (   a,
 
)
Value:
{ \
if( (a) == false ) \
{ \
std::cerr << "Homog2d assert failure, version:" << HOMOG2D_VERSION \
<< ", line:" << __LINE__ << "\n -details: " << b << '\n'; \
std::cout << "homog2d: internal failure, please check stderr and report this on https://github.com/skramm/homog2d/issues\n"; \
std::exit(1); \
} \
}
#define HOMOG2D_VERSION
Definition: homog2d.hpp:231

Assert debug macro, used internally if HOMOG2D_DEBUGMODE is defined.

◆ HOMOG2D_ENABLE_VRTP

#define HOMOG2D_ENABLE_VRTP

◆ HOMOG2D_INUMTYPE

#define HOMOG2D_INUMTYPE   ttmath::Big<2,2>

◆ HOMOG2D_LOG

#define HOMOG2D_LOG (   a)    {;}

◆ HOMOG2D_LOG_WARNING

#define HOMOG2D_LOG_WARNING (   a)
Value:
if( err::printWarnings() == true ) \
std::cerr << "homog2d warning (" << ++err::warningCount() << "), l. " << __LINE__ << ": " << a << "\n";
size_t & warningCount()
Used in macro HOMOG2D_LOG_WARNING.
Definition: homog2d.hpp:258
bool & printWarnings()
User can use this to silence warnings at runtime.
Definition: homog2d.hpp:265

◆ HOMOG2D_MAXITER_PIP

#define HOMOG2D_MAXITER_PIP   5

Max number of iterations for "Point inside Polygon" algorithm. May be adjusted, see manual.

◆ HOMOG2D_PRETTY_FUNCTION

#define HOMOG2D_PRETTY_FUNCTION   __PRETTY_FUNCTION__

◆ homog2d_sin

#define homog2d_sin   ttmath::Sin

◆ homog2d_sqrt

#define homog2d_sqrt   ttmath::Sqrt

◆ HOMOG2D_START

#define HOMOG2D_START

◆ HOMOG2D_THR_ZERO_ANGLE

#define HOMOG2D_THR_ZERO_ANGLE   0.001

◆ HOMOG2D_THR_ZERO_DENOM

#define HOMOG2D_THR_ZERO_DENOM   1E-10

◆ HOMOG2D_THR_ZERO_DETER

#define HOMOG2D_THR_ZERO_DETER   1E-15

◆ HOMOG2D_THR_ZERO_DIST

#define HOMOG2D_THR_ZERO_DIST   1E-10

◆ HOMOG2D_THR_ZERO_ORTHO_DIST

#define HOMOG2D_THR_ZERO_ORTHO_DIST   1E-14

◆ HOMOG2D_THROW_ERROR_1

#define HOMOG2D_THROW_ERROR_1 (   msg)
Value:
{ \
std::ostringstream oss; \
oss << "homog2d: line " << __LINE__ << ", function:" << __FUNCTION__ << "(): " \
<< msg << "\n -full function name: " << HOMOG2D_PRETTY_FUNCTION \
<< "\n -Error count=" << ++err::errorCount(); \
throw std::runtime_error( oss.str() ); \
}
#define HOMOG2D_PRETTY_FUNCTION
Definition: homog2d.hpp:98
size_t & errorCount()
Used to count the errors.
Definition: homog2d.hpp:251

Error throw wrapper macro.

◆ HOMOG2D_THROW_ERROR_2

#define HOMOG2D_THROW_ERROR_2 (   func,
  msg 
)
Value:
{ \
std::ostringstream oss; \
oss << "homog2d: line " << __LINE__ << ", function:" << func << "(): " \
<< msg << "\n -full function name: " << HOMOG2D_PRETTY_FUNCTION \
<< "\n -Error count=" << ++err::errorCount(); \
throw std::runtime_error( oss.str() ); \
}
#define HOMOG2D_PRETTY_FUNCTION
Definition: homog2d.hpp:98
size_t & errorCount()
Used to count the errors.
Definition: homog2d.hpp:251

Error throw wrapper macro, first arg is the function name.

◆ HOMOG2D_VERSION

#define HOMOG2D_VERSION   "2.13.1"

◆ M_PI

#define M_PI   3.14159265358979323846