DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger > Struct Template Reference

Aim: 3D specialization for BoundedRationalPolytope to add dimension specific static methods. More...

#include <DGtal/geometry/volumes/BoundedRationalPolytope.h>

Public Types

typedef TInteger Integer
 
typedef SpaceND< 3, IntegerSpace
 
typedef Space::Point Point
 
typedef Space::Vector Vector
 
typedef BoundedRationalPolytope< SpacePolytope
 

Static Public Member Functions

static void addEdgeConstraint (Polytope &P, unsigned int i, unsigned int j, const std::vector< Point > &pts)
 
static Vector crossProduct (const Vector &v1, const Vector &v2)
 

Static Public Attributes

static const Dimension dimension = Space::dimension
 

Detailed Description

template<typename TInteger>
struct DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >

Aim: 3D specialization for BoundedRationalPolytope to add dimension specific static methods.

Description of template class 'BoundedRationalPolytopeSpecializer'

Template Parameters
TIntegerany model of integer.

Definition at line 747 of file BoundedRationalPolytope.h.

Member Typedef Documentation

◆ Integer

template<typename TInteger >
typedef TInteger DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::Integer

Definition at line 748 of file BoundedRationalPolytope.h.

◆ Point

template<typename TInteger >
typedef Space::Point DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::Point

Definition at line 750 of file BoundedRationalPolytope.h.

◆ Polytope

template<typename TInteger >
typedef BoundedRationalPolytope< Space > DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::Polytope

Definition at line 752 of file BoundedRationalPolytope.h.

◆ Space

template<typename TInteger >
typedef SpaceND< 3, Integer> DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::Space

Definition at line 749 of file BoundedRationalPolytope.h.

◆ Vector

template<typename TInteger >
typedef Space::Vector DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::Vector

Definition at line 751 of file BoundedRationalPolytope.h.

Member Function Documentation

◆ addEdgeConstraint()

template<typename TInteger >
static void DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::addEdgeConstraint ( Polytope & P,
unsigned int i,
unsigned int j,
const std::vector< Point > & pts )
inlinestatic

This method add extremal constraints for simplex edges. Each constraint is a half-space bounded by the edge and one axis. Such constraints are useful when computing the Minkowski sum.

Parameters
[in,out]Pany polytope.
[in]iany index in the vector of points pts.
[in]jany index in the vector of points pts.
[in]ptsa vector of points defining a simplex.

Definition at line 765 of file BoundedRationalPolytope.h.

767 {
768 Vector ab = pts[ i ] - pts[ j ];
769 for ( int s = 0; s < 2; s++ )
770 for ( Dimension k = 0; k < dimension; ++k )
771 {
772 Vector n = ab.crossProduct( Point::base( k, (s == 0) ? 1 : -1 ) );
773 Integer b = n.dot( pts[ i ] );
774 std::size_t nb_in = 0;
775 for ( auto p : pts ) {
776 Integer v = n.dot( p );
777 if ( v < b ) nb_in++;
778 }
779 if ( nb_in == dimension - 1 ) {
780 P.cut( n, b, true, true );
781 }
782 }
783 }
static Self base(Dimension k, Component val=1)
DigitalPlane::Point Vector
DGtal::uint32_t Dimension
Definition Common.h:136

References DGtal::PointVector< dim, Integer >::base(), DGtal::PointVector< dim, TEuclideanRing, TContainer >::crossProduct(), DGtal::BoundedRationalPolytope< TSpace >::cut(), and DGtal::detail::BoundedRationalPolytopeSpecializer< N, TInteger >::dimension.

◆ crossProduct()

template<typename TInteger >
static Vector DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::crossProduct ( const Vector & v1,
const Vector & v2 )
inlinestatic

Generic method for cross product, only implemented in 3D.

Parameters
v1any vector
v2any vector
Returns
their cross product.

Definition at line 789 of file BoundedRationalPolytope.h.

790 {
791 return v1.crossProduct( v2 );
792 }

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::crossProduct().

Field Documentation

◆ dimension

template<typename TInteger >
const Dimension DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::dimension = Space::dimension
static

Definition at line 753 of file BoundedRationalPolytope.h.


The documentation for this struct was generated from the following file: