Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Classes | Public Member Functions | Protected Attributes | List of all members
vl::Volume Class Reference

Defines the volume data to be used with a MarchingCube object. More...

#include <MarchingCubes.hpp>

+ Inheritance diagram for vl::Volume:

Public Member Functions

 Volume ()
 
void setup (float *data, bool use_directly, bool copy_data, const fvec3 &bottom_left, const fvec3 &top_right, const ivec3 &slices)
 Setup the volume data with the specified memory management. More...
 
void setup (const Volume &)
 
ref< Volumedownsample () const
 Returns a new volume which is half of the size of the original volume in each direction (thus requires up to 1/8th of the memory). More...
 
const float * values () const
 
float * values ()
 
const float & value (int i) const
 
float & value (int i)
 
const float & value (int x, int y, int z) const
 
float & value (int x, int y, int z)
 
void normalHQ (fvec3 &normal, const fvec3 &v, float dx, float dy, float dz)
 Computes a high quality normal (best rendering quality) More...
 
void normalLQ (fvec3 &normal, const fvec3 &v, float dx, float dy, float dz)
 Computes a low quality normal (best performances) More...
 
float sampleSmooth (float x, float y, float z) const
 Samples the volume using tri-linear interpolation sampling. More...
 
float sampleNearest (float x, float y, float z) const
 Samples the volume using nearest point sampling. More...
 
fvec3 coordinate (int x, int y, int z) const
 
const fvec3bottomLeft () const
 
const fvec3topRight () const
 
const ivec3slices () const
 
fvec3 size () const
 
float computeMinimum () const
 
float computeMaximum () const
 
float computeAverage () const
 
float minimum () const
 
float maximum () const
 
float average () const
 
const Volume::Cube & cube (int x, int y, int z) const
 
const fvec3cellSize () const
 Returns the x/y/z size of a cell. More...
 
bool dataIsDirty () const
 Returns true if the internal data hasn't been updated since the last call to setDataDirty() or setup() More...
 
void setDataDirty ()
 Notifies that the data of a Volume has changed and that the internal acceleration structures should be recomputed. More...
 
void setupInternalData ()
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

std::vector< float > mInternalValues
 
float * mValues
 
fvec3 mBottomLeft
 
fvec3 mTopRight
 
fvec3 mSize
 
ivec3 mSlices
 
fvec3 mCellSize
 
float mMinimum
 
float mMaximum
 
float mAverage
 
bool mDataIsDirty
 
std::vector< Cube > mCubes
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

Defines the volume data to be used with a MarchingCube object.

Definition at line 46 of file MarchingCubes.hpp.

Constructor & Destructor Documentation

◆ Volume()

Volume::Volume ( )

Definition at line 458 of file MarchingCubes.cpp.

References NULL.

Member Function Documentation

◆ average()

float vl::Volume::average ( ) const
inline

Definition at line 120 of file MarchingCubes.hpp.

◆ bottomLeft()

const fvec3& vl::Volume::bottomLeft ( ) const
inline

Definition at line 102 of file MarchingCubes.hpp.

◆ cellSize()

const fvec3& vl::Volume::cellSize ( ) const
inline

Returns the x/y/z size of a cell.

Definition at line 131 of file MarchingCubes.hpp.

Referenced by vl::MarchingCubes::computeEdges().

◆ computeAverage()

float Volume::computeAverage ( ) const

◆ computeMaximum()

float Volume::computeMaximum ( ) const

Definition at line 673 of file MarchingCubes.cpp.

◆ computeMinimum()

float Volume::computeMinimum ( ) const

Definition at line 661 of file MarchingCubes.cpp.

◆ coordinate()

fvec3 vl::Volume::coordinate ( int  x,
int  y,
int  z 
) const
inline

Definition at line 100 of file MarchingCubes.hpp.

Referenced by vl::MarchingCubes::computeEdges().

◆ cube()

const Volume::Cube& vl::Volume::cube ( int  x,
int  y,
int  z 
) const
inline

◆ dataIsDirty()

bool vl::Volume::dataIsDirty ( ) const
inline

Returns true if the internal data hasn't been updated since the last call to setDataDirty() or setup()

Definition at line 134 of file MarchingCubes.hpp.

Referenced by vl::MarchingCubes::run().

◆ downsample()

ref< Volume > Volume::downsample ( ) const

Returns a new volume which is half of the size of the original volume in each direction (thus requires up to 1/8th of the memory).

Use this function when the volume data to be processed is too big or produces too many polygons.

Definition at line 464 of file MarchingCubes.cpp.

References NULL, setup(), and value().

◆ maximum()

float vl::Volume::maximum ( ) const
inline

Definition at line 118 of file MarchingCubes.hpp.

◆ minimum()

float vl::Volume::minimum ( ) const
inline

Definition at line 116 of file MarchingCubes.hpp.

◆ normalHQ()

void Volume::normalHQ ( fvec3 normal,
const fvec3 v,
float  dx,
float  dy,
float  dz 
)

