namespace geometry
Geometry namespace hides geometry specific implementation details from the rest of the library.
Summary
| Members | Descriptions |
|---|---|
classDiscreteFrechet |
|
classRDPSimplifier |
|
classTriangleMesh |
|
public template<int I> inline float get(constpoint_type& p) |
Gets the ith component from a point. |
public template<int I> inline float get(constplanar_point& p) |
Gets the ith component from a 2D point. |
public inline float getx(constpoint_type& p) |
Gets point x coordinate. |
public inline float gety(constpoint_type& p) |
gets pòint y coordinate |
public inline float getz(constpoint_type& p) |
Gets point z coordinate. |
public inline float get(constpoint_type& p,int coord) |
Gets the ith component from a point. |
public template<int I> planar_pointplanar_projection(constpoint_type& p) |
Removes the ith component from P. |
publicplanar_pointplanar_projection(constpoint_type& p,int i) |
Dynamic planar projection. |
public float distance(constpoint_type& a,constpoint_type& b) |
Euclidean distance between a and b. |
publicpoint_typevectorFromTo(constpoint_type& from,constpoint_type& to) |
Vector with origin in from and end in to. |
public void traslate(point_type& p,constpoint_type& v) |
Adds v to p. |
public void scale(point_type& p,float scale,constpoint_type& ref) |
Modifies the point p scaling it by scale wrt ref so its norm is multiplied by scale. |
public void scale(point_type& p,float rx,float ry,float rz) |
Modifies the point p scaling it by (rx,ry,rz) |
public void scale(point_type& p,float scale) |
Modifies p multiplying its norm by scale. |
publicpoint_typecross_product(constpoint_type& p,constpoint_type& q) |
Computes the 3D cross product p ^ q. |
public float norm(constpoint_type& p) |
Returns de 2-norm of p as vector. |
public inline bool equal(constpoint_type& a,constpoint_type& b) |
Checks whether two point a and b are equal. |
public inline bool equal(constplanar_point& a,constplanar_point& b) |
Checks whether two point a and b are equal. |
public std::array<point_type, 3 > get_basis(constpoint_type& vx,constpoint_type& up) |
Retunrs a orthonormal right-oriented basis where vx is the first vector. |
public float segment_segment_distance(constpoint_type& p0,constpoint_type& p1,constpoint_type& q0,constpoint_type& q1) |
Computes the distance between two line-segments p and q. |
public Eigen::Quaternionf align_vectors(constpoint_type& v,constpoint_type& u,constpoint_typeup) |
Returns the quaternion to transform v into u (both unitary) |
public bool segment_box_intersection(constbox_type& b,constsegment_type& s,point_type& inter) |
Computes the box-segment intersection of b and s. |
public template<typename G1,typename G2> inline bool covered_by(const G1 & g1,const G2 & g2) |
Checks if first geometry is covered by the second. |
public template<int I,typename Point> inline bool segment_cross_plane(constsegment_type& s,const Point & v,Point & inter) |
Segment-axis plane intersection. |
public template<int I,typename Point> inline void min_component(const Point & p,Point & res) |
Set the ith component in res to the minimim betweeen the ith components in p and res. |
public template<int I,typename Point> inline void max_component(const Point & p,Point & res) |
Set the ith component in res to the maximum betweeen the ith components in p and res. |
public template<typename Point> inline void max_by_component(const Point & p,Point & res) |
Computes the component-wise maximum between p and res and stores it in res. |
public template<typename Point> inline void min_by_component(const Point & p,Point & res) |
Computes the component-wise minimum between p and res and stores it in res. |
public template<Axisaxis> float axisLength(constbox_type& b) |
Return box axis length. |
public template<Axisaxis> void setAxis(box_type& b,float v) |
Set box axis to given value. |
publicpolygon_typeas_planar_polygon(const std::vector<point_type> & v) |
|
public template<typename G> inline std::size_t num_points(const G & geom) |
Number of points in the geometry. |
public float polygon_area(constpolygon_type& p) |
Computes the pclosed polygon area. |
public template<typename Iter> inline float polygon_area(const Iter & begin,const Iter & end) |
Computes the closed polygon area. |
public void negate(point_type& p) |
Multiplies every component by -1. |
publicpoint_typebarycenter(const std::vector<point_type> & v) |
Computes the barycenter of a pointset. |
public void normalize(point_type& p) |
Modifies p so its norm is equal to 1. |
public float vector_vector_angle(constpoint_type& a,constpoint_type& b) |
Computes the planar vector-vector shortest angle. |
public bool box_box_intersection(constbox_type& a,constbox_type& b) |
Checks if box a intersects with box b (axis aligned) |
public std::vector<point_type> box_corners(constbox_type& b) |
Returns 8 corner points in a axis-aligned box. |
public float lineseg_dist(const std::vector<point_type> & u,const std::vector<point_type> & v) |
Euclidean distance between two line-segments. |
publicbox_typebounding_box(const std::vector<point_type> & v) |
Computes the bounding box of a node set. |
public float vector_vector_directed_angle(constpoint_type& a,constpoint_type& b,constpoint_typeup) |
Computes the planar angle from a to b. |
public std::pair< float, float > local_orientation(constpoint_type& p,const std::array<point_type, 3 > & basis) |
Computes the local orientation (Azimuth and elevation) of p wrt basis. |
public bool in_triangle_border(consttriangle_type& t,constpoint_type& p) |
Verifies if p is in the border of the triangle t. |
public bool is_triangle_vertex(consttriangle_type& t,constpoint_type& p) |
Verifies if P is one of the vertices of T. |
public bool within_triangle(consttriangle_type& t,constpoint_type& p) |
Verifies if p is inside the triangle t. |
public bool triangle_ray_intersection(consttriangle_type& t,constpoint_type& ray_o,constpoint_type& ray_v,point_type& intersection) |
Computes Triangle-ray intersection with the moller-trumbore algorithm. |
public float tetrahedron_volume(constpoint_type& p0,constpoint_type& p1,constpoint_type& p2,constpoint_type& p3) |
Returns the volume of the tetrahedron. |
public float triangle_area(consttriangle_type& t) |
Compute the triangle area. |
Members
public template<int I>
inline float get(constpoint_type& p)
Gets the ith component from a point.
Parameters
pPoint
Returns
Ith component (float)
public template<int I>
inline float get(constplanar_point& p)
Gets the ith component from a 2D point.
Parameters
p2D Point
Returns
I-th component (float)
public inline float getx(constpoint_type& p)
Gets point x coordinate.
Parameters
p
Returns
public inline float gety(constpoint_type& p)
gets pòint y coordinate
Parameters
p
Returns
public inline float getz(constpoint_type& p)
Gets point z coordinate.
Parameters
p
Returns
public inline float get(constpoint_type& p,int coord)
Gets the ith component from a point.
Parameters
-
pPoint coordcoordinate
Returns
Ith component (float)
public template<int I>
planar_pointplanar_projection(constpoint_type& p)
Removes the ith component from P.
Parameters
pPoint to project
Returns
projected point
publicplanar_pointplanar_projection(constpoint_type& p,int i)
Dynamic planar projection.
Parameters
pPoint to project
Returns
projected point
public float distance(constpoint_type& a,constpoint_type& b)
Euclidean distance between a and b.
Parameters
-
aFirst point bSecond point
Returns
Eculidean distance (Float)
publicpoint_typevectorFromTo(constpoint_type& from,constpoint_type& to)
Vector with origin in from and end in to.
Parameters
-
fromVector origin toVector end
Returns
Vector (point type)
public void traslate(point_type& p,constpoint_type& v)
Adds v to p.
Parameters
-
ppoint to be modified vtraslation vector
public void scale(point_type& p,float scale,constpoint_type& ref)
Modifies the point p scaling it by scale wrt ref so its norm is multiplied by scale.
Parameters
-
pPoint to be modified -
scaleScale refReferecne point
public void scale(point_type& p,float rx,float ry,float rz)
Modifies the point p scaling it by (rx,ry,rz)
Parameters
-
pPoint to be modified -
rxX scale -
ryY Scale rzZ scale
public void scale(point_type& p,float scale)
Modifies p multiplying its norm by scale.
Parameters
-
pPoint to be modified scaleScale factor
publicpoint_typecross_product(constpoint_type& p,constpoint_type& q)
Computes the 3D cross product p ^ q.
Parameters
-
pFirst 3D vector qSecond 3D Vector
Returns
Cross product p^q
public float norm(constpoint_type& p)
Returns de 2-norm of p as vector.
Parameters
p3D Vector
Returns
P 2-Norm
public inline bool equal(constpoint_type& a,constpoint_type& b)
Checks whether two point a and b are equal.
Parameters
-
aFirst point bSecond point
Returns
True if every component in a is equal to b
public inline bool equal(constplanar_point& a,constplanar_point& b)
Checks whether two point a and b are equal.
Parameters
-
aFirst point bSecond point
Returns
True if every component in a is equal to b
public std::array<point_type, 3 > get_basis(constpoint_type& vx,constpoint_type& up)
Retunrs a orthonormal right-oriented basis where vx is the first vector.
Parameters
-
vxFirst vector in the basis upUp reference position (to be z)
public float segment_segment_distance(constpoint_type& p0,constpoint_type& p1,constpoint_type& q0,constpoint_type& q1)
Computes the distance between two line-segments p and q.
Parameters
-
p0P start point -
p1P end point -
q0Q start point q1Q end point
Returns
Distance between p and q
public Eigen::Quaternionf align_vectors(constpoint_type& v,constpoint_type& u,constpoint_typeup)
Returns the quaternion to transform v into u (both unitary)
Parameters
-
vUnitary vector -
uUnitary vector upReference vector to determine sign in 3D angles
Returns
Quaternion
public bool segment_box_intersection(constbox_type& b,constsegment_type& s,point_type& inter)
Computes the box-segment intersection of b and s.
Parameters
-
bBox -
sSegment inter(Return) Intersection point
Returns
True if b intersects with s
public template<typename G1,typename G2>
inline bool covered_by(const G1 & g1,const G2 & g2)
Checks if first geometry is covered by the second.
Parameters
-
g1First geometry g2Second geometry
Returns
True if g1 is covered by g2
public template<int I,typename Point>
inline bool segment_cross_plane(constsegment_type& s,const Point & v,Point & inter)
Segment-axis plane intersection.
Parameters
-
sSegment -
vPoint that marks the Ith plane position interIntersection point
Returns
True if they intersect
public template<int I,typename Point>
inline void min_component(const Point & p,Point & res)
Set the ith component in res to the minimim betweeen the ith components in p and res.
Parameters
-
pBase point. unmodified resPoint to be modified
public template<int I,typename Point>
inline void max_component(const Point & p,Point & res)
Set the ith component in res to the maximum betweeen the ith components in p and res.
Parameters
-
pBase point. unmodified resPoint to be modified
public template<typename Point>
inline void max_by_component(const Point & p,Point & res)
Computes the component-wise maximum between p and res and stores it in res.
Parameters
-
pBase point resReturn point
public template<typename Point>
inline void min_by_component(const Point & p,Point & res)
Computes the component-wise minimum between p and res and stores it in res.
Parameters
-
pBase point resReturn point
public template<Axisaxis>
float axisLength(constbox_type& b)
Return box axis length.
Parameters
box
Returns
Axis length (value)
public template<Axisaxis>
void setAxis(box_type& b,float v)
Set box axis to given value.
Parameters
-
bBox vValue
publicpolygon_typeas_planar_polygon(const std::vector<point_type> & v)
public template<typename G>
inline std::size_t num_points(const G & geom)
Number of points in the geometry.
Parameters
geomGeoemtry object
Returns
Number of point
public float polygon_area(constpolygon_type& p)
Computes the pclosed polygon area.
Parameters
pPolygon object
Returns
Area
public template<typename Iter>
inline float polygon_area(const Iter & begin,const Iter & end)
Computes the closed polygon area.
Parameters
-
begin end
Returns
Area
public void negate(point_type& p)
Multiplies every component by -1.
Parameters
pPoint to negate
publicpoint_typebarycenter(const std::vector<point_type> & v)
Computes the barycenter of a pointset.
Parameters
vVector of points
Returns
Barycenter
public void normalize(point_type& p)
Modifies p so its norm is equal to 1.
Parameters
pPoint to normalize
public float vector_vector_angle(constpoint_type& a,constpoint_type& b)
Computes the planar vector-vector shortest angle.
Parameters
-
aFirst vector bSecond vector
Returns
Angle between a and b [0,pi]
public bool box_box_intersection(constbox_type& a,constbox_type& b)
Checks if box a intersects with box b (axis aligned)
Parameters
-
a b
Returns
True if they intersect
public std::vector<point_type> box_corners(constbox_type& b)
Returns 8 corner points in a axis-aligned box.
Parameters
a
Returns
Corner points
public float lineseg_dist(const std::vector<point_type> & u,const std::vector<point_type> & v)
Euclidean distance between two line-segments.
Parameters
-
u v
Returns
euclidean distance
publicbox_typebounding_box(const std::vector<point_type> & v)
Computes the bounding box of a node set.
Parameters
vnode set
Returns
box
public float vector_vector_directed_angle(constpoint_type& a,constpoint_type& b,constpoint_typeup)
Computes the planar angle from a to b.
Parameters
-
aFirst vector -
bSecond vector upReference vector to determine sign in 3D angles
Returns
Angle from a to b [0,wpi)
public std::pair< float, float > local_orientation(constpoint_type& p,const std::array<point_type, 3 > & basis)
Computes the local orientation (Azimuth and elevation) of p wrt basis.
Parameters
-
pPoint basislocal basis
Returns
pair (azimuth, elevation)
public bool in_triangle_border(consttriangle_type& t,constpoint_type& p)
Verifies if p is in the border of the triangle t.
Parameters
-
tTriangle pPoint
Returns
True if p lies in the border of t
public bool is_triangle_vertex(consttriangle_type& t,constpoint_type& p)
Verifies if P is one of the vertices of T.
Parameters
-
tTriangle pPoint
Returns
True if p is a vertex of t
public bool within_triangle(consttriangle_type& t,constpoint_type& p)
Verifies if p is inside the triangle t.
Parameters
-
tTriangle pPoint
Returns
True if p is inside t
public bool triangle_ray_intersection(consttriangle_type& t,constpoint_type& ray_o,constpoint_type& ray_v,point_type& intersection)
Computes Triangle-ray intersection with the moller-trumbore algorithm.
Parameters
-
tTriangle -
ray_oRay origin -
ray_vRay direction intersectionOutput: intersection point
Returns
True if the ray intersects the triangle
public float tetrahedron_volume(constpoint_type& p0,constpoint_type& p1,constpoint_type& p2,constpoint_type& p3)
Returns the volume of the tetrahedron.
Parameters
-
p0vertex -
p1vertex -
p2vertex p3vertex
Returns
Tetrahedron voulme
public float triangle_area(consttriangle_type& t)
Compute the triangle area.
Returns
Triangle area
class DiscreteFrechet
Summary
| Members | Descriptions |
|---|---|
public inline DiscreteFrechet(IterA ini_a,IterA end_a,IterB ini_b,IterB end_b) |
Base constructor. |
public inline double value() |
Computes de discrete frechet distance recursively. |
Members
public inline DiscreteFrechet(IterA ini_a,IterA end_a,IterB ini_b,IterB end_b)
Base constructor.
Initializes the class with the tow line-segment
Parameters
-
ini_aFirst branch line-segment begin iterator -
end_aFirst branch line-segment end iterator -
ini_bSecond branch line-segment begin iterator end_bSecondbranch line-segment end iterator
Returns
DiscreteFrechet class
public inline double value()
Computes de discrete frechet distance recursively.
Returns
Discrete frechet distance
class RDPSimplifier
Summary
| Members | Descriptions |
|---|---|
public inline RDPSimplifier(float eps,std::vector< Node > & v) |
Base constructor, sets toleracne and the line-segment. |
public inline void simplify() |
Applies the simplification to the line-segment. |
Members
public inline RDPSimplifier(float eps,std::vector< Node > & v)
Base constructor, sets toleracne and the line-segment.
Parameters
-
epsTolerance vNode set (vector)
public inline void simplify()
Applies the simplification to the line-segment.
class TriangleMesh
Summary
| Members | Descriptions |
|---|---|
public TriangleMesh() |
Creates an empty (no vertex no faces) mesh. |
public TriangleMesh(constface_storage& faces) |
Creates a mesh with given faces. |
public ~TriangleMesh() |
Default destructor. |
public TriangleMesh(constTriangleMesh&) = delete |
|
publicTriangleMesh& operator=(constTriangleMesh&) = delete |
|
public TriangleMesh(TriangleMesh&&) = default |
|
publicTriangleMesh& operator=(TriangleMesh&&) = default |
|
publicvertex_iteratoradd(constpoint_type& p) |
Adds a vertex to the mesh (if it doesnt exist already) |
public template<typename Iter> inline void add(const Iter & b,const Iter & e) |
Copies a range of vertices to the mesh. |
public void remove(constvertex_iterator& it) |
Removes the vertex and all its faces from the mesh. |
public void remove(constvertex_iterator& b,constvertex_iterator& e) |
Removes a range of vertices and their faces from the mesh. |
public void clear() |
Removes all vertices and faces. |
publicvertex_iteratorbegin_vertex() |
Creates an iterator to the first vertex in the mesh. |
publicconst_vertex_iteratorbegin_vertex() const |
Creates an iterator to the first vertex in the mesh. |
publicvertex_iteratorend_vertex() |
Creates an iterator to one-past position of the last vertex in the mesh. |
publicconst_vertex_iteratorend_vertex() const |
Creates an iterator to one-past position of the last vertex in the mesh. |
public std::size_t vertex_count() const |
Number of vertices in the mesh. |
publicface_iteratoradd(constpoint_type& v0,constpoint_type& v1,constpoint_type& v2) |
Adds a new triangular face to the mesh. |
publicface_iteratoradd(consttriangle_type& t) |
Adds a new triangular face to the mesh. |
public void remove(constface_iterator& it) |
Removes a face from the mesh. |
public void remove(constface_iterator& b,constface_iterator& e) |
Removes a set of faces from the mesh. |
public void clear_faces() |
Removes all faces (but not the vertices) |
publicface_iteratorbegin_face() |
Returns an iterator to the first face in the mesh. |
publicconst_face_iteratorbegin_face() const |
Returns an iterator to the first face in the mesh. |
publicface_iteratorend_face() |
Returns an iterator to one-past the last face in the mesh. |
publicconst_face_iteratorend_face() const |
Returns an iterator to one-past the last face in the mesh. |
public std::size_t face_count() const |
Number of faces in the mesh. |
public bool point_inside(constpoint_type& p,constpoint_type& ray_direction) const |
Using ray-tracing method computes if the point p is Inside the triangular mesh assuming that it is closed. |
publicpoint_typeray_intersection(constpoint_type& p,constpoint_type& ray_direction) const |
Members
public TriangleMesh()
Creates an empty (no vertex no faces) mesh.
public TriangleMesh(constface_storage& faces)
Creates a mesh with given faces.
Vertices are added automatically
public ~TriangleMesh()
Default destructor.
Nothign special to do
public TriangleMesh(constTriangleMesh&) = delete
publicTriangleMesh& operator=(constTriangleMesh&) = delete
public TriangleMesh(TriangleMesh&&) = default
publicTriangleMesh& operator=(TriangleMesh&&) = default
publicvertex_iteratoradd(constpoint_type& p)
Adds a vertex to the mesh (if it doesnt exist already)
Parameters
pVertex to add.
public template<typename Iter>
inline void add(const Iter & b,const Iter & e)
Copies a range of vertices to the mesh.
Parameters
-
bRange begin iterator eRange end iterator
public void remove(constvertex_iterator& it)
Removes the vertex and all its faces from the mesh.
Parameters
itVertex iterator
public void remove(constvertex_iterator& b,constvertex_iterator& e)
Removes a range of vertices and their faces from the mesh.
Parameters
-
bRange begin eRange end
public void clear()
Removes all vertices and faces.
publicvertex_iteratorbegin_vertex()
Creates an iterator to the first vertex in the mesh.
Returns
Begin iterator
publicconst_vertex_iteratorbegin_vertex() const
Creates an iterator to the first vertex in the mesh.
Returns
Begin iterator
publicvertex_iteratorend_vertex()
Creates an iterator to one-past position of the last vertex in the mesh.
Returns
End iterator
publicconst_vertex_iteratorend_vertex() const
Creates an iterator to one-past position of the last vertex in the mesh.
Returns
End iterator
public std::size_t vertex_count() const
Number of vertices in the mesh.
publicface_iteratoradd(constpoint_type& v0,constpoint_type& v1,constpoint_type& v2)
Adds a new triangular face to the mesh.
Inserts the vertices if necessary
Parameters
-
v0First vertex -
v1Second vertex v2Third vertex
Returns
Iterator to the inserted face
publicface_iteratoradd(consttriangle_type& t)
Adds a new triangular face to the mesh.
Inserts the vertices if necessary
Parameters
tface triangle
Returns
Iterator to the inserted face
public void remove(constface_iterator& it)
Removes a face from the mesh.
Parameters
itFace iterator
public void remove(constface_iterator& b,constface_iterator& e)
Removes a set of faces from the mesh.
Parameters
-
bBegin iterator eEnd iterator
public void clear_faces()
Removes all faces (but not the vertices)
publicface_iteratorbegin_face()
Returns an iterator to the first face in the mesh.
Returns
Begin iterator
publicconst_face_iteratorbegin_face() const
Returns an iterator to the first face in the mesh.
Returns
Begin iterator
publicface_iteratorend_face()
Returns an iterator to one-past the last face in the mesh.
Returns
End iterator
publicconst_face_iteratorend_face() const
Returns an iterator to one-past the last face in the mesh.
Returns
End iterator
public std::size_t face_count() const
Number of faces in the mesh.
public bool point_inside(constpoint_type& p,constpoint_type& ray_direction) const
Using ray-tracing method computes if the point p is Inside the triangular mesh assuming that it is closed.
Parameters
pPoint
Returns
True if the point is within the mesh
publicpoint_typeray_intersection(constpoint_type& p,constpoint_type& ray_direction) const
Parameters
-
p ray_direction