maliput
|
Classes | |
struct | DirectedEdgeIndex |
Index for a directed edge in a GeoMesh. More... | |
struct | FaceEdgeIndex |
Index for a face edge in a GeoMesh. More... | |
struct | FaceVertexIndex |
Index of a face vertex in a GeoMesh. More... | |
class | GeoFace |
An Inertial -frame face: a sequence of vertices with corresponding normals. More... | |
class | GeoMesh |
An Inertial -frame mesh: a collection of GeoFaces. More... | |
class | GeoNormal |
An Inertial -frame normal vector. More... | |
class | GeoVertex |
An Inertial -frame vertex. More... | |
class | IndexFace |
A face — a sequence of vertices with normals — in which the vertices and normals are represented by integer indices into some other container/dictionary. More... | |
class | SrhFace |
A Lane -frame face: a sequence of vertices expressed in the (s,r,h) coordinates of an api::Lane (which is not referenced here). More... | |
class | UniqueIndexer |
A container for a set of unique objects which keeps track of the original insertion order. More... | |
Typedefs | |
using | InverseFaceEdgeMap = std::unordered_map< DirectedEdgeIndex, FaceEdgeIndex, maliput::common::DefaultHash > |
The inverse of the mapping from face edges indices to their associated directed edge indices. More... | |
using | FaceAdjacencyMap = std::unordered_map< int, std::vector< FaceEdgeIndex > > |
A mapping from each IndexFace index in a given GeoMesh to each of its adjacent faces, along with the index of the edge these share. More... | |
Functions | |
double | DistanceToAPlane (const math::Vector3 n, const math::Vector3 p, const math::Vector3 q) |
Let \(B\) be a plane in the 3D Inertial Frame defined by a point \(p\) and a normal non-zero vector \(n\), and let \(q\) be another point in the 3D Inertial Frame. More... | |
double | DistanceToALine (const math::Vector3 &p, const math::Vector3 &r, const math::Vector3 &q) |
Let \(F(t) = P + Rt\) be a parametric line in the 3D Inertial Frame defined by a point \(P\) and a vector \(R\), and let \(Q\) be another point in the 3D Inertial Frame. More... | |
bool | operator== (const DirectedEdgeIndex &lhs, const DirectedEdgeIndex &rhs) |
bool | operator!= (const DirectedEdgeIndex &lhs, const DirectedEdgeIndex &rhs) |
template<class HashAlgorithm > | |
void | hash_append (HashAlgorithm &hasher, const DirectedEdgeIndex &item) noexcept |
Implements the hash_append generic hashing concept. More... | |
bool | operator== (const FaceEdgeIndex &lhs, const FaceEdgeIndex &rhs) |
bool | operator!= (const FaceEdgeIndex &lhs, const FaceEdgeIndex &rhs) |
InverseFaceEdgeMap | ComputeInverseFaceEdgeMap (const std::vector< IndexFace > &faces) |
Computes the inverse of the mapping from face edges indices to their associated directed edge indices for the given faces collection. More... | |
FaceAdjacencyMap | ComputeFaceAdjacencyMap (const std::vector< IndexFace > &faces) |
Computes a mapping from each IndexFace index in faces to each of its adjacent faces, along with the index of the edge these share. More... | |
const math::Vector3 & | GetMeshFaceVertexPosition (const GeoMesh &mesh, const IndexFace::Vertex &vertex) |
Gets global position of the vertex in the given mesh . More... | |
const math::Vector3 & | GetMeshFaceVertexNormal (const GeoMesh &mesh, const IndexFace::Vertex &vertex) |
Gets normal vector of the vertex in the given mesh . More... | |
template<typename InputIt > | |
bool | DoMeshVerticesLieOnPlane (const GeoMesh &mesh, InputIt first, InputIt last, const math::Vector3 &n, const math::Vector3 &p, double tolerance) |
Checks if all the IndexFace::Vertex instances, from first to last , in the given mesh lie on the provided plane defined by a normal non-zero vector n and a point p by verifying all of them are within one tolerance distance, in meters, away from it along the line subtended by its normal. More... | |
bool | IsMeshFaceCoplanarWithPlane (const GeoMesh &mesh, const IndexFace &face, const math::Vector3 &n, const math::Vector3 &p, double tolerance) |
Checks if the face in the given mesh is coplanar with the given plane defined by a normal non-zero vector n and a point p , by verifying if all face vertices are within one tolerance distance, in meters, from it. More... | |
bool | IsMeshFacePlanar (const GeoMesh &mesh, const IndexFace &face, double tolerance, math::Vector3 *n, math::Vector3 *p) |
Checks if the face in the given mesh is planar, by verifying all face vertices lie on a plane using the given tolerance (see DoMeshVerticesLieOnPlane()). More... | |
std::set< int > | AggregateAdjacentCoplanarMeshFaces (const GeoMesh &mesh, int start_face_index, const FaceAdjacencyMap &adjacent_faces_map, double tolerance, std::set< int > *visited_faces_indices) |
Aggregates all coplanar faces adjacent to the referred face in the mesh . More... | |
FaceEdgeIndex | FindOuterFaceEdgeIndex (const std::set< int > &simply_connected_faces_indices, const FaceAdjacencyMap &adjacent_faces_map) |
Finds the index to the first outer face edge in the given simply_connected_faces_indices . More... | |
std::vector< FaceVertexIndex > | ComputeMeshFacesContour (const std::set< int > &simply_connected_faces_indices, const FaceAdjacencyMap &adjacent_faces_map) |
Computes the contour of the simply connected region that all the faces referred by the given simply_connected_faces_indices yield. More... | |
const IndexFace::Vertex & | MeshFaceVertexAt (const GeoMesh &mesh, const FaceVertexIndex &face_vertex_index) |
Gets the face vertex in the mesh referred by the given face_vertex_index . More... | |
template<typename InputIt , typename VertexFn , typename EdgeFn , typename OutputIt > | |
void | ApplyDouglasPeuckerSimplification (InputIt first, InputIt last, VertexFn to_vertex, EdgeFn to_edge, double tolerance, OutputIt output) |
Applies the Douglas-Peucker simplification algorithm [1] over the given collection of vertices. More... | |
std::vector< FaceVertexIndex > | SimplifyMeshFacesContour (const GeoMesh &mesh, const std::vector< FaceVertexIndex > &contour_indices, double tolerance) |
Simplifies the mesh faces' contour referred by the given contour_indices by elimination of redundant vertices, i.e. More... | |
GeoFace | MergeMeshFaces (const GeoMesh &mesh, const std::set< int > &mergeable_faces_indices, const FaceAdjacencyMap &adjacent_faces_map, double tolerance) |
Merges all the faces in the given mesh referred by mergeable_faces_indices into a single GeoFace. More... | |
GeoMesh | SimplifyMeshFaces (const GeoMesh &input_mesh, double tolerance) |
Simplifies a mesh by merging adjacent coplanar faces. More... | |
using FaceAdjacencyMap = std::unordered_map<int, std::vector<FaceEdgeIndex> > |
A mapping from each IndexFace index in a given GeoMesh to each of its adjacent faces, along with the index of the edge these share.
using InverseFaceEdgeMap = std::unordered_map<DirectedEdgeIndex, FaceEdgeIndex, maliput::common::DefaultHash> |
The inverse of the mapping from face edges indices to their associated directed edge indices.
std::set< int > AggregateAdjacentCoplanarMeshFaces | ( | const GeoMesh & | mesh, |
int | start_face_index, | ||
const FaceAdjacencyMap & | adjacent_faces_map, | ||
double | tolerance, | ||
std::set< int > * | visited_faces_indices | ||
) |
Aggregates all coplanar faces adjacent to the referred face in the mesh
.
mesh | Mesh where faces are to be found. |
start_face_index | Index of the face to start aggregation with. |
adjacent_faces_map | Map of adjacent faces associated with the given mesh . |
tolerance | For coplanarity checks, in meters. See IsMeshFacePlanar() and IsMeshFaceCoplanarWithPlane() functions for further details. |
visited_faces_indices | The indices of the faces visited so far. |
start_face_index
is valid for the given mesh
. tolerance
is a positive real number. visited_faces_indices
collection is not nullptr. start_face_index
has not been visited yet (i.e. visited_faces_indices.count(start_face_index) == 0). void maliput::utility::mesh::ApplyDouglasPeuckerSimplification | ( | InputIt | first, |
InputIt | last, | ||
VertexFn | to_vertex, | ||
EdgeFn | to_edge, | ||
double | tolerance, | ||
OutputIt | output | ||
) |
Applies the Douglas-Peucker simplification algorithm [1] over the given collection of vertices.
first | Iterator to first element of the collection. |
last | Iterator to the last element of the collection. |
to_vertex | A function to retrieve the vertex associated with an element of the collection (may be a pass-through). |
to_edge | A function to construct an edge out of a pair of vertices. This function must return a std::pair containing the origin vertex and the unit direction vector of the parametric line. |
tolerance | Simplification tolerance, in distance units. |
output | Output iterator for the simplification result. |
InputIt | Input iterators type. |
VertexFn | Vertex getter function type. |
EdgeFn | Edge building function type. |
OutputIt | Output iterator type. |
FaceAdjacencyMap ComputeFaceAdjacencyMap | ( | const std::vector< IndexFace > & | faces | ) |
Computes a mapping from each IndexFace index in faces
to each of its adjacent faces, along with the index of the edge these share.
For each face at index i
in faces
, a sequence to map each edge j
to its adjacent face and edge index is added to the map at i
. If a given edge is not adjacent to any face, an invalid face and edge index (both set to -1, see FaceEdgeIndex) is put in its place.
InverseFaceEdgeMap ComputeInverseFaceEdgeMap | ( | const std::vector< IndexFace > & | faces | ) |
Computes the inverse of the mapping from face edges indices to their associated directed edge indices for the given faces
collection.
std::vector< FaceVertexIndex > ComputeMeshFacesContour | ( | const std::set< int > & | simply_connected_faces_indices, |
const FaceAdjacencyMap & | adjacent_faces_map | ||
) |
Computes the contour of the simply connected region that all the faces referred by the given simply_connected_faces_indices
yield.
simply_connected_faces_indices | Indices of the faces whose outer face edge is to be found. |
adjacent_faces_map | Mapping of adjacent faces for the faces referred in simply_connected_faces_indices . |
simply_connected_faces_indices
yield a simply connected region (i.e. with no holes). double DistanceToALine | ( | const math::Vector3 & | p, |
const math::Vector3 & | r, | ||
const math::Vector3 & | q | ||
) |
Let \(F(t) = P + Rt\) be a parametric line in the 3D Inertial Frame defined by a point \(P\) and a vector \(R\), and let \(Q\) be another point in the 3D Inertial Frame.
This function returns the Euclidean distance of \(Q\) to \(F(t)\).
p | Is the origin of the parametric line. |
r | Is the direction of the parametric line. |
q | Is a coordinate out of the line. |
q
point to the line \(F(t)\). double DistanceToAPlane | ( | const math::Vector3 | n, |
const math::Vector3 | p, | ||
const math::Vector3 | q | ||
) |
Let \(B\) be a plane in the 3D Inertial Frame defined by a point \(p\) and a normal non-zero vector \(n\), and let \(q\) be another point in the 3D Inertial Frame.
This method returns the Euclidean distance of \(q\) to \(B\).
n | Is a vector normal to the plane. |
p | Is a coordinate in the plane. |
q | Is a coordinate out of the plane. |
q
point to the plane \(B\). n
is different from zero. bool maliput::utility::mesh::DoMeshVerticesLieOnPlane | ( | const GeoMesh & | mesh, |
InputIt | first, | ||
InputIt | last, | ||
const math::Vector3 & | n, | ||
const math::Vector3 & | p, | ||
double | tolerance | ||
) |
Checks if all the IndexFace::Vertex instances, from first
to last
, in the given mesh
lie on the provided plane defined by a normal non-zero vector n
and a point p
by verifying all of them are within one tolerance
distance, in meters, away from it along the line subtended by its normal.
vertices
belong to the mesh
. InputIt | An IndexFace::Vertex container iterator type. |
FaceEdgeIndex FindOuterFaceEdgeIndex | ( | const std::set< int > & | simply_connected_faces_indices, |
const FaceAdjacencyMap & | adjacent_faces_map | ||
) |
Finds the index to the first outer face edge in the given simply_connected_faces_indices
.
simply_connected_faces_indices | Indices of the faces whose outer face edge is to be found. |
adjacent_faces_map | Mapping of adjacent faces for the faces referred by simply_connected_faces_indices . |
simply_connected_faces_indices
yields a simply connected region (i.e. with no holes). const math::Vector3 & GetMeshFaceVertexNormal | ( | const GeoMesh & | mesh, |
const IndexFace::Vertex & | vertex | ||
) |
Gets normal vector of the vertex
in the given mesh
.
vertex
belongs to the mesh
. const math::Vector3 & GetMeshFaceVertexPosition | ( | const GeoMesh & | mesh, |
const IndexFace::Vertex & | vertex | ||
) |
Gets global position of the vertex
in the given mesh
.
vertex
belongs to the mesh
.
|
noexcept |
Implements the hash_append generic hashing concept.
bool IsMeshFaceCoplanarWithPlane | ( | const GeoMesh & | mesh, |
const IndexFace & | face, | ||
const math::Vector3 & | n, | ||
const math::Vector3 & | p, | ||
double | tolerance | ||
) |
Checks if the face
in the given mesh
is coplanar with the given plane defined by a normal non-zero vector n
and a point p
, by verifying if all face
vertices are within one tolerance
distance, in meters, from it.
face
belongs to the mesh
. bool IsMeshFacePlanar | ( | const GeoMesh & | mesh, |
const IndexFace & | face, | ||
double | tolerance, | ||
math::Vector3 * | n, | ||
math::Vector3 * | p | ||
) |
Checks if the face
in the given mesh
is planar, by verifying all face
vertices lie on a plane using the given tolerance
(see DoMeshVerticesLieOnPlane()).
Said plane, built out of the first vertex position and normal in the face
, is returned as a plane defined by a point p
and a normal non-zero vector n
.
[in] | mesh | Is a Inertial -frame mesh. |
[in] | face | Is a sequence of vertices with normals. |
[in] | tolerance | Is the tolerance to compute face planarity. |
[out] | n | Is a vector that with p define a plane that should contain all the face vertices. |
[out] | p | Is a point that with n define a plane that should contain all the face vertices. |
n
is not nullptr. p
is not nullptr. face
belongs to the mesh
. face
has at least three (3) vertices. GeoFace MergeMeshFaces | ( | const GeoMesh & | mesh, |
const std::set< int > & | mergeable_faces_indices, | ||
const FaceAdjacencyMap & | adjacent_faces_map, | ||
double | tolerance | ||
) |
Merges all the faces in the given mesh
referred by mergeable_faces_indices
into a single GeoFace.
mesh | Mesh the faces to be merged belong to. |
mergeable_faces_indices | Indices of the faces in mesh to be merged. |
adjacent_faces_map | Mapping of adjacent faces for the faces referred in mergeable_faces_indices . |
tolerance | For contour simplification, in meters. See SimplifyMeshFacesContour() function for further details. |
mergeable_faces_indices
yields a simply connected region (i.e. with no holes). const IndexFace::Vertex & MeshFaceVertexAt | ( | const GeoMesh & | mesh, |
const FaceVertexIndex & | face_vertex_index | ||
) |
Gets the face vertex in the mesh
referred by the given face_vertex_index
.
face_vertex_index
refers to a valid vertex in the mesh
. bool maliput::utility::mesh::operator!= | ( | const DirectedEdgeIndex & | lhs, |
const DirectedEdgeIndex & | rhs | ||
) |
bool maliput::utility::mesh::operator!= | ( | const FaceEdgeIndex & | lhs, |
const FaceEdgeIndex & | rhs | ||
) |
bool maliput::utility::mesh::operator== | ( | const DirectedEdgeIndex & | lhs, |
const DirectedEdgeIndex & | rhs | ||
) |
bool maliput::utility::mesh::operator== | ( | const FaceEdgeIndex & | lhs, |
const FaceEdgeIndex & | rhs | ||
) |
Simplifies a mesh by merging adjacent coplanar faces.
input_mesh | Mesh to be simplified. |
tolerance | Tolerance for simplification, in meters. See MergeMeshFaces() and AggregateAdjacentCoplanarMeshFaces() functions for further details. |
input_mesh
yields a simply connected region (i.e. with no holes). std::vector< FaceVertexIndex > SimplifyMeshFacesContour | ( | const GeoMesh & | mesh, |
const std::vector< FaceVertexIndex > & | contour_indices, | ||
double | tolerance | ||
) |
Simplifies the mesh
faces' contour referred by the given contour_indices
by elimination of redundant vertices, i.e.
vertices that lie within one tolerance
distance, in meters, from the line that the their following and preceding vertices subtend.