Visualization Library v1.0.3

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

vl::Volume Class Reference

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

#include <MarchingCubes.hpp>

Inheritance diagram for vl::Volume:
vl::Object

List of all members.

Classes

struct  Cube
 A Volume cell.

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.
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).
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)
void normalLQ (fvec3 &normal, const fvec3 &v, float dx, float dy, float dz)
 Computes a low quality normal (best performances)
float sampleSmooth (float x, float y, float z) const
 Samples the volume using tri-linear interpolation sampling.
float sampleNearest (float x, float y, float z) const
 Samples the volume using nearest point sampling.
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.
bool dataIsDirty () const
 Returns true if the internal data hasn't been updated since the last call to setDataDirty() or setup()
void setDataDirty ()
 Notifies that the data of a Volume has changed and that the internal acceleration structures should be recomputed.
void setupInternalData ()

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

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 (  )

Definition at line 458 of file MarchingCubes.cpp.

References NULL, setup(), and VL_DEBUG_SET_OBJECT_NAME.

Referenced by downsample().


Member Function Documentation

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 bottomLeft(), mAverage, mBottomLeft, mCellSize, mDataIsDirty, mInternalValues, mMaximum, mMinimum, mSize, mSlices, mTopRight, mValues, size(), slices(), topRight(), VL_CHECK, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by Volume().

void Volume::setup ( const Volume volume )

Definition at line 575 of file MarchingCubes.cpp.

References mAverage, mDataIsDirty, mMaximum, and mMinimum.

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 bottomLeft(), mSlices, NULL, topRight(), value(), Volume(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

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

Definition at line 76 of file MarchingCubes.hpp.

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

Definition at line 78 of file MarchingCubes.hpp.

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

Definition at line 82 of file MarchingCubes.hpp.

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

Definition at line 84 of file MarchingCubes.hpp.

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

Definition at line 86 of file MarchingCubes.hpp.

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(), sampleSmooth(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

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

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(), sampleSmooth(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

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.

References mBottomLeft, mSize, mSlices, value(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

Referenced by normalHQ(), and normalLQ().

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.

References mBottomLeft, mSize, mSlices, value(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().

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().

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

Definition at line 102 of file MarchingCubes.hpp.

Referenced by downsample(), and setup().

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

Definition at line 104 of file MarchingCubes.hpp.

Referenced by downsample(), and setup().

const ivec3& vl::Volume::slices (  ) const [inline]
fvec3 vl::Volume::size (  ) const [inline]

Definition at line 108 of file MarchingCubes.hpp.

Referenced by setup().

float Volume::computeMinimum (  ) const
float Volume::computeMaximum (  ) const
float Volume::computeAverage (  ) const
float vl::Volume::minimum (  ) const [inline]

Definition at line 116 of file MarchingCubes.hpp.

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

Definition at line 118 of file MarchingCubes.hpp.

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

Definition at line 120 of file MarchingCubes.hpp.

Referenced by computeAverage().

const Volume::Cube& vl::Volume::cube ( int  x,
int  y,
int  z 
) const [inline]
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().

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().

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.

void Volume::setupInternalData (  )

Member Data Documentation

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

Definition at line 142 of file MarchingCubes.hpp.

Referenced by setup().

float* vl::Volume::mValues [protected]

Definition at line 143 of file MarchingCubes.hpp.

Referenced by computeAverage(), computeMaximum(), computeMinimum(), and setup().

Definition at line 144 of file MarchingCubes.hpp.

Referenced by sampleNearest(), sampleSmooth(), and setup().

Definition at line 145 of file MarchingCubes.hpp.

Referenced by setup().

fvec3 vl::Volume::mSize [protected]

Definition at line 146 of file MarchingCubes.hpp.

Referenced by sampleNearest(), sampleSmooth(), and setup().

Definition at line 148 of file MarchingCubes.hpp.

Referenced by setup().

float vl::Volume::mMinimum [protected]

Definition at line 149 of file MarchingCubes.hpp.

Referenced by setup().

float vl::Volume::mMaximum [protected]

Definition at line 150 of file MarchingCubes.hpp.

Referenced by setup().

float vl::Volume::mAverage [protected]

Definition at line 151 of file MarchingCubes.hpp.

Referenced by setup().

bool vl::Volume::mDataIsDirty [protected]

Definition at line 152 of file MarchingCubes.hpp.

Referenced by setup(), and setupInternalData().

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

Definition at line 154 of file MarchingCubes.hpp.

Referenced by setupInternalData().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:12.
Permission is granted to use this page to write and publish articles regarding Visualization Library.