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 Member Functions | Protected Attributes

vl::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 vl::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 ActorisosurfaceActor () const
 The Actor representing the isosurface.
ActorisosurfaceActor ()
 The Actor representing the isosurface.
const GeometryisosurfaceGeometry () const
 The Geometry representing the isosurface.
GeometryisosurfaceGeometry ()
 The Geometry representing the isosurface.
const EffectisosurfaceEffect () const
 Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.
EffectisosurfaceEffect ()
 Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface.
const EffectboxEffect () const
 Used to get/set the rendering options (like color, material, transparency) etc. of the box.
EffectboxEffect ()
 Used to get/set the rendering options (like color, material, transparency) etc. of the box.
const fvec3minCorner () const
 Default value: fvec3(-1,-1,-1)
void setMinCorner (const fvec3 &min_corner)
 Default value: fvec3(-1,-1,-1)
const fvec3maxCorner () const
 Default value: fvec3(+1,+1,+1)
void setMaxCorner (const fvec3 &max_corner)
 Default value: fvec3(+1,+1,+1)
const TransformplotTransform () const
 The transform associated to the whole plot.
TransformplotTransform ()
 The transform associated to the whole plot.
void setPlotTransform (Transform *tr)
 The transform associated to the whole plot.
const ivec3samplingResolution () const
 Default value: ivec3(64,64,64)
void setSamplingResolution (const ivec3 &size)
 Default value: ivec3(64,64,64)
const StringlabelFormat () const
 Sets the format of the labels.
void setLabelFormat (const String &format)
 Sets the format of the label to be generated, es. "(%.2n %.2n %.2n)" or "<%.3n, %.3n, %.3n>".
const FontlabelFont () const
 The Font to be used for the box labels.
FontlabelFont ()
 The Font to be used for the box labels.
void setLabelFont (Font *font)
 The Font to be used for the box labels.
const TexttextTemplate () const
 A Text used to initialize the plot labels.
TexttextTemplate ()
 A Text used to initialize the plot labels.
ActorTreeactorTreeMulti ()
const ActorTreeactorTreeMulti () const

Protected Member Functions

void setupLabels (const String &format, const fvec3 &min_corner, const fvec3 &max_corner, Font *font, Transform *root_tr)
void evaluateFunction (float *scalar, const fvec3 &min_corner, const fvec3 &max_corner, const Function &func)

Protected Attributes

std::vector< ref< Actor > > mActors
ref< TransformmPlotTransform
ivec3 mSamplingResolution
String mLabelFormat
ref< FontmLabelFont
fvec3 mMinCorner
fvec3 mMaxCorner
ref< GeometrymIsosurfaceGeometry
ref< ActormIsosurfaceActor
ref< EffectmIsosurfaceEffect
ref< EffectmBoxEffect
ref< TextmTextTemplate
ref< 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;
  fvec3 min_corner(-range,-range,-range);
  fvec3 max_corner(+range,+range,+range);

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

Definition at line 50 of file VolumePlot.hpp.


Constructor & Destructor Documentation

VolumePlot::VolumePlot (  )

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:
funcThe function to be evaluated at each grid point.
thresholdThe isovalue of the isosurface passed to the MarcingCubes algorithm.

Definition at line 107 of file VolumePlot.cpp.

References vl::ActorTreeAbstract::actors(), actorTreeMulti(), vl::Collection< T >::clear(), evaluateFunction(), vl::ref< T >::get(), labelFont(), labelFormat(), mActors, vl::makeBox(), maxCorner(), mBoxEffect, vl::MarchingCubes::mDrawElements, minCorner(), mIsosurfaceActor, mIsosurfaceEffect, mIsosurfaceGeometry, vl::MarchingCubes::mNormsArray, mPlotTransform, mSamplingResolution, vl::MarchingCubes::mVertsArray, NULL, vl::Collection< T >::push_back(), vl::MarchingCubes::run(), setupLabels(), and vl::MarchingCubes::volumeInfo().

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

The Actor representing the isosurface.

Definition at line 70 of file VolumePlot.hpp.

Actor* vl::VolumePlot::isosurfaceActor (  ) [inline]

The Actor representing the isosurface.

Definition at line 72 of file VolumePlot.hpp.

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

The Geometry representing the isosurface.

