Loading [MathJax]/extensions/MathMenu.js
DGtal 2.0.0
DGtal::QuickHull< TKernel >::Facet Struct Reference

#include <DGtal/geometry/tools/QuickHull.h>

Public Member Functions

 Facet ()=default
 Facet (const Facet &)=default
 Facet (Facet &&)=default
Facetoperator= (Facet &&)=default
Facetoperator= (const Facet &)=default
 Facet (const HalfSpace &aH, Index b)
void clear ()
void addPointOn (Index p)
void display (std::ostream &out) const
void addNeighbor (Index n)
void subNeighbor (Index n)
void swap (Facet &other)
Size variableMemory () const

Data Fields

HalfSpace H
 the facet geometry
IndexRange neighbors
 neighbor facets
IndexRange outside_set
 outside set, i.e. points above this facet
IndexRange on_set
 on set, i.e. points on this facet, sorted
Index below
 index of point that is below this facet

Detailed Description

template<typename TKernel>
struct DGtal::QuickHull< TKernel >::Facet

A facet is d-1 dimensional convex cell lying on the boundary of a full dimensional convex set. Its supporting hyperplane defines an half-space touching and enclosing the convex set.

Definition at line 160 of file QuickHull.h.

Constructor & Destructor Documentation

◆ Facet() [1/4]

template<typename TKernel>
DGtal::QuickHull< TKernel >::Facet::Facet ( )
default

Referenced by Facet(), Facet(), operator=(), operator=(), and swap().

◆ Facet() [2/4]

template<typename TKernel>
DGtal::QuickHull< TKernel >::Facet::Facet ( const Facet & )
default

References Facet().

◆ Facet() [3/4]

template<typename TKernel>
DGtal::QuickHull< TKernel >::Facet::Facet ( Facet && )
default

References Facet().

◆ Facet() [4/4]

template<typename TKernel>
DGtal::QuickHull< TKernel >::Facet::Facet ( const HalfSpace & aH,
Index b )
inline

Definition at line 172 of file QuickHull.h.

173 : H( aH ), below( b ) {}
Index below
index of point that is below this facet
Definition QuickHull.h:165
HalfSpace H
the facet geometry
Definition QuickHull.h:161
Aim: Implements the quickhull algorithm by Barber et al. barber1996, a famous arbitrary dimensional c...
Definition QuickHull.h:140

References below, and H.

Member Function Documentation

◆ addNeighbor()

template<typename TKernel>
void DGtal::QuickHull< TKernel >::Facet::addNeighbor ( Index n)
inline

Definition at line 201 of file QuickHull.h.

202 {
203 const auto it = std::find( neighbors.cbegin(), neighbors.cend(), n );
204 if ( it == neighbors.cend() ) neighbors.push_back( n );
205 }
IndexRange neighbors
neighbor facets
Definition QuickHull.h:162

References neighbors.

◆ addPointOn()

template<typename TKernel>
void DGtal::QuickHull< TKernel >::Facet::addPointOn ( Index p)
inline

Definition at line 183 of file QuickHull.h.

184 {
185 const auto it = std::find( on_set.cbegin(), on_set.cend(), p );
186 if ( it == on_set.cend() ) on_set.push_back( p );
187 }
IndexRange on_set
on set, i.e. points on this facet, sorted
Definition QuickHull.h:164

References on_set.

◆ clear()

template<typename TKernel>
void DGtal::QuickHull< TKernel >::Facet::clear ( )
inline

Definition at line 175 of file QuickHull.h.

176 {
177 H = HalfSpace();
178 neighbors.clear();
179 outside_set.clear();
180 on_set.clear();
182 }
IndexRange outside_set
outside set, i.e. points above this facet
Definition QuickHull.h:163
Kernel::HalfSpace HalfSpace
Definition QuickHull.h:150

References below, H, neighbors, on_set, outside_set, and DGtal::QuickHull< TKernel >::UNASSIGNED.