Computes a high quality normal (best rendering quality)

Definition at line 639 of file MarchingCubes.cpp.

References vl::Vector3< T_Scalar >::normalize(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by vl::MarchingCubes::computeEdges().

◆ normalLQ()

void Volume::normalLQ ( fvec3 normal,
const fvec3 v,
float  dx,
float  dy,
float  dz 
)

Computes a low quality normal (best performances)

Definition at line 650 of file MarchingCubes.cpp.

References vl::Vector3< T_Scalar >::normalize(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

◆ sampleNearest()

float Volume::sampleNearest ( float  x,
float  y,
float  z 
) const

Samples the volume using nearest point sampling.

Definition at line 584 of file MarchingCubes.cpp.

◆ sampleSmooth()

float Volume::sampleSmooth ( float  x,
float  y,
float  z 
) const

Samples the volume using tri-linear interpolation sampling.

Definition at line 603 of file MarchingCubes.cpp.

◆ setDataDirty()

void vl::Volume::setDataDirty ( )
inline

Notifies that the data of a Volume has changed and that the internal acceleration structures should be recomputed.

Definition at line 137 of file MarchingCubes.hpp.

◆ setup() [1/2]

void Volume::setup ( float *  data,
bool  use_directly,
bool  copy_data,
const fvec3 bottom_left,
const fvec3 top_right,
const ivec3 slices 
)

Setup the volume data with the specified memory management.

Parameters
dataThe buffer containing the volume data. Can be NULL only if use_directly == false and copy_data == false.
use_directlyIf true the buffer will be used directly and no internal copy will be done.
copy_dataIf true the buffer pointed by data will be copied in the internal buffer used to store the volume data. The copy_data parameter is ignored if use_directly is set to true.

Definition at line 541 of file MarchingCubes.cpp.

References VL_CHECK, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by vl::VolumePlot::compute(), and downsample().

◆ setup() [2/2]

void Volume::setup ( const Volume volume)

Definition at line 575 of file MarchingCubes.cpp.

◆ setupInternalData()

void Volume::setupInternalData ( )

Definition at line 504 of file MarchingCubes.cpp.

Referenced by vl::MarchingCubes::run().

◆ size()

fvec3 vl::Volume::size ( ) const
inline

Definition at line 108 of file MarchingCubes.hpp.

◆ slices()

const ivec3& vl::Volume::slices ( ) const
inline

◆ topRight()

const fvec3& vl::Volume::topRight ( ) const
inline

Definition at line 104 of file MarchingCubes.hpp.

◆ value() [1/4]

const float& vl::Volume::value ( int  i) const
inline

◆ value() [2/4]

float& vl::Volume::value ( int  i)
inline

Definition at line 82 of file MarchingCubes.hpp.

◆ value() [3/4]

const float& vl::Volume::value ( int  x,
int  y,
int  z 
) const
inline

Definition at line 84 of file MarchingCubes.hpp.

◆ value() [4/4]

float& vl::Volume::value ( int  x,
int  y,
int  z 
)
inline

Definition at line 86 of file MarchingCubes.hpp.

◆ values() [1/2]

const float* vl::Volume::values ( ) const
inline

Definition at line 76 of file MarchingCubes.hpp.

Referenced by vl::VolumePlot::compute().

◆ values() [2/2]

float* vl::Volume::values ( )
inline

Definition at line 78 of file MarchingCubes.hpp.

Member Data Documentation

◆ mAverage

float vl::Volume::mAverage
protected

Definition at line 151 of file MarchingCubes.hpp.

◆ mBottomLeft

fvec3 vl::Volume::mBottomLeft
protected

Definition at line 144 of file MarchingCubes.hpp.

◆ mCellSize

fvec3 vl::Volume::mCellSize
protected

Definition at line 148 of file MarchingCubes.hpp.

◆ mCubes

std::vector<Cube> vl::Volume::mCubes
protected

Definition at line 154 of file MarchingCubes.hpp.

◆ mDataIsDirty

bool vl::Volume::mDataIsDirty
protected

Definition at line 152 of file MarchingCubes.hpp.

◆ mInternalValues

std::vector<float> vl::Volume::mInternalValues
protected

Definition at line 142 of file MarchingCubes.hpp.

◆ mMaximum

float vl::Volume::mMaximum
protected

Definition at line 150 of file MarchingCubes.hpp.

◆ mMinimum

float vl::Volume::mMinimum
protected

Definition at line 149 of file MarchingCubes.hpp.

◆ mSize

fvec3 vl::Volume::mSize
protected

Definition at line 146 of file MarchingCubes.hpp.

◆ mSlices

ivec3 vl::Volume::mSlices
protected

Definition at line 147 of file MarchingCubes.hpp.

◆ mTopRight

fvec3 vl::Volume::mTopRight
protected

Definition at line 145 of file MarchingCubes.hpp.

◆ mValues

float* vl::Volume::mValues
protected

Definition at line 143 of file MarchingCubes.hpp.


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