# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vlVolume::VolumePlot Class Reference

Generates a 3D plot with labels and isosurface. The isosurface is generated using the MarchingCubes algorithm. More...

`#include <VolumePlot.hpp>`

Inheritance diagram for vlVolume::VolumePlot:

List of all members.

## Classes
class | Function
| A function to be used with VolumePlot. More...
## Public Member Functions
| VolumePlot ()
| Constructor.
void | compute (const Function &func, float threshold)
| Computes the function and generates the plot. This method should be called after all the other methods.
const vl::Actor * | isosurfaceActor () const
| The Actor representing the isosurface.
vl::Actor * | isosurfaceActor ()
| The Actor representing the isosurface.
const vl::Geometry * | isosurfaceGeometry () const
| The Geometry representing the isosurface.
vl::Geometry * | isosurfaceGeometry ()
| The Geometry representing the isosurface.
const vl::Effect * | isosurfaceEffect () const
| Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.
vl::Effect * | isosurfaceEffect ()
| Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.
const vl::Effect * | boxEffect () const
| Used to get/set the rendering options (like color, material, transparency) etc. of the box.
vl::Effect * | boxEffect ()
| Used to get/set the rendering options (like color, material, transparency) etc. of the box.
const vl::fvec3 & | minCorner () const
| Default value: vl::fvec3(-1,-1,-1).
void | setMinCorner (const vl::fvec3 &min_corner)
| Default value: vl::fvec3(-1,-1,-1).
const vl::fvec3 & | maxCorner () const
| Default value: vl::fvec3(+1,+1,+1).
void | setMaxCorner (const vl::fvec3 &max_corner)
| Default value: vl::fvec3(+1,+1,+1).
vl::Transform * | plotTransform () const
| The transform associated to the whole plot.
void | setPlotTransform (vl::Transform *tr)
| The transform associated to the whole plot.
const vl::ivec3 & | samplingResolution () const
| Default value: vl::ivec3(64,64,64).
void | setSamplingResolution (const vl::ivec3 &size)
| Default value: vl::ivec3(64,64,64).
const vl::String & | labelFormat () const
| Sets the format of the labels.
void | setLabelFormat (const vl::String &format)
| Sets the format of the label to be generated, es. "(%.2n %.2n %.2n)" or "<%.3n, %.3n, %.3n>".
vl::Font * | labelFont () const
| The Font to be used for the box labels.
void | setLabelFont (vl::Font *font)
| The Font to be used for the box labels.
const vl::Text * | textTemplate () const
| A Text used to initialize the plot labels.
vl::Text * | textTemplate ()
| A Text used to initialize the plot labels.
vl::ActorTree * | actorTreeMulti ()
const vl::ActorTree * | actorTreeMulti () const
## Protected Member Functions
void | setupLabels (const vl::String &format, const vl::fvec3 &min_corner, const vl::fvec3 &max_corner, vl::Font *font, vl::Transform *root_tr)
void | evaluateFunction (float *scalar, const vl::fvec3 &min_corner, const vl::fvec3 &max_corner, const Function &func)
## Protected Attributes
std::vector< vl::ref< vl::Actor > > | mActors
vl::ref< vl::Transform > | mPlotTransform
vl::ivec3 | mSamplingResolution
vl::String | mLabelFormat
vl::ref< vl::Font > | mLabelFont
vl::fvec3 | mMinCorner
vl::fvec3 | mMaxCorner
vl::ref< vl::Geometry > | mIsosurfaceGeometry
vl::ref< vl::Actor > | mIsosurfaceActor
vl::ref< vl::Effect > | mIsosurfaceEffect
vl::ref< vl::Effect > | mBoxEffect
vl::ref< vl::Text > | mTextTemplate
vl::ref< vl::ActorTree > | mActorTreeMulti

## Detailed Description

Generates a 3D plot with labels and isosurface. The isosurface is generated using the MarchingCubes algorithm.

Example:

      float range = 5.0f;
      vl::fvec3 min_corner(-range,-range,-range);
      vl::fvec3 max_corner(+range,+range,+range);

      vlVolume::VolumePlot plot;
      // set the function sampling space
      plot.setMinCorner(min_corner);
      plot.setMaxCorner(max_corner);
      // set various rendering options
      plot.isosurfaceEffect()->shader()->gocMaterial()->setSpecular(vlut::white);
      plot.isosurfaceEffect()->shader()->gocMaterial()->setShininess(50.0f);
      plot.isosurfaceEffect()->shader()->gocMaterial()->setDiffuse(vl::fvec4(1.0f,0,0,0.5f));
      plot.isosurfaceEffect()->shader()->enable(vl::EN_BLEND);
      plot.isosurfaceActor()->renderingCallbacks()->push_back( new vl::DepthSortCallback );
      plot.textTemplate()->setColor(vlut::yellow);
      // set the sampling resolution along the x, y and z directions
      plot.setSamplingResolution(vl::ivec3(100,100,100));
      // function computation and plot generation
      plot.compute( my_func(), 0.900f );
      sceneManager()->tree()->addChild(plot.actorTreeMulti());

## Constructor & Destructor Documentation

VolumePlot::VolumePlot | ( |  | ) |

Constructor.

## Member Function Documentation

void VolumePlot::compute | ( | const Function & | func,
|  | float | threshold |
| ) |  |  |

Computes the function and generates the plot. This method should be called after all the other methods.

Parameters:

  | func | The function to be evaluated at each grid point.
  | threshold | The isovalue of the isosurface passed to the vlVolume::MarcingCubes algorithm.
  | sm | The vl::SceneManager that will hold the plot.

const vl::Actor* vlVolume::VolumePlot::isosurfaceActor | ( |  | ) | const`[inline]`

The Actor representing the isosurface.

vl::Actor* vlVolume::VolumePlot::isosurfaceActor | ( |  | ) | `[inline]`

The Actor representing the isosurface.

const vl::Geometry* vlVolume::VolumePlot::isosurfaceGeometry | ( |  | ) | const`[inline]`

The Geometry representing the isosurface.

vl::Geometry* vlVolume::VolumePlot::isosurfaceGeometry | ( |  | ) | `[inline]`

The Geometry representing the isosurface.

const vl::Effect* vlVolume::VolumePlot::isosurfaceEffect | ( |  | ) | const`[inline]`

Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.

vl::Effect* vlVolume::VolumePlot::isosurfaceEffect | ( |  | ) | `[inline]`

Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.

const vl::Effect* vlVolume::VolumePlot::boxEffect | ( |  | ) | const`[inline]`

Used to get/set the rendering options (like color, material, transparency) etc. of the box.

vl::Effect* vlVolume::VolumePlot::boxEffect | ( |  | ) | `[inline]`

Used to get/set the rendering options (like color, material, transparency) etc. of the box.

const vl::fvec3& vlVolume::VolumePlot::minCorner | ( |  | ) | const`[inline]`

Default value: vl::fvec3(-1,-1,-1).

void vlVolume::VolumePlot::setMinCorner | ( | const vl::fvec3 & | min_corner | ) | `[inline]`

Default value: vl::fvec3(-1,-1,-1).

const vl::fvec3& vlVolume::VolumePlot::maxCorner | ( |  | ) | const`[inline]`

Default value: vl::fvec3(+1,+1,+1).

void vlVolume::VolumePlot::setMaxCorner | ( | const vl::fvec3 & | max_corner | ) | `[inline]`

Default value: vl::fvec3(+1,+1,+1).

vl::Transform* vlVolume::VolumePlot::plotTransform | ( |  | ) | const`[inline]`

The transform associated to the whole plot.

void vlVolume::VolumePlot::setPlotTransform | ( | vl::Transform * | tr | ) | `[inline]`

The transform associated to the whole plot.

const vl::ivec3& vlVolume::VolumePlot::samplingResolution | ( |  | ) | const`[inline]`

Default value: vl::ivec3(64,64,64).

void vlVolume::VolumePlot::setSamplingResolution | ( | const vl::ivec3 & | size | ) | `[inline]`

Default value: vl::ivec3(64,64,64).

const vl::String& vlVolume::VolumePlot::labelFormat | ( |  | ) | const`[inline]`

Sets the format of the labels.

void vlVolume::VolumePlot::setLabelFormat | ( | const vl::String & | format | ) | `[inline]`

Sets the format of the label to be generated, es. "(%.2n %.2n %.2n)" or "<%.3n, %.3n, %.3n>".

vl::Font* vlVolume::VolumePlot::labelFont | ( |  | ) | const`[inline]`

The Font to be used for the box labels.

void vlVolume::VolumePlot::setLabelFont | ( | vl::Font * | font | ) | `[inline]`

The Font to be used for the box labels.

const vl::Text* vlVolume::VolumePlot::textTemplate | ( |  | ) | const`[inline]`

A Text used to initialize the plot labels.

vl::Text* vlVolume::VolumePlot::textTemplate | ( |  | ) | `[inline]`

A Text used to initialize the plot labels.

vl::ActorTree* vlVolume::VolumePlot::actorTreeMulti | ( |  | ) | `[inline]`

const vl::ActorTree* vlVolume::VolumePlot::actorTreeMulti | ( |  | ) | const`[inline]`

void VolumePlot::setupLabels | ( | const vl::String & | format,
|  | const vl::fvec3 & | min_corner,
|  | const vl::fvec3 & | max_corner,
|  | vl::Font * | font,
|  | vl::Transform * | root_tr |
| ) |  |  | `[protected]`

void VolumePlot::evaluateFunction | ( | float * | scalar,
|  | const vl::fvec3 & | min_corner,
|  | const vl::fvec3 & | max_corner,
|  | const Function & | func |
| ) |  |  | `[protected]`

## Member Data Documentation

std::vector< vl::ref<vl::Actor> > vlVolume::VolumePlot::mActors`[protected]`

vl::ref<vl::Transform> vlVolume::VolumePlot::mPlotTransform`[protected]`

vl::ivec3 vlVolume::VolumePlot::mSamplingResolution`[protected]`

vl::String vlVolume::VolumePlot::mLabelFormat`[protected]`

vl::ref< vl::Font > vlVolume::VolumePlot::mLabelFont`[protected]`

vl::fvec3 vlVolume::VolumePlot::mMinCorner`[protected]`

vl::fvec3 vlVolume::VolumePlot::mMaxCorner`[protected]`

vl::ref<vl::Geometry> vlVolume::VolumePlot::mIsosurfaceGeometry`[protected]`

vl::ref<vl::Actor> vlVolume::VolumePlot::mIsosurfaceActor`[protected]`

vl::ref<vl::Effect> vlVolume::VolumePlot::mIsosurfaceEffect`[protected]`

vl::ref<vl::Effect> vlVolume::VolumePlot::mBoxEffect`[protected]`

vl::ref<vl::Text> vlVolume::VolumePlot::mTextTemplate`[protected]`

vl::ref<vl::ActorTree> vlVolume::VolumePlot::mActorTreeMulti`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlVolume/VolumePlot.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlVolume/VolumePlot.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 8 14:29:21 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.