QUAOAR STUDIO // Mobius API
mobius::poly_SVO Class Reference

#include <poly_SVO.h>

Collaboration diagram for mobius::poly_SVO:

Classes

struct  Summary
 Voxelization summary. More...
 

Public Member Functions

mobiusPoly_EXPORT poly_SVO ()
 Default ctor.
 
mobiusPoly_EXPORT poly_SVO (const t_xyz &cornerMin, const t_xyz &cornerMax)
 
mobiusPoly_EXPORT ~poly_SVO ()
 Dtor. It is not virtual to save 8 bytes of memory.
 
mobiusPoly_EXPORT void Release ()
 
mobiusPoly_EXPORT bool HasScalars ()
 
mobiusPoly_EXPORT void SetScalar (const size_t id, const double s)
 
mobiusPoly_EXPORT double GetScalar (const size_t id) const
 
mobiusPoly_EXPORT bool IsLeaf () const
 
mobiusPoly_EXPORT void GetLeaves (std::vector< const poly_SVO * > &leaves, const int sm=ScalarMembership_OnInOut) const
 
mobiusPoly_EXPORT bool IsNegative () const
 
mobiusPoly_EXPORT bool IsPositive () const
 
mobiusPoly_EXPORT bool IsZeroCrossing () const
 
mobiusPoly_EXPORT bool Split ()
 
mobiusPoly_EXPORT void SetChild (const size_t id, poly_SVO *pChild)
 
mobiusPoly_EXPORT poly_SVOGetChild (const size_t id) const
 
mobiusPoly_EXPORT poly_SVOFindChild (const std::vector< size_t > &path) const
 
mobiusPoly_EXPORT unsigned GetDepth0 () const
 
mobiusPoly_EXPORT double Eval (const t_xyz &P, const bool bndOnly=false) const
 
mobiusPoly_EXPORT unsigned long long GetMemoryInBytes (int &numNodes) const
 
mobiusPoly_EXPORT void CollectSummary (const int sm, Summary &summary) const
 
const t_xyzGetCornerMin () const
 
void SetCornerMin (const t_xyz &P)
 Sets new coordinates for the min corner point.
 
const t_xyzGetCornerMax () const
 
void SetCornerMax (const t_xyz &P)
 Sets new coordinates for the max corner point.
 
const t_xyzGetP0 () const
 
t_xyz GetP1 () const
 
t_xyz GetP2 () const
 
t_xyz GetP3 () const
 
t_xyz GetP4 () const
 
t_xyz GetP5 () const
 
t_xyz GetP6 () const
 
const t_xyzGetP7 () const
 
double GetCellSize () const
 

Static Public Member Functions

static mobiusPoly_EXPORT bool IsValidCornerId (const size_t id)
 
static mobiusPoly_EXPORT size_t GetCornerID (const size_t nx, const size_t ny, const size_t nz)
 
static mobiusPoly_EXPORT void GetCornerLocation (const size_t id, size_t &nx, size_t &ny, size_t &nz)
 

Protected Member Functions

mobiusPoly_EXPORT void getLeaves (const poly_SVO *pNode, const int sm, std::vector< const poly_SVO * > &leaves, std::vector< long long > &depths, const long long depth) const
 
mobiusPoly_EXPORT void getLeaves (const poly_SVO *pNode, const int sm, std::vector< const poly_SVO * > &leaves) const
 

Protected Attributes

poly_SVO ** m_pChildren
 Child octree nodes (8 bytes).
 
double m_scalars [8]
 Stored scalar values (64 bytes).
 
t_xyz m_cornerMin
 Min corner of the SVO box.
 
t_xyz m_cornerMax
 Max corner of the SVO box.
 

Detailed Description

A single node in the Sparse Voxel Octree data structure. Each corner of the SVO node is associated with a scalar value.

Constructor & Destructor Documentation

◆ poly_SVO()

mobiusPoly_EXPORT mobius::poly_SVO::poly_SVO ( const t_xyz cornerMin,
const t_xyz cornerMax 
)

Ctor accepting corners.

Parameters
[in]cornerMinmin corner point.
[in]cornerMaxmax corner point.

Member Function Documentation

◆ CollectSummary()

mobiusPoly_EXPORT void mobius::poly_SVO::CollectSummary ( const int  sm,
Summary summary 
) const

Collects the voxelization information for the octree starting from this SVO node. The outcome statistics is available in the output summary argument. The summary contains grains sizes and their quantities, where sizes are taken as fractions of the occupied space. E.g., for a domain D=10x8x6, a single split would result in eight cells of 5x4x3 giving the grain size of 1/2.

Parameters
[in]smthe membership classifier to filter SVO.
[out]summarythe outcome summary structure.

◆ Eval()

mobiusPoly_EXPORT double mobius::poly_SVO::Eval ( const t_xyz P,
const bool  bndOnly = false 
) const

For the passed xyz point, this method evaluates the scalar field which is defined in the current SVO node. For that, the method goes down by the SVO hierarchy until it reaches the leaf voxel containing the relevant field values.