◆ display()

template<typename TKernel>
void DGtal::QuickHull< TKernel >::Facet::display ( std::ostream & out) const
inline

Definition at line 188 of file QuickHull.h.

189 {
190 const auto N = H.internalNormal();
191 out << "[Facet iN=(" << N[0];
192 for ( Dimension i = 1; i < N.dimension; i++ ) out << "," << N[ i ];
193 out << ") c=" << H.internalIntercept() << " b=" << below << " n={";
194 for ( auto&& n : neighbors ) out << " " << n;
195 out << " } #out=" << outside_set.size();
196 out << " on={";
197 for ( auto&& n : on_set ) out << " " << n;
198 out << " }]" << std::endl;
199 }
static const Size dimension
Definition QuickHull.h:152

References below, H, neighbors, on_set, and outside_set.

◆ operator=() [1/2]

template<typename TKernel>
Facet & DGtal::QuickHull< TKernel >::Facet::operator= ( const Facet & )
default

References Facet().

◆ operator=() [2/2]

template<typename TKernel>
Facet & DGtal::QuickHull< TKernel >::Facet::operator= ( Facet && )
default

References Facet().

◆ subNeighbor()

template<typename TKernel>
void DGtal::QuickHull< TKernel >::Facet::subNeighbor ( Index n)
inline

Definition at line 206 of file QuickHull.h.

207 {
208 auto it = std::find( neighbors.begin(), neighbors.end(), n );
209 if ( it != neighbors.end() ) {
210 std::swap( *it, neighbors.back() );
211 neighbors.pop_back();
212 }
213 }

References neighbors.

◆ swap()

template<typename TKernel>
void DGtal::QuickHull< TKernel >::Facet::swap ( Facet & other)
inline

Definition at line 214 of file QuickHull.h.

215 {
216 if ( this != &other ) {
217 std::swap( H, other.H );
218 neighbors.swap ( other.neighbors );
219 outside_set.swap( other.outside_set );
220 on_set.swap ( other.on_set );
221 std::swap( below, other.below );
222 }
223 }

References below, Facet(), H, neighbors, on_set, and outside_set.

◆ variableMemory()

template<typename TKernel>
Size DGtal::QuickHull< TKernel >::Facet::variableMemory ( ) const
inline

Definition at line 224 of file QuickHull.h.

225 {
226 Size M;
227 M += neighbors.capacity() * sizeof( Index );
228 M += outside_set.capacity() * sizeof( Index );
229 M += on_set.capacity() * sizeof( Index );
230 return M;
231 }

References neighbors, on_set, and outside_set.

Field Documentation

◆ below

template<typename TKernel>
Index DGtal::QuickHull< TKernel >::Facet::below

index of point that is below this facet

Definition at line 165 of file QuickHull.h.

Referenced by clear(), display(), Facet(), and swap().

◆ H

template<typename TKernel>
HalfSpace DGtal::QuickHull< TKernel >::Facet::H

the facet geometry

Definition at line 161 of file QuickHull.h.

Referenced by clear(), display(), Facet(), and swap().

◆ neighbors

template<typename TKernel>
IndexRange DGtal::QuickHull< TKernel >::Facet::neighbors

neighbor facets

Definition at line 162 of file QuickHull.h.

Referenced by addNeighbor(), clear(), display(), subNeighbor(), swap(), and variableMemory().

◆ on_set

template<typename TKernel>
IndexRange DGtal::QuickHull< TKernel >::Facet::on_set

on set, i.e. points on this facet, sorted

Definition at line 164 of file QuickHull.h.

Referenced by addPointOn(), clear(), display(), swap(), and variableMemory().

◆ outside_set

template<typename TKernel>
IndexRange DGtal::QuickHull< TKernel >::Facet::outside_set

outside set, i.e. points above this facet

Definition at line 163 of file QuickHull.h.

Referenced by clear(), display(), swap(), and variableMemory().


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