Virtual Testbed
Ship dynamics simulator for extreme conditions
|
Three-dimensional polyhedron. More...
#include <polyhedron.hh>
Public Types | |
using | scalar_type = T |
using | vertex_type = Vertex< T, N > |
using | face_type = Face< 3 > |
using | vertex_array = std::vector< vertex_type > |
using | face_array = std::vector< face_type > |
using | size_type = size_t |
using | index_type = typename face_type::value_type |
using | box_type = Rectangle< T, N > |
using | triangle_type = Triangle< T, N > |
using | triangle_array = std::vector< triangle_type > |
using | bsp_tree = BSP_tree< T, N > |
Public Member Functions | |
Polyhedron (const Polyhedron &)=default | |
Polyhedron & | operator= (const Polyhedron &)=default |
Polyhedron (Polyhedron &&)=default | |
Polyhedron & | operator= (Polyhedron &&)=default |
Polyhedron (const vertex_array &vertices, const face_array &faces) | |
Polyhedron (const vertex_array &vertices, const vertex_array &vertex_normals, const face_array &faces) | |
Polyhedron (const blitz_vertex_array &vertices, const blitz_face_array &faces) | |
Polyhedron (const triangle_array &triangles) | |
Polyhedron (const bsp_tree &tree) | |
const vertex_array & | vertices () const noexcept |
const vertex_array & | vertex_normals () const noexcept |
const vertex_array & | face_normals () const noexcept |
const face_array & | faces () const noexcept |
void | clear () |
void | clear_normals () |
void | shrink_to_fit () |
scalar_type | average_face_area () const |
scalar_type | signed_volume () const |
scalar_type | signed_volume_below (int dimension, scalar_type level) const |
vertex_type | centre () const |
vertex_type | centroid () const |
vertex_type | centroid_below (int dimension, scalar_type level) const |
box_type | bounding_box () const |
Bounds< T > | bounds (int dimension) const |
void | swap (Polyhedron &rhs) |
scalar_type | signed_volume_below_centroid (int dimension) const |
void | normalise () |
Compute face and vertex normals in one loop. More... | |
void | normalise_faces () |
Compute face normals only. More... | |
void | reorder () |
Fix face indices winding order. More... | |
void | unique () |
Remove duplicate vertices and faces. More... | |
void | merge (const Polyhedron &rhs) |
Add all vertices, faces and normals from rhs . More... | |
Polyhedron & | operator+= (const Polyhedron &rhs) |
void | cut_duplicate_faces () |
void | remove_face (const vertex_type &vertex) |
void | remove_face (index_type vertex) |
bool | empty () const |
triangle_array | triangles () const |
blitz_vertex_array | blitz_vertices () const |
blitz_vertex_array | blitz_vertex_normals () const |
blitz_face_array | blitz_faces () const |
void | move_to_centre_of_mass () |
Move origin to centre of mass. | |
void | move_to_centre_of_mass (T draught) |
Move origin to centre of mass taking into account buoyancy and gravity forces. More... | |
void | move_to_centre_of_bounding_box () |
Move origin to centre of bounding box. | |
void | move (const vertex_type &delta) |
void | scale (const vertex_type &ratio) |
Scale the geometry by specified ratio over each dimension. | |
void | wall (scalar_type thickness) |
Shrink or extend the geometry by thickness in the direction of centroid. | |
void | flip (int dimension) |
Flip the geometry over specified axis. | |
void | mirror (int dimension) |
Extend the geometry by mirroring it over the specified axis. | |
void | rotate (int dimension, int degrees) |
Rotate the geometry by angle which is multiple of 90 degrees. More... | |
Mass_moments< T, N > | mass_moments () const |
Calculate volume, centre of mass and inertia tensor. More... | |
Mass_moments< T, N > | mass_moments_below (int dimension, scalar_type level) const |
void | gnuplot (std::ostream &out) const |
void | object (std::ostream &out) const |
Static Public Attributes | |
static constexpr const int | dimensions = N |
Friends | |
template<class X , int M> | |
vtb::core::bstream & | operator>> (vtb::core::bstream &in, Polyhedron< X, M > &rhs) |
Three-dimensional polyhedron.
Definition at line 43 of file polyhedron.hh.
|
inline |
Calculate volume, centre of mass and inertia tensor.
Definition at line 270 of file polyhedron.hh.
void vtb::geometry::Polyhedron< T, N >::merge | ( | const Polyhedron< T, N > & | rhs | ) |
Add all vertices, faces and normals from rhs
.
Definition at line 343 of file geometry/polyhedron.cc.
void vtb::geometry::Polyhedron< T, N >::move_to_centre_of_mass | ( | T | draught | ) |
Move origin to centre of mass taking into account buoyancy and gravity forces.
[in] | draught |
Definition at line 628 of file geometry/polyhedron.cc.
void vtb::geometry::Polyhedron< T, N >::normalise | ( | ) |
Compute face and vertex normals in one loop.
Definition at line 152 of file geometry/polyhedron.cc.
void vtb::geometry::Polyhedron< T, N >::normalise_faces | ( | ) |
void vtb::geometry::Polyhedron< T, N >::reorder | ( | ) |
Fix face indices winding order.
Definition at line 202 of file geometry/polyhedron.cc.
void vtb::geometry::Polyhedron< T, N >::rotate | ( | int | dimension, |
int | degrees | ||
) |
Rotate the geometry by angle which is multiple of 90 degrees.
[in] | dim | dimensions over which rotation is done |
[in] | degrees | How many degrees to rotate. This should be a multiple of 90. |
Definition at line 818 of file geometry/polyhedron.cc.
void vtb::geometry::Polyhedron< T, N >::unique | ( | ) |
Remove duplicate vertices and faces.
Definition at line 234 of file geometry/polyhedron.cc.