template<class T>
class drake::geometry::VolumeMesh< T >
VolumeMesh represents a tetrahedral volume mesh.
- Template Parameters
-
T | The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar. |
|
| VolumeMesh (std::vector< VolumeElement > &&elements, std::vector< Vector3< T >> &&vertices) |
| Constructor from a vector of vertices and from a vector of elements. More...
|
|
const VolumeElement & | element (int e) const |
|
const Vector3< T > & | vertex (int v) const |
| Returns the vertex identified by a given index. More...
|
|
const Vector3< T > & | inward_normal (int e, int f) const |
| Returns the inward facing normal of face f of element e. More...
|
|
const Vector3< T > & | edge_vector (int e, int a, int b) const |
| Returns p_AB_M, the position vector from vertex A to vertex B in M, where A and B are specified by the element local indices a and b of element e. More...
|
|
const std::vector< Vector3< T > > & | vertices () const |
|
const std::vector< VolumeElement > & | tetrahedra () const |
|
int | num_elements () const |
| Returns the number of tetrahedral elements in the mesh. More...
|
|
int | num_vertices () const |
| Returns the number of vertices in the mesh. More...
|
|
T | CalcTetrahedronVolume (int e) const |
| Calculates volume of a tetrahedral element. More...
|
|
T | CalcVolume () const |
| Calculates the volume of this mesh by taking the sum of the volume of each tetrahedral element. More...
|
|
template<typename C > |
Barycentric< promoted_numerical_t< T, C > > | CalcBarycentric (const Vector3< C > &p_MQ, int e) const |
| Calculate barycentric coordinates with respect to the tetrahedron e of the point Q. More...
|
|
bool | Equal (const VolumeMesh< T > &mesh, double vertex_tolerance=0) const |
| Checks to see whether the given VolumeMesh object is equal via deep comparison (up to a tolerance). More...
|
|
template<typename FieldValue > |
std::optional< Vector3< promoted_numerical_t< T, FieldValue > > > | MaybeCalcGradientVectorOfLinearField (const std::array< FieldValue, 4 > &field_value, int e) const |
| Calculates the gradient ∇u of a linear field u on the tetrahedron e . More...
|
|
template<typename FieldValue > |
Vector3< promoted_numerical_t< T, FieldValue > > | CalcGradientVectorOfLinearField (const std::array< FieldValue, 4 > &field_value, int e) const |
| Like MaybeCalcGradientVectorOfLinearField, but throws if the geometry is degenerate. More...
|
|
void | TransformVertices (const math::RigidTransform< T > &transform) |
| Transforms the vertices of this mesh from its initial frame M to the new frame N. More...
|
|
void | SetAllPositions (const Eigen::Ref< const VectorX< T >> &p_MVs) |
| Updates the position of all vertices in the mesh. More...
|
|
|
| VolumeMesh (const VolumeMesh &)=default |
|
VolumeMesh & | operator= (const VolumeMesh &)=default |
|
| VolumeMesh (VolumeMesh &&)=default |
|
VolumeMesh & | operator= (VolumeMesh &&)=default |
|
Type of barycentric coordinates on a tetrahedral element.
Barycentric coordinates (b₀, b₁, b₂, b₃) satisfy b₀ + b₁ + b₂ + b₃ = 1. It corresponds to a position in the space. If all bᵢ >= 0, it corresponds to a position inside the tetrahedron or on the faces of the tetrahedron. If some bᵢ < 0, it corresponds to a position outside the tetrahedron. Technically we could calculate one of the bᵢ from the others; however, there is no standard way to omit one of the coordinates.
std::optional<Vector3<promoted_numerical_t<T, FieldValue> > > MaybeCalcGradientVectorOfLinearField |
( |
const std::array< FieldValue, 4 > & |
field_value, |
|
|
int |
e |
|
) |
| const |
Calculates the gradient ∇u of a linear field u on the tetrahedron e
.
Field u is defined by the four field values field_value[i]
at the i-th vertex of the tetrahedron. The gradient ∇u is expressed in the coordinates frame of this mesh M.
If the return value is std::nullopt, the tetrahedron is degenerate, and no reliable gradient could be computed.
The return type depends on both the mesh's vertex position scalar type T
and the given field's scalar type FieldValue
. See promoted_numerical_t for details.
void SetAllPositions |
( |
const Eigen::Ref< const VectorX< T >> & |
p_MVs | ) |
|
Updates the position of all vertices in the mesh.
Each sequential triple in p_MVs (e.g., 3i, 3i + 1, 3i + 2), i ∈ ℤ, is interpreted as a position vector associated with the iᵗʰ vertex. The position values are interpreted to be measured and expressed in the same frame as the mesh to be deformed.
- Parameters
-
p_MVs | Vertex positions for the mesh's N vertices flattened into a vector (where each position vector is measured and expressed in the mesh's original frame). |
- Exceptions
-