Parameters
[in]Ppoint of interest.
[in]bndOnlyindicates whether the scalar field should only be evaluated for the zero-crossing nodes. If so, then for the negative nodes, the value of -1 is returned; for the positive nodes, the value of 1 is returned.
Returns
interpolated field value.

◆ FindChild()

mobiusPoly_EXPORT poly_SVO* mobius::poly_SVO::FindChild ( const std::vector< size_t > &  path) const

Attempts to find a child SVO node by the specified path. If a node corresponding to the given path is not accessible, null pointer is returned.

Parameters
[in]pathordered set of indices to access the node.
Returns
pointer to the requested node.

◆ GetCellSize()

double mobius::poly_SVO::GetCellSize ( ) const
inline
Returns
cell size as a distance between P0 and P7.

◆ GetChild()

mobiusPoly_EXPORT poly_SVO* mobius::poly_SVO::GetChild ( const size_t  id) const

Returns the child SVO node by its index in range [0,7]. If there are no children in the current node, null pointer is returned.

Parameters
[in]idID of the child.
Returns
pointer to the child node.

◆ GetCornerID()

static mobiusPoly_EXPORT size_t mobius::poly_SVO::GetCornerID ( const size_t  nx,
const size_t  ny,
const size_t  nz 
)
static

Returns the ID of one of the 8-th cell corners. This ID is determined by the passed locations of the corresponding x, y and z coordinates. The passed arguments may have values 0 and 1, hence there are 8 combinations (8 corners).

The returned ID is derived with the following rule:

//!  ID = nx | (ny << 1) | (nz << 2)
//! 
So it gives:

\verbatim

//! nx | ny | nz || id //! ====+====+====++=== //! 0 | 0 | 0 || 0 //! -—+-—+-—++— //! 1 | 0 | 0 || 1 //! -—+-—+-—++— //! 0 | 1 | 0 || 2 //! -—+-—+-—++— //! 1 | 1 | 0 || 3 //! -—+-—+-—++— //! 0 | 0 | 1 || 4 //! -—+-—+-—++— //! 1 | 0 | 1 || 5 //! -—+-—+-—++— //! 0 | 1 | 1 || 6 //! -—+-—+-—++— //! 1 | 1 | 1 || 7 //! -—+-—+-—++— //!

\param[in] nx X location (0 for min, 1 for max).
\param[in] ny Y location (0 for min, 1 for max).
\param[in] nz Z location (0 for min, 1 for max).
\return ID of the corner in range [0,7]. 

◆ GetCornerLocation()

static mobiusPoly_EXPORT void mobius::poly_SVO::GetCornerLocation ( const size_t  id,
size_t &  nx,
size_t &  ny,
size_t &  nz 
)
static

Given the corner ID in range [0,7], this static function returns the location of the corner in a cell (vertex for octant, octant for voxel).

The location is derived with the following rule (opposite to the rule which is used to derive the ID by location):

//!  nx = (id >> 0) & 1
//!  ny = (id >> 1) & 1
//!  nz = (id >> 2) & 1
//! 
\verbatim

//! id || nx | ny | nz //! ====++====+====+==== //! 0 || 0 | 0 | 0 //! -—++-—+-—+-— //! 1 || 1 | 0 | 0 //! -—++-—+-—+-— //! 2 || 0 | 1 | 0 //! -—++-—+-—+-— //! 3 || 1 | 1 | 0 //! -—++-—+-—+-— //! 4 || 0 | 0 | 1 //! -—++-—+-—+-— //! 5 || 1 | 0 | 1 //! -—++-—+-—+-— //! 6 || 0 | 1 | 1 //! -—++-—+-—+-— //! 7 || 1 | 1 | 1 //! -—++-—+-—+-— //!

\param[in]  id ID of the corner.
\param[out] nx location along OX world axis.
\param[out] ny location along OY world axis.
\param[out] nz location along OZ world axis. 

◆ GetCornerMax()

const t_xyz& mobius::poly_SVO::GetCornerMax ( ) const
inline
Returns
max corner which is equal to P7 point.

◆ GetCornerMin()

const t_xyz& mobius::poly_SVO::GetCornerMin ( ) const
inline
Returns
min corner which is equal to P0 point.

◆ GetDepth0()

mobiusPoly_EXPORT unsigned mobius::poly_SVO::GetDepth0 ( ) const

Returns the depth of the octree starting from the 0-th node. This method consults the 0-th children only, so it is only applicable when your SVO is complete (i.e., the voxelization is uniform).

Returns
depth through the 0-th nodes.

◆ getLeaves() [1/2]

mobiusPoly_EXPORT void mobius::poly_SVO::getLeaves ( const poly_SVO pNode,
const int  sm,
std::vector< const poly_SVO * > &  leaves 
) const
protected

Recursively visits SVO nodes to add leaves to the passed output collection.

Parameters
[in]pNodeSVO node to visit.
[in]smscalar membership classifier.
[out]leavescollected leaves.

◆ getLeaves() [2/2]

mobiusPoly_EXPORT void mobius::poly_SVO::getLeaves ( const poly_SVO pNode,
const int  sm,
std::vector< const poly_SVO * > &  leaves,
std::vector< long long > &  depths,
const long long  depth 
) const
protected

