maliput
mesh_simplification.cc File Reference
#include "maliput/utility/mesh_simplification.h"
#include <algorithm>
#include <queue>
#include "maliput/common/maliput_abort.h"
Include dependency graph for mesh_simplification.cc:

Namespaces

 maliput
 Code in this file is inspired by: https://github.com/RobotLocomotion/drake/blob/master/common/text_logging.h.
 
 maliput::utility
 
 maliput::utility::mesh
 

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...
 
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...
 
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...
 
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...