|
cgv
|
simple mesh templated with per vertex position and texture coordinates and per face plane. More...
#include <convex_polyhedron.h>
Inherits cgv::media::mesh::convex_polyhedron_base.
Classes | |
| struct | vertex_type |
| type of a vertex More... | |
Public Types | |
| typedef T | coord_type |
| declare coordinate type | |
| typedef cgv::math::fvec< T, 3 > | point_type |
| position type | |
| typedef cgv::math::fvec< T, TCDim > | texcoord_type |
| texture coordinate type | |
| typedef cgv::math::fvec< T, 4 > | plane_type |
| plane type | |
| typedef cgv::media::axis_aligned_box< T, 3 > | box_type |
| type of axis aligned box | |
| enum | VertexPlaneLocation |
| enumeration of different vertex locations with respect to plane | |
| enum | FacePlaneLocation |
| enumeration of 11 valid and 5 invalid cases that a face can be located with respect to a plane after locating vertices into outside, inside or touching | |
| typedef std::vector< int > | face_type |
| a face is an oriented list of vertex indices | |
| typedef std::vector< face_type > | shell_type |
| a shell is simply a list of faces | |
Public Member Functions | |
| FacePlaneLocation | get_face_plane_location (const face_type &face, const std::vector< VertexPlaneLocation > &vertex_locations) const |
| given a face as a list of vertex indices and a vector of vertex locations, determine the face location with respect to the current clip plane | |
vertex handling | |
| size_t | get_nr_vertices () const |
| virtual int | add_vertex () |
| void | del_vertex (int vi) |
| remove a vertex | |
| const vertex_type & | vertex (int vi) const |
| vertex_type & | vertex (int vi) |
| const point_type & | position (int vi) const |
| point_type & | position (int vi) |
| const texcoord_type & | texcoord (int vi) const |
| texcoord_type & | texcoord (int vi) |
handling of shells and faces | |
| size_t | get_nr_shells () const |
| return the current number of shells | |
| const shell_type & | shell (int si) const |
| shell_type & | shell (int si) |
| size_t | get_nr_faces (int si=0) const |
| const face_type & | face (int fi, int si=0) const |
| face_type & | face (int fi, int si=0) |
handling of vertices | |
| void | remove_redundant_vertices () |
| remove redundant vertices from mesh | |
Static Public Member Functions | |
| static int | to_index (VertexPlaneLocation vertex_location) |
convert VertexPlaneLocation to an index in the range {0 .. 2} | |
| static bool | is_face_location_on_one_side (FacePlaneLocation face_location) |
| check if a face location is on one side of the plane only with potential touch events | |
| static bool | is_face_location_split (FacePlaneLocation face_location) |
| check if a face location corresponds to a split into parts (two for convex faces) | |
| static bool | is_valid_face_location (FacePlaneLocation face_location) |
| check if a face location corresponds to a valid configuration assuming planar convex faces | |
| static int | box_get_face_vertex_index (int fi, int ci) |
| function implementing the connectivity of an axis aligned box | |
| static void | change_orientation (face_type &face) |
| revert the orientation of a face in place, where the face is given by a list of vertex indices | |
| static VertexPlaneLocation | vertex_location_side (const std::vector< VertexPlaneLocation > &vertex_locations) |
| check whether all vertices lay on one side of the plane or on it, but not on the other; return side or VPL_TOUCH if vertices lay on both sides | |
| static VertexPlaneLocation | shell_location_side (const std::vector< FacePlaneLocation > &face_locations) |
| check whether all faces of a shell lay on one side of the plane or touch it, but not on the other side; return side or VPL_TOUCH if shell is intersected by plane | |
| static std::pair< int, int > | extract_touching_halfedge (const face_type &face, const std::vector< VertexPlaneLocation > &vertex_locations) |
| given a face as a list of vertex indices and a vector of vertex locations, find a halfedge that touches the current clip plane More... | |
Public Attributes | |
| const cgv::type::int32_type | texcoord_dim = TCDim |
| declare dimension of texture coordinates | |
Protected Attributes | |
| std::vector< vertex_type > | vertices |
| vector to store vertices of all components in one vector | |
| std::vector< std::vector< plane_type > > | face_planes |
| per shell a vector to store one plane per face | |
| std::vector< shell_type > | shells |
| vector of shells | |
handling of face planes | |
| const plane_type & | face_plane (int fi, int si=0) const |
| return const reference to plane of face fi in shell si | |
| plane_type & | face_plane (int fi, int si=0) |
| return reference to plane of face fi in shell si | |
| plane_type | compute_face_plane (int fi, int si=0) const |
| compute a face plane from the vertex positions | |
| int | add_shell () |
| add a new shell and return shell index | |
| void | del_shell (int si) |
| remove the shell of the given index, be careful as shell indices large si get implizitely decreased | |
| void | copy_shell (int si_source, int si_target) |
| copy a shell onto another one | |
| void | swap_shells (int si0, int si1) |
| swap two shells | |
| int | add_face (int si=0) |
| void | del_face (int fi, int si=0) |
| void | construct_box (const box_type &box) |
| construct a polyhedron representing an axis aligned box | |
| void | clear () |
| clear data structure | |
| void | compute_vertex_locations (const plane_type &plane, std::vector< VertexPlaneLocation > &vertex_locations, T epsilon=16 *std::numeric_limits< T >::epsilon(), std::vector< T > *vertex_signed_distances_ptr=0) const |
| construct a vector of vertex locations relative to given plane | |
| bool | check_face_locations (unsigned si, const std::vector< VertexPlaneLocation > &vertex_locations, std::vector< FacePlaneLocation > &face_locations) const |
compute face plane locations of the faces of one shell, store them in the vector face_locations and return if all is valid (assuming convex shape and convex faces) | |
| bool | ensure_vertex_location_consistency (unsigned si, const std::vector< T > &vertex_signed_distances, std::vector< VertexPlaneLocation > &vertex_locations, const std::vector< FacePlaneLocation > &face_locations, T epsilon=16 *std::numeric_limits< T >::epsilon(), T epsilon_flexibiliy=8) |
| if the previous check is invalid, call this function to change the vertex signs in order to validate the face plane locations (not implemented yet) | |
| int | clip_to_inside_of_plane (unsigned si, const plane_type &clip_plane, bool keep_original_shell=false, T epsilon=16 *std::numeric_limits< T >::epsilon(), T epsilon_flexibiliy=8) |
| compute the interior of the given shell si with respect to the given clipping plane and either replace the shell or create a new one More... | |
| int | clip_to_outside_of_plane (unsigned si, const plane_type &clip_plane, bool keep_original_shell=false, T epsilon=16 *std::numeric_limits< T >::epsilon(), T epsilon_flexibiliy=8) |
| compute the exterior of the given shell si with respect to the given clipping plane and either replace the shell or create a new one More... | |
| std::pair< int, int > | split_at_plane (unsigned si, const plane_type &split_plane, bool keep_original_shell=false, T epsilon=16 *std::numeric_limits< T >::epsilon(), T epsilon_flexibiliy=8, std::vector< VertexPlaneLocation > *vertex_locations_ptr=0) |
| split the given shell into interior and exterior More... | |
| std::vector< vertex_type > | compute_intersection_polygon (unsigned si, const plane_type &plane, T epsilon=16 *std::numeric_limits< T >::epsilon(), T epsilon_flexibiliy=8) const |
| compute the intersection polygon between a shell and a plane | |
| static bool | orientation_match (const plane_type &p, const plane_type &q) |
| check if planes are oriented in the same normal direction | |
simple mesh templated with per vertex position and texture coordinates and per face plane.
First template parameter is common type and the second is the dimension of texture coordinates
| int cgv::media::mesh::convex_polyhedron< T, TCDim >::clip_to_inside_of_plane | ( | unsigned | si, |
| const plane_type & | clip_plane, | ||
| bool | keep_original_shell = false, |
||
| T | epsilon = 16 * std::numeric_limits<T>::epsilon(), |
||
| T | epsilon_flexibiliy = 8 |
||
| ) |
compute the interior of the given shell si with respect to the given clipping plane and either replace the shell or create a new one
return the index of the new shell or -1 if the shell was empty and therefore not created. If the current shell was to be replace with an empty result, it is simply deleted.
| int cgv::media::mesh::convex_polyhedron< T, TCDim >::clip_to_outside_of_plane | ( | unsigned | si, |
| const plane_type & | clip_plane, | ||
| bool | keep_original_shell = false, |
||
| T | epsilon = 16 * std::numeric_limits<T>::epsilon(), |
||
| T | epsilon_flexibiliy = 8 |
||
| ) |
compute the exterior of the given shell si with respect to the given clipping plane and either replace the shell or create a new one
return the index of the new shell or -1 if the shell was empty and therefore not created. If the current shell was to be replace with an empty result, it is simply deleted.
|
staticinherited |
given a face as a list of vertex indices and a vector of vertex locations, find a halfedge that touches the current clip plane
find a halfedge that touches the current clip plane
| std::pair< int, int > cgv::media::mesh::convex_polyhedron< T, TCDim >::split_at_plane | ( | unsigned | si, |
| const plane_type & | split_plane, | ||
| bool | keep_original_shell = false, |
||
| T | epsilon = 16 * std::numeric_limits<T>::epsilon(), |
||
| T | epsilon_flexibiliy = 8, |
||
| std::vector< VertexPlaneLocation > * | vertex_locations_ptr = 0 |
||
| ) |
split the given shell into interior and exterior
return shell index pair where first index corresponds to interior part and second to exterior part. If a shell is empty the returned shell index is set to -1.