namespace geometry
Geometry namespace hides geometry specific implementation details from the rest of the library.
Summary
Members | Descriptions |
---|---|
class DiscreteFrechet |
|
class RDPSimplifier |
|
class TriangleMesh |
|
public template<int I> inline float get(const point_type & p) |
Gets the ith component from a point. |
public template<int I> inline float get(const planar_point & p) |
Gets the ith component from a 2D point. |
public inline float getx(const point_type & p) |
Gets point x coordinate. |
public inline float gety(const point_type & p) |
gets pòint y coordinate |
public inline float getz(const point_type & p) |
Gets point z coordinate. |
public inline float get(const point_type & p,int coord) |
Gets the ith component from a point. |
public template<int I> planar_point planar_projection(const point_type & p) |
Removes the ith component from P. |
public planar_point planar_projection(const point_type & p,int i) |
Dynamic planar projection. |
public float distance(const point_type & a,const point_type & b) |
Euclidean distance between a and b. |
public point_type vectorFromTo(const point_type & from,const point_type & to) |
Vector with origin in from and end in to. |
public void traslate( point_type & p,const point_type & v) |
Adds v to p. |
public void scale( point_type & p,float scale,const point_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. |
public point_type cross_product(const point_type & p,const point_type & q) |
Computes the 3D cross product p ^ q. |
public float norm(const point_type & p) |
Returns de 2-norm of p as vector. |
public inline bool equal(const point_type & a,const point_type & b) |
Checks whether two point a and b are equal. |
public inline bool equal(const planar_point & a,const planar_point & b) |
Checks whether two point a and b are equal. |
public std::array< point_type , 3 > get_basis(const point_type & vx,const point_type & up) |
Retunrs a orthonormal right-oriented basis where vx is the first vector. |
public float segment_segment_distance(const point_type & p0,const point_type & p1,const point_type & q0,const point_type & q1) |
Computes the distance between two line-segments p and q. |
public Eigen::Quaternionf align_vectors(const point_type & v,const point_type & u,const point_type up) |
Returns the quaternion to transform v into u (both unitary) |
public bool segment_box_intersection(const box_type & b,const segment_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(const segment_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< Axis axis> float axisLength(const box_type & b) |
Return box axis length. |
public template< Axis axis> void setAxis( box_type & b,float v) |
Set box axis to given value. |
public polygon_type as_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(const polygon_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. |
public point_type barycenter(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(const point_type & a,const point_type & b) |
Computes the planar vector-vector shortest angle. |
public bool box_box_intersection(const box_type & a,const box_type & b) |
Checks if box a intersects with box b (axis aligned) |
public std::vector< point_type > box_corners(const box_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. |
public box_type bounding_box(const std::vector< point_type > & v) |
Computes the bounding box of a node set. |
public float vector_vector_directed_angle(const point_type & a,const point_type & b,const point_type up) |
Computes the planar angle from a to b. |
public std::pair< float, float > local_orientation(const point_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(const triangle_type & t,const point_type & p) |
Verifies if p is in the border of the triangle t. |
public bool is_triangle_vertex(const triangle_type & t,const point_type & p) |
Verifies if P is one of the vertices of T. |
public bool within_triangle(const triangle_type & t,const point_type & p) |
Verifies if p is inside the triangle t. |
public bool triangle_ray_intersection(const triangle_type & t,const point_type & ray_o,const point_type & ray_v, point_type & intersection) |
Computes Triangle-ray intersection with the moller-trumbore algorithm. |
public float tetrahedron_volume(const point_type & p0,const point_type & p1,const point_type & p2,const point_type & p3) |
Returns the volume of the tetrahedron. |
public float triangle_area(const triangle_type & t) |
Compute the triangle area. |
Members
public template<int I>
inline float get(const
point_type
& p)
Gets the ith component from a point.
Parameters
p
Point
Returns
Ith component (float)
public template<int I>
inline float get(const
planar_point
& p)
Gets the ith component from a 2D point.
Parameters
p
2D Point
Returns
I-th component (float)
public inline float getx(const
point_type
& p)
Gets point x coordinate.
Parameters
p
Returns
public inline float gety(const
point_type
& p)
gets pòint y coordinate
Parameters
p
Returns
public inline float getz(const
point_type
& p)
Gets point z coordinate.
Parameters
p
Returns
public inline float get(const
point_type
& p,int coord)
Gets the ith component from a point.
Parameters
-
p
Point coord
coordinate
Returns
Ith component (float)
public template<int I>
planar_point
planar_projection(const
point_type
& p)
Removes the ith component from P.
Parameters
p
Point to project
Returns
projected point
public
planar_point
planar_projection(const
point_type
& p,int i)
Dynamic planar projection.
Parameters
p
Point to project
Returns
projected point
public float distance(const
point_type
& a,const
point_type
& b)
Euclidean distance between a and b.
Parameters
-
a
First point b
Second point
Returns
Eculidean distance (Float)
public
point_type
vectorFromTo(const
point_type
& from,const
point_type
& to)
Vector with origin in from and end in to.
Parameters
-
from
Vector origin to
Vector end
Returns
Vector (point type)
public void traslate(
point_type
& p,const
point_type
& v)
Adds v to p.
Parameters
-
p
point to be modified v
traslation vector
public void scale(
point_type
& p,float scale,const
point_type
& ref)
Modifies the point p scaling it by scale wrt ref so its norm is multiplied by scale.
Parameters
-
p
Point to be modified -
scale
Scale ref
Referecne point
public void scale(
point_type
& p,float rx,float ry,float rz)
Modifies the point p scaling it by (rx,ry,rz)
Parameters
-
p
Point to be modified -
rx
X scale -
ry
Y Scale rz
Z scale
public void scale(
point_type
& p,float scale)
Modifies p multiplying its norm by scale.
Parameters
-
p
Point to be modified scale
Scale factor
public
point_type
cross_product(const
point_type
& p,const
point_type
& q)
Computes the 3D cross product p ^ q.
Parameters
-
p
First 3D vector q
Second 3D Vector
Returns
Cross product p^q
public float norm(const
point_type
& p)
Returns de 2-norm of p as vector.
Parameters
p
3D Vector
Returns
P 2-Norm
public inline bool equal(const
point_type
& a,const
point_type
& b)
Checks whether two point a and b are equal.
Parameters
-
a
First point b
Second point
Returns
True if every component in a is equal to b
public inline bool equal(const
planar_point
& a,const
planar_point
& b)
Checks whether two point a and b are equal.
Parameters
-
a
First point b
Second point
Returns
True if every component in a is equal to b
public std::array<
point_type
, 3 > get_basis(const
point_type
& vx,const
point_type
& up)
Retunrs a orthonormal right-oriented basis where vx is the first vector.
Parameters
-
vx
First vector in the basis up
Up reference position (to be z)
public float segment_segment_distance(const
point_type
& p0,const
point_type
& p1,const
point_type
& q0,const
point_type
& q1)
Computes the distance between two line-segments p and q.
Parameters
-
p0
P start point -
p1
P end point -
q0
Q start point q1
Q end point
Returns
Distance between p and q
public Eigen::Quaternionf align_vectors(const
point_type
& v,const
point_type
& u,const
point_type
up)
Returns the quaternion to transform v into u (both unitary)
Parameters
-
v
Unitary vector -
u
Unitary vector up
Reference vector to determine sign in 3D angles
Returns
Quaternion
public bool segment_box_intersection(const
box_type
& b,const
segment_type
& s,
point_type
& inter)
Computes the box-segment intersection of b and s.
Parameters
-
b
Box -
s
Segment 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
-
g1
First geometry g2
Second geometry
Returns
True if g1 is covered by g2
public template<int I,typename Point>
inline bool segment_cross_plane(const
segment_type
& s,const Point & v,Point & inter)
Segment-axis plane intersection.
Parameters
-
s
Segment -
v
Point that marks the Ith plane position inter
Intersection 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
-
p
Base point. unmodified res
Point 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
-
p
Base point. unmodified res
Point 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
-
p
Base point res
Return 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
-
p
Base point res
Return point
public template<
Axis
axis>
float axisLength(const
box_type
& b)
Return box axis length.
Parameters
box
Returns
Axis length (value)
public template<
Axis
axis>
void setAxis(
box_type
& b,float v)
Set box axis to given value.
Parameters
-
b
Box v
Value
public
polygon_type
as_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
geom
Geoemtry object
Returns
Number of point
public float polygon_area(const
polygon_type
& p)
Computes the pclosed polygon area.
Parameters
p
Polygon 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
p
Point to negate
public
point_type
barycenter(const std::vector<
point_type
> & v)
Computes the barycenter of a pointset.
Parameters
v
Vector of points
Returns
Barycenter
public void normalize(
point_type
& p)
Modifies p so its norm is equal to 1.
Parameters
p
Point to normalize
public float vector_vector_angle(const
point_type
& a,const
point_type
& b)
Computes the planar vector-vector shortest angle.
Parameters
-
a
First vector b
Second vector
Returns
Angle between a and b [0,pi]
public bool box_box_intersection(const
box_type
& a,const
box_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(const
box_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
public
box_type
bounding_box(const std::vector<
point_type
> & v)
Computes the bounding box of a node set.
Parameters
v
node set
Returns
box
public float vector_vector_directed_angle(const
point_type
& a,const
point_type
& b,const
point_type
up)
Computes the planar angle from a to b.
Parameters
-
a
First vector -
b
Second vector up
Reference vector to determine sign in 3D angles
Returns
Angle from a to b [0,wpi)
public std::pair< float, float > local_orientation(const
point_type
& p,const std::array<
point_type
, 3 > & basis)
Computes the local orientation (Azimuth and elevation) of p wrt basis.
Parameters
-
p
Point basis
local basis
Returns
pair (azimuth, elevation)
public bool in_triangle_border(const
triangle_type
& t,const
point_type
& p)
Verifies if p is in the border of the triangle t.
Parameters
-
t
Triangle p
Point
Returns
True if p lies in the border of t
public bool is_triangle_vertex(const
triangle_type
& t,const
point_type
& p)
Verifies if P is one of the vertices of T.
Parameters
-
t
Triangle p
Point
Returns
True if p is a vertex of t
public bool within_triangle(const
triangle_type
& t,const
point_type
& p)
Verifies if p is inside the triangle t.
Parameters
-
t
Triangle p
Point
Returns
True if p is inside t
public bool triangle_ray_intersection(const
triangle_type
& t,const
point_type
& ray_o,const
point_type
& ray_v,
point_type
& intersection)
Computes Triangle-ray intersection with the moller-trumbore algorithm.
Parameters
-
t
Triangle -
ray_o
Ray origin -
ray_v
Ray direction intersection
Output: intersection point
Returns
True if the ray intersects the triangle
public float tetrahedron_volume(const
point_type
& p0,const
point_type
& p1,const
point_type
& p2,const
point_type
& p3)
Returns the volume of the tetrahedron.
Parameters
-
p0
vertex -
p1
vertex -
p2
vertex p3
vertex
Returns
Tetrahedron voulme
public float triangle_area(const
triangle_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_a
First branch line-segment begin iterator -
end_a
First branch line-segment end iterator -
ini_b
Second branch line-segment begin iterator end_b
Secondbranch 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
-
eps
Tolerance v
Node 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(const face_storage & faces) |
Creates a mesh with given faces. |
public ~TriangleMesh() |
Default destructor. |
public TriangleMesh(const TriangleMesh &) = delete |
|
public TriangleMesh & operator=(const TriangleMesh &) = delete |
|
public TriangleMesh( TriangleMesh &&) = default |
|
public TriangleMesh & operator=( TriangleMesh &&) = default |
|
public vertex_iterator add(const point_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(const vertex_iterator & it) |
Removes the vertex and all its faces from the mesh. |
public void remove(const vertex_iterator & b,const vertex_iterator & e) |
Removes a range of vertices and their faces from the mesh. |
public void clear() |
Removes all vertices and faces. |
public vertex_iterator begin_vertex() |
Creates an iterator to the first vertex in the mesh. |
public const_vertex_iterator begin_vertex() const |
Creates an iterator to the first vertex in the mesh. |
public vertex_iterator end_vertex() |
Creates an iterator to one-past position of the last vertex in the mesh. |
public const_vertex_iterator end_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. |
public face_iterator add(const point_type & v0,const point_type & v1,const point_type & v2) |
Adds a new triangular face to the mesh. |
public face_iterator add(const triangle_type & t) |
Adds a new triangular face to the mesh. |
public void remove(const face_iterator & it) |
Removes a face from the mesh. |
public void remove(const face_iterator & b,const face_iterator & e) |
Removes a set of faces from the mesh. |
public void clear_faces() |
Removes all faces (but not the vertices) |
public face_iterator begin_face() |
Returns an iterator to the first face in the mesh. |
public const_face_iterator begin_face() const |
Returns an iterator to the first face in the mesh. |
public face_iterator end_face() |
Returns an iterator to one-past the last face in the mesh. |
public const_face_iterator end_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(const point_type & p,const point_type & ray_direction) const |
Using ray-tracing method computes if the point p is Inside the triangular mesh assuming that it is closed. |
public point_type ray_intersection(const point_type & p,const point_type & ray_direction) const |
Members
public TriangleMesh()
Creates an empty (no vertex no faces) mesh.
public TriangleMesh(const
face_storage
& faces)
Creates a mesh with given faces.
Vertices are added automatically
public ~TriangleMesh()
Default destructor.
Nothign special to do
public TriangleMesh(const
TriangleMesh
&) = delete
public
TriangleMesh
& operator=(const
TriangleMesh
&) = delete
public TriangleMesh(
TriangleMesh
&&) = default
public
TriangleMesh
& operator=(
TriangleMesh
&&) = default
public
vertex_iterator
add(const
point_type
& p)
Adds a vertex to the mesh (if it doesnt exist already)
Parameters
p
Vertex to add.
public template<typename Iter>
inline void add(const Iter & b,const Iter & e)
Copies a range of vertices to the mesh.
Parameters
-
b
Range begin iterator e
Range end iterator
public void remove(const
vertex_iterator
& it)
Removes the vertex and all its faces from the mesh.
Parameters
it
Vertex iterator
public void remove(const
vertex_iterator
& b,const
vertex_iterator
& e)
Removes a range of vertices and their faces from the mesh.
Parameters
-
b
Range begin e
Range end
public void clear()
Removes all vertices and faces.
public
vertex_iterator
begin_vertex()
Creates an iterator to the first vertex in the mesh.
Returns
Begin iterator
public
const_vertex_iterator
begin_vertex() const
Creates an iterator to the first vertex in the mesh.
Returns
Begin iterator
public
vertex_iterator
end_vertex()
Creates an iterator to one-past position of the last vertex in the mesh.
Returns
End iterator
public
const_vertex_iterator
end_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.
public
face_iterator
add(const
point_type
& v0,const
point_type
& v1,const
point_type
& v2)
Adds a new triangular face to the mesh.
Inserts the vertices if necessary
Parameters
-
v0
First vertex -
v1
Second vertex v2
Third vertex
Returns
Iterator to the inserted face
public
face_iterator
add(const
triangle_type
& t)
Adds a new triangular face to the mesh.
Inserts the vertices if necessary
Parameters
t
face triangle
Returns
Iterator to the inserted face
public void remove(const
face_iterator
& it)
Removes a face from the mesh.
Parameters
it
Face iterator
public void remove(const
face_iterator
& b,const
face_iterator
& e)
Removes a set of faces from the mesh.
Parameters
-
b
Begin iterator e
End iterator
public void clear_faces()
Removes all faces (but not the vertices)
public
face_iterator
begin_face()
Returns an iterator to the first face in the mesh.
Returns
Begin iterator
public
const_face_iterator
begin_face() const
Returns an iterator to the first face in the mesh.
Returns
Begin iterator
public
face_iterator
end_face()
Returns an iterator to one-past the last face in the mesh.
Returns
End iterator
public
const_face_iterator
end_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(const
point_type
& p,const
point_type
& ray_direction) const
Using ray-tracing method computes if the point p is Inside the triangular mesh assuming that it is closed.
Parameters
p
Point
Returns
True if the point is within the mesh
public
point_type
ray_intersection(const
point_type
& p,const
point_type
& ray_direction) const
Parameters
-
p
ray_direction