Definition at line 75 of file VolumePlot.hpp.

Geometry* vl::VolumePlot::isosurfaceGeometry (  ) [inline]

The Geometry representing the isosurface.

Definition at line 77 of file VolumePlot.hpp.

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

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

Definition at line 80 of file VolumePlot.hpp.

Effect* vl::VolumePlot::isosurfaceEffect (  ) [inline]

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

Definition at line 82 of file VolumePlot.hpp.

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

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

Definition at line 85 of file VolumePlot.hpp.

Effect* vl::VolumePlot::boxEffect (  ) [inline]

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

Definition at line 87 of file VolumePlot.hpp.

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

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

Definition at line 90 of file VolumePlot.hpp.

Referenced by compute().

void vl::VolumePlot::setMinCorner ( const fvec3 min_corner ) [inline]

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

Definition at line 92 of file VolumePlot.hpp.

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

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

Definition at line 95 of file VolumePlot.hpp.

Referenced by compute().

void vl::VolumePlot::setMaxCorner ( const fvec3 max_corner ) [inline]

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

Definition at line 97 of file VolumePlot.hpp.

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

The transform associated to the whole plot.

Definition at line 100 of file VolumePlot.hpp.

Transform* vl::VolumePlot::plotTransform (  ) [inline]

The transform associated to the whole plot.

Definition at line 102 of file VolumePlot.hpp.

void vl::VolumePlot::setPlotTransform ( Transform tr ) [inline]

The transform associated to the whole plot.

Definition at line 104 of file VolumePlot.hpp.

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

Default value: ivec3(64,64,64)

Definition at line 107 of file VolumePlot.hpp.

void vl::VolumePlot::setSamplingResolution ( const ivec3 size ) [inline]

Default value: ivec3(64,64,64)

Definition at line 109 of file VolumePlot.hpp.

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

Sets the format of the labels.

Definition at line 112 of file VolumePlot.hpp.

Referenced by compute().

void vl::VolumePlot::setLabelFormat ( const String format ) [inline]

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

Definition at line 114 of file VolumePlot.hpp.

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

The Font to be used for the box labels.

Definition at line 117 of file VolumePlot.hpp.

Referenced by compute().

Font* vl::VolumePlot::labelFont (  ) [inline]

The Font to be used for the box labels.

Definition at line 119 of file VolumePlot.hpp.

void vl::VolumePlot::setLabelFont ( Font font ) [inline]

The Font to be used for the box labels.

Definition at line 121 of file VolumePlot.hpp.

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

A Text used to initialize the plot labels.

Definition at line 124 of file VolumePlot.hpp.

Referenced by setupLabels(), and VolumePlot().

Text* vl::VolumePlot::textTemplate (  ) [inline]

A Text used to initialize the plot labels.

Definition at line 126 of file VolumePlot.hpp.

ActorTree* vl::VolumePlot::actorTreeMulti (  ) [inline]

Definition at line 128 of file VolumePlot.hpp.

Referenced by compute().

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

Definition at line 129 of file VolumePlot.hpp.

void VolumePlot::setupLabels ( const String format,
const fvec3 min_corner,
const fvec3 max_corner,
Font font,
Transform root_tr 
) [protected]
void VolumePlot::evaluateFunction ( float *  scalar,
const fvec3 min_corner,
const fvec3 max_corner,
const Function func 
) [protected]

Member Data Documentation

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

Definition at line 136 of file VolumePlot.hpp.

Referenced by compute(), and setupLabels().

Definition at line 137 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

Definition at line 138 of file VolumePlot.hpp.

Referenced by compute(), evaluateFunction(), and VolumePlot().

Definition at line 139 of file VolumePlot.hpp.

Referenced by VolumePlot().

Definition at line 140 of file VolumePlot.hpp.

Referenced by VolumePlot().

Definition at line 141 of file VolumePlot.hpp.

Referenced by VolumePlot().

Definition at line 142 of file VolumePlot.hpp.

Referenced by VolumePlot().

Definition at line 143 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

Definition at line 144 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

Definition at line 145 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

Definition at line 146 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

Definition at line 147 of file VolumePlot.hpp.

Referenced by VolumePlot().

Definition at line 148 of file VolumePlot.hpp.

Referenced by VolumePlot().


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.