Recursively visits SVO nodes to add leaves to the passed output collection.

Parameters
[in]pNodeSVO node to visit.
[in]smscalar membership classifier.
[out]leavescollected leaves.
[out]depthscollected leaves' depths.
[in,out]depththe currently reached depth.

◆ GetLeaves()

mobiusPoly_EXPORT void mobius::poly_SVO::GetLeaves ( std::vector< const poly_SVO * > &  leaves,
const int  sm = ScalarMembership_OnInOut 
) const

Gathers all leaves of the octree in the passed vector.

Parameters
[out]leavesgathered collection of leaf SVO nodes.
[in]smscalar membership to filter SVO nodes by their associated scalar values.

◆ GetMemoryInBytes()

mobiusPoly_EXPORT unsigned long long mobius::poly_SVO::GetMemoryInBytes ( int &  numNodes) const

Calculates the memory occupied by the SVO hierarchy starting from this node in bytes.

Parameters
[out]numNodesnum of corner points.
Returns
memory in bytes.

◆ GetP0()

const t_xyz& mobius::poly_SVO::GetP0 ( ) const
inline
Returns
corner point P0 (the notation is the same as for VTK_VOXEL).

◆ GetP1()

t_xyz mobius::poly_SVO::GetP1 ( ) const
inline
Returns
corner point P1 (the notation is the same as for VTK_VOXEL).

◆ GetP2()

t_xyz mobius::poly_SVO::GetP2 ( ) const
inline
Returns
corner point P2 (the notation is the same as for VTK_VOXEL).

◆ GetP3()

t_xyz mobius::poly_SVO::GetP3 ( ) const
inline
Returns
corner point P3 (the notation is the same as for VTK_VOXEL).

◆ GetP4()

t_xyz mobius::poly_SVO::GetP4 ( ) const
inline
Returns
corner point P4 (the notation is the same as for VTK_VOXEL).

◆ GetP5()

t_xyz mobius::poly_SVO::GetP5 ( ) const
inline
Returns
corner point P5 (the notation is the same as for VTK_VOXEL).

◆ GetP6()

t_xyz mobius::poly_SVO::GetP6 ( ) const
inline
Returns
corner point P6 (the notation is the same as for VTK_VOXEL).

◆ GetP7()

const t_xyz& mobius::poly_SVO::GetP7 ( ) const
inline
Returns
corner point P7 (the notation is the same as for VTK_VOXEL).

◆ GetScalar()

mobiusPoly_EXPORT double mobius::poly_SVO::GetScalar ( const size_t  id) const

Returns the scalar value associated with the passed corner ID.

Parameters
[in]idID of the corner in range [0,7].
Returns
scalar value.

◆ HasScalars()

mobiusPoly_EXPORT bool mobius::poly_SVO::HasScalars ( )

Checks if the node is initialized with the scalar values. At construction time, the SVO node gets infinity values as scalars. If these values have not been changed later on, this method will return false.

Returns
true/false.

◆ IsLeaf()

mobiusPoly_EXPORT bool mobius::poly_SVO::IsLeaf ( ) const

Returns true if this SVO node has no children.

Returns
true/false.

◆ IsNegative()

mobiusPoly_EXPORT bool mobius::poly_SVO::IsNegative ( ) const

Checks if all the scalars associated with this SVO node are negative.

Returns
true/false.

◆ IsPositive()

mobiusPoly_EXPORT bool mobius::poly_SVO::IsPositive ( ) const

Checks if all the scalars associated with this SVO node are positive.

Returns
true/false.

◆ IsValidCornerId()

static mobiusPoly_EXPORT bool mobius::poly_SVO::IsValidCornerId ( const size_t  id)
static

Checks if the passed corner ID is valid.

Parameters
[in]idID to check.
Returns
true/false.

◆ IsZeroCrossing()

mobiusPoly_EXPORT bool mobius::poly_SVO::IsZeroCrossing ( ) const

Checks if the scalars associated with this SVO change sign.

Returns
true/false.

◆ Release()

mobiusPoly_EXPORT void mobius::poly_SVO::Release ( )

Releases the memory occupied by this SVO node with recursive treatment on children.

◆ SetChild()

mobiusPoly_EXPORT void mobius::poly_SVO::SetChild ( const size_t  id,
poly_SVO pChild 
)

Sets the child SVO node for the octant having the given index in range [0,7]. This method should be used after Split() invocation to initialize the allocated pointers with the SVO structures constructed separately.

Parameters
[in]idID of the child to set.
[in]pChildraw pointer to the SVO node to set as a child.

◆ SetScalar()

mobiusPoly_EXPORT void mobius::poly_SVO::SetScalar ( const size_t  id,
const double  s 
)

Sets scalar value for the corner with the passed ID.

Parameters
[in]idID of the corner in range [0,7].
[in]sscalar value to set.

◆ Split()

mobiusPoly_EXPORT bool mobius::poly_SVO::Split ( )

Splits this node down to 8 octants.

Returns
false if this nodes already has children.

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