vtkPolyhedron

Struct vtkPolyhedron 

Source
pub struct vtkPolyhedron(/* private fields */);
Expand description

A 3D cell defined by a set of polygonal faces

@section Instantiation Instantiation

vtkPolyhedron is a concrete implementation of vtkCell that represents a 3D cell defined by a set of polygonal faces.

To instantiate a vtkPolyhedron, like any vtkCell, one needs to define the following structures:

  • A list of point coordinates
  • A list of global point IDs

Note that the ordering of points coordinates or IDs is not important. However, it MUST be consistent between the two lists.

Unlike other kinds of cells (e.g. vtkVoxel), the topology is not directly deduced from points coordinates or point IDs ordering; it must be explicitly defined by providing a list of faces (see the SetFaces() method). Each face is represented as a sequence of global point Ids.

Once point coordinates, point IDs and faces are defined, the Initialize() method should be called in order to setup the internal structures and finalize the construction of the polyhedron.

Here is an example of vtkPolyhedron instantiation: @code{.cpp}

// 9 +——+.11 // |. | . // |13+--+---+ 15 // | | | | // 8 +---+--+.10| // . | .| // 12+——+ 14 // // (Global IDs are arbitrarily chosen between 8 and 15)

// Insert point coordinates polyhedron->GetPoints()->SetNumberOfPoints(8); polyhedron->GetPoints()->SetPoint(0, 0., 0., 0.); // 8 polyhedron->GetPoints()->SetPoint(1, 0., 1., 0.); // 9 polyhedron->GetPoints()->SetPoint(2, 1., 0., 0.); // 10 polyhedron->GetPoints()->SetPoint(3, 1., 1., 0.); // 11 polyhedron->GetPoints()->SetPoint(4, 0., 0., 1.); // 12 polyhedron->GetPoints()->SetPoint(5, 0., 1., 1.); // 13 polyhedron->GetPoints()->SetPoint(6, 1., 0., 1.); // 14 polyhedron->GetPoints()->SetPoint(7, 1., 1., 1.); // 15

// Insert point IDs (global IDs) // Note that the canonical ordering (0, 1, …, 8) is used // to correlate point Ids and coordinates polyhedron->GetPointIds()->Allocate(8); for (int i = 8; i < 16; ++i) { polyhedron->GetPointIds()->InsertNextId(i); }

// Describe faces, indexed on global IDs vtkIdType faces[31] = { 6, // Number of faces 4, 9 , 11, 10, 8 , // Number of points in the face + point IDs 4, 11, 15, 14, 10, // Faces are described counter-clockwise 4, 15, 13, 12, 14, // looking from the “outside” of the cell 4, 13, 9 , 8 , 12, 4, 14, 12, 8 , 10, 4, 13, 15, 11, 9 };

polyhedron->SetFaces(faces);

// Initialize the polyhedron // This will build internal structures and should be done before the proper // use of the cell. polyhedron->Initialize(); @endcode

@section Specifications Specifications

Polyhedrons described by this class must conform to some criteria in order to avoid errors and guarantee good results in terms of visualization and processing.

These specifications are described as follows. Polyhedrons must:

  • be watertight : the faces describing the polyhedron should define an enclosed volume i.e. define the “inside” and the “outside” of the cell
  • have planar faces : all points defining a face should be in the same 2D plane
  • not be self-intersecting : for example, a face of the polyhedron can’t intersect other ones
  • not contain zero-thickness portions : adjacent faces should not overlap each other even partially
  • not contain disconnected elements : detached vertice(s), edge(s) or face(s)
  • be simply connected : vtkPolyhedron must describe a single polyhedron
  • not contain duplicate elements : each point index and each face description should be unique
  • not contain “internal” or “external” faces : for each face, one side should be “inside” the cell, the other side “outside”

In a more global perspective, polyhedrons must be watertight and manifold. In particular, each edge of the polyhedron must be adjacent to exactly two faces. Several algorithms like contour, clip or slice will assume that each edge of the polyhedron is adjacent to exactly two faces and will definitely lead to bad results (and generate numerous warnings) if this criterion is not fulfilled.

@section Limitations Limitations

The class does not require the polyhedron to be convex. However, the support of concave polyhedrons is currently limited. Concavity can lead to bad results with some filters, including:

  • Contour: the contour (surface) can be constructed outside of the cell,
  • Triangulate: the current tetrahedralization algorithm can modify the initial shape of the polygon (created tetrahedrons can change concave portions of the shape to convex ones).

@section OtherDetails Other details

Interpolation functions and weights are defined / computed using the method of Mean Value Coordinates (MVC). See the VTK class vtkMeanValueCoordinatesInterpolator for more information.

@sa vtkCell3D vtkConvexPointSet vtkMeanValueCoordinatesInterpolator vtkPolyhedronUtilities

Implementations§

Source§

impl vtkPolyhedron

Source

pub fn new() -> Self

Creates a new vtkPolyhedron wrapped inside vtkNew

Trait Implementations§

Source§

impl Default for vtkPolyhedron

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for vtkPolyhedron

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.