polyhedron_utilities
¶
Polyhedron processing functions.
This module provides a variety of functions to process the data from a polyhedron model, which can be used to either modify or retrieved information from the specified polyhedron mesh.
References¶
Functions¶
|
Computes the surface area of a polyhedron [1]. |
|
Computes the volume of a polyhedron [1]. |
|
Computes the position of the centroid of a polyhedron [1]. |
|
Modifies vertex coordinates of the polyhedron based on the desired position of the centroid. |
Compute the inertia tensor of a polyhedron, from the density. |
|
Compute the inertia tensor of a polyhedron, from the gravitational parameter. |
- surface_area(vertices_coordinates: numpy.ndarray[numpy.float64[m, n]], vertices_defining_each_facet: numpy.ndarray[numpy.int32[m, n]]) float ¶
Computes the surface area of a polyhedron [1].
- Parameters:
vertices_coordinates (numpy.ndarray) – Cartesian coordinates of each polyhedron vertex. Entry (i,j) denotes vertex i, coordinate j (one row per vertex, 3 columns).
vertices_defining_each_facet (numpy.ndarray) – Index (0 based) of the vertices constituting each facet. Entry (i,j) denotes facet i, and the jth vertex of the facet (one row per facet, 3 columns). In each row, the vertices’ indices should be ordered counterclockwise when seen from the outside of the polyhedron.
- Returns:
Surface area.
- Return type:
- volume(vertices_coordinates: numpy.ndarray[numpy.float64[m, n]], vertices_defining_each_facet: numpy.ndarray[numpy.int32[m, n]]) float ¶
Computes the volume of a polyhedron [1].
- Parameters:
vertices_coordinates (numpy.ndarray) – Cartesian coordinates of each polyhedron vertex. Entry (i,j) denotes vertex i, coordinate j (one row per vertex, 3 columns).
vertices_defining_each_facet (numpy.ndarray) – Index (0 based) of the vertices constituting each facet. Entry (i,j) denotes facet i, and the jth vertex of the facet (one row per facet, 3 columns). In each row, the vertices’ indices should be ordered counterclockwise when seen from the outside of the polyhedron.
- Returns:
Volume.
- Return type:
- centroid(vertices_coordinates: numpy.ndarray[numpy.float64[m, n]], vertices_defining_each_facet: numpy.ndarray[numpy.int32[m, n]]) numpy.ndarray[numpy.float64[3, 1]] ¶
Computes the position of the centroid of a polyhedron [1].
- Parameters:
vertices_coordinates (numpy.ndarray) – Cartesian coordinates of each polyhedron vertex. Entry (i,j) denotes vertex i, coordinate j (one row per vertex, 3 columns).
vertices_defining_each_facet (numpy.ndarray) – Index (0 based) of the vertices constituting each facet. Entry (i,j) denotes facet i, and the jth vertex of the facet (one row per facet, 3 columns). In each row, the vertices’ indices should be ordered counterclockwise when seen from the outside of the polyhedron.
- Returns:
Position of the centroid.
- Return type:
- modify_centroid(vertices_coordinates: numpy.ndarray[numpy.float64[m, n]], vertices_defining_each_facet: numpy.ndarray[numpy.int32[m, n]], desired_centroid: numpy.ndarray[numpy.float64[3, 1]]) numpy.ndarray[numpy.float64[m, n]] ¶
Modifies vertex coordinates of the polyhedron based on the desired position of the centroid.
Modifies the coordinates of the polyhedron vertices, such that the centroid of the modified polyhedron coincides with the specified position. The centroid is computed according to Dobrovolskis [1].
- Parameters:
vertices_coordinates (numpy.ndarray) – Cartesian coordinates of each polyhedron vertex. Entry (i,j) denotes vertex i, coordinate j (one row per vertex, 3 columns).
vertices_defining_each_facet (numpy.ndarray) – Index (0 based) of the vertices constituting each facet. Entry (i,j) denotes facet i, and the jth vertex of the facet (one row per facet, 3 columns). In each row, the vertices’ indices should be ordered counterclockwise when seen from the outside of the polyhedron.
desired_centroid (numpy.ndarray) – Desired position of the centroid.
- Returns:
Vertices coordinates of the modified polyhedron, which has the specified centroid position.
- Return type:
- inertia_tensor_from_density(vertices_coordinates: numpy.ndarray[numpy.float64[m, n]], vertices_defining_each_facet: numpy.ndarray[numpy.int32[m, n]], density: float) numpy.ndarray[numpy.float64[3, 3]] ¶
Compute the inertia tensor of a polyhedron, from the density.
Computes the inertia tensor of a polyhedron, according to Dobrovolskis [1].
The mass distribution is defined using the density of the polyhedron. To instead use the gravitational parameter see
inertia_tensor_from_gravitational_parameter()
.- Parameters:
vertices_coordinates (numpy.ndarray) – Cartesian coordinates of each polyhedron vertex. Entry (i,j) denotes vertex i, coordinate j (one row per vertex, 3 columns).
vertices_defining_each_facet (numpy.ndarray) – Index (0 based) of the vertices constituting each facet. Entry (i,j) denotes facet i, and the jth vertex of the facet (one row per facet, 3 columns). In each row, the vertices’ indices should be ordered counterclockwise when seen from the outside of the polyhedron.
density (float) – Density of the polyhedron
- Returns:
Inertia tensor.
- Return type:
- inertia_tensor_from_gravitational_parameter(vertices_coordinates: numpy.ndarray[numpy.float64[m, n]], vertices_defining_each_facet: numpy.ndarray[numpy.int32[m, n]], gravitational_parameter: float, gravitational_constant: float) numpy.ndarray[numpy.float64[3, 3]] ¶
Compute the inertia tensor of a polyhedron, from the gravitational parameter.
Computes the inertia tensor of a polyhedron, according to Dobrovolskis [1].
The mass distribution is defined using the gravitational parameter of the polyhedron. To instead use the density see
inertia_tensor_from_density()
.- Parameters:
vertices_coordinates (numpy.ndarray) – Cartesian coordinates of each polyhedron vertex. Entry (i,j) denotes vertex i, coordinate j (one row per vertex, 3 columns).
vertices_defining_each_facet (numpy.ndarray) – Index (0 based) of the vertices constituting each facet. Entry (i,j) denotes facet i, and the jth vertex of the facet (one row per facet, 3 columns). In each row, the vertices’ indices should be ordered counterclockwise when seen from the outside of the polyhedron.
gravitational_parameter (float) – Gravitational parameter \(\mu\) of gravity field.
- Returns:
Inertia tensor.
- Return type: