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:

vl::Object

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::ActorisosurfaceActor () const
 The Actor representing the isosurface.
vl::ActorisosurfaceActor ()
 The Actor representing the isosurface.
const vl::GeometryisosurfaceGeometry () const
 The Geometry representing the isosurface.
vl::GeometryisosurfaceGeometry ()
 The Geometry representing the isosurface.
const vl::EffectisosurfaceEffect () const
 Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.
vl::EffectisosurfaceEffect ()
 Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.
const vl::EffectboxEffect () const
 Used to get/set the rendering options (like color, material, transparency) etc. of the box.
vl::EffectboxEffect ()
 Used to get/set the rendering options (like color, material, transparency) etc. of the box.
const vl::fvec3minCorner () const
 Default value: vl::fvec3(-1,-1,-1).
void setMinCorner (const vl::fvec3 &min_corner)
 Default value: vl::fvec3(-1,-1,-1).
const vl::fvec3maxCorner () const
 Default value: vl::fvec3(+1,+1,+1).
void setMaxCorner (const vl::fvec3 &max_corner)
 Default value: vl::fvec3(+1,+1,+1).
vl::TransformplotTransform () const
 The transform associated to the whole plot.
void setPlotTransform (vl::Transform *tr)
 The transform associated to the whole plot.
const vl::ivec3samplingResolution () const
 Default value: vl::ivec3(64,64,64).
void setSamplingResolution (const vl::ivec3 &size)
 Default value: vl::ivec3(64,64,64).
const vl::StringlabelFormat () 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::FontlabelFont () 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::TexttextTemplate () const
 A Text used to initialize the plot labels.
vl::TexttextTemplate ()
 A Text used to initialize the plot labels.
vl::ActorTreeactorTreeMulti ()
const vl::ActorTreeactorTreeMulti () 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::TransformmPlotTransform
vl::ivec3 mSamplingResolution
vl::String mLabelFormat
vl::ref< vl::FontmLabelFont
vl::fvec3 mMinCorner
vl::fvec3 mMaxCorner
vl::ref< vl::GeometrymIsosurfaceGeometry
vl::ref< vl::ActormIsosurfaceActor
vl::ref< vl::EffectmIsosurfaceEffect
vl::ref< vl::EffectmBoxEffect
vl::ref< vl::TextmTextTemplate
vl::ref< vl::ActorTreemActorTreeMulti


Detailed Description

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

pagGuideMarchingCubes_1.jpg

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]


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

Visualization Library v2010.06 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Jun 1 00:57:40 2010.
Permission is granted to use this page to write and publish articles regarding Visualization Library.