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 Member Functions | Protected Attributes | List of all members
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:

Classes

class  Function
 A function to be used with VolumePlot. More...
 

Public Member Functions

 VolumePlot ()
 Constructor. More...
 
void compute (const Function &func, float threshold)
 Computes the function and generates the plot. This method should be called after all the other methods. More...
 
const ActorisosurfaceActor () const
 The Actor representing the isosurface. More...
 
ActorisosurfaceActor ()
 The Actor representing the isosurface. More...
 
const GeometryisosurfaceGeometry () const
 The Geometry representing the isosurface. More...
 
GeometryisosurfaceGeometry ()
 The Geometry representing the isosurface. More...
 
const EffectisosurfaceEffect () const
 Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface. More...
 
EffectisosurfaceEffect ()
 Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface. More...
 
const EffectboxEffect () const
 Used to get/set the rendering options (like color, material, transparency) etc. of the box. More...
 
EffectboxEffect ()
 Used to get/set the rendering options (like color, material, transparency) etc. of the box. More...
 
const fvec3minCorner () const
 Default value: fvec3(-1,-1,-1) More...
 
void setMinCorner (const fvec3 &min_corner)
 Default value: fvec3(-1,-1,-1) More...
 
const fvec3maxCorner () const
 Default value: fvec3(+1,+1,+1) More...
 
void setMaxCorner (const fvec3 &max_corner)
 Default value: fvec3(+1,+1,+1) More...
 
const TransformplotTransform () const
 The transform associated to the whole plot. More...
 
TransformplotTransform ()
 The transform associated to the whole plot. More...
 
void setPlotTransform (Transform *tr)
 The transform associated to the whole plot. More...
 
const ivec3samplingResolution () const
 Default value: ivec3(64,64,64) More...
 
void setSamplingResolution (const ivec3 &size)
 Default value: ivec3(64,64,64) More...
 
const StringlabelFormat () const
 Sets the format of the labels. More...
 
void setLabelFormat (const String &format)
 Sets the format of the label to be generated, es. "(%.2n %.2n %.2n)" or "<%.3n, %.3n, %.3n>". More...
 
const FontlabelFont () const
 The Font to be used for the box labels. More...
 
FontlabelFont ()
 The Font to be used for the box labels. More...
 
void setLabelFont (Font *font)
 The Font to be used for the box labels. More...
 
const TexttextTemplate () const
 A Text used to initialize the plot labels. More...
 
TexttextTemplate ()
 A Text used to initialize the plot labels. More...
 
ActorTreeactorTreeMulti ()
 
const ActorTreeactorTreeMulti () const
 
- 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 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 Member Functions inherited from vl::Object
virtual ~Object ()
 

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
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

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

Example:

float range = 5.0f;
fvec3 min_corner(-range,-range,-range);
fvec3 max_corner(+range,+range,+range);
// 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::VolumePlot ( )

Member Function Documentation

◆ actorTreeMulti() [1/2]

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

Definition at line 128 of file VolumePlot.hpp.

Referenced by compute().

◆ actorTreeMulti() [2/2]

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

Definition at line 129 of file VolumePlot.hpp.

◆ boxEffect() [1/2]

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.

◆ boxEffect() [2/2]

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.

◆ compute()

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

◆ evaluateFunction()

void VolumePlot::evaluateFunction ( float *  scalar,
const fvec3 min_corner,
const fvec3 max_corner,
const Function func 
)
protected

◆ isosurfaceActor() [1/2]

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

The Actor representing the isosurface.

Definition at line 70 of file VolumePlot.hpp.

◆ isosurfaceActor() [2/2]

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

The Actor representing the isosurface.

Definition at line 72 of file VolumePlot.hpp.

◆ isosurfaceEffect() [1/2]

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.

◆ isosurfaceEffect() [2/2]

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.

◆ isosurfaceGeometry() [1/2]

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

The Geometry representing the isosurface.

Definition at line 75 of file VolumePlot.hpp.

◆ isosurfaceGeometry() [2/2]

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

The Geometry representing the isosurface.

Definition at line 77 of file VolumePlot.hpp.

◆ labelFont() [1/2]

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

◆ labelFont() [2/2]

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

The Font to be used for the box labels.

Definition at line 119 of file VolumePlot.hpp.

◆ labelFormat()

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

Sets the format of the labels.

Definition at line 112 of file VolumePlot.hpp.

Referenced by compute().

◆ maxCorner()

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

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

Definition at line 95 of file VolumePlot.hpp.

Referenced by compute().

◆ minCorner()

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

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

Definition at line 90 of file VolumePlot.hpp.

Referenced by compute().

◆ plotTransform() [1/2]

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

The transform associated to the whole plot.

Definition at line 100 of file VolumePlot.hpp.

◆ plotTransform() [2/2]

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

The transform associated to the whole plot.

Definition at line 102 of file VolumePlot.hpp.

◆ samplingResolution()

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

Default value: ivec3(64,64,64)

Definition at line 107 of file VolumePlot.hpp.

◆ setLabelFont()

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

The Font to be used for the box labels.

Definition at line 121 of file VolumePlot.hpp.

◆ setLabelFormat()

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.

◆ setMaxCorner()

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

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

Definition at line 97 of file VolumePlot.hpp.

◆ setMinCorner()

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

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

Definition at line 92 of file VolumePlot.hpp.

◆ setPlotTransform()

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

The transform associated to the whole plot.

Definition at line 104 of file VolumePlot.hpp.

◆ setSamplingResolution()

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

Default value: ivec3(64,64,64)

Definition at line 109 of file VolumePlot.hpp.

◆ setupLabels()

void VolumePlot::setupLabels ( const String format,
const fvec3 min_corner,
const fvec3 max_corner,
Font font,
Transform root_tr 
)
protected

◆ textTemplate() [1/2]

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

◆ textTemplate() [2/2]

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

A Text used to initialize the plot labels.

Definition at line 126 of file VolumePlot.hpp.

Member Data Documentation

◆ mActors

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

Definition at line 136 of file VolumePlot.hpp.

Referenced by compute(), and setupLabels().

◆ mActorTreeMulti

ref<ActorTree> vl::VolumePlot::mActorTreeMulti
protected

Definition at line 148 of file VolumePlot.hpp.

Referenced by VolumePlot().

◆ mBoxEffect

ref<Effect> vl::VolumePlot::mBoxEffect
protected

Definition at line 146 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

◆ mIsosurfaceActor

ref<Actor> vl::VolumePlot::mIsosurfaceActor
protected

Definition at line 144 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

◆ mIsosurfaceEffect

ref<Effect> vl::VolumePlot::mIsosurfaceEffect
protected

Definition at line 145 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

◆ mIsosurfaceGeometry

ref<Geometry> vl::VolumePlot::mIsosurfaceGeometry
protected

Definition at line 143 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

◆ mLabelFont

ref< Font > vl::VolumePlot::mLabelFont
protected

Definition at line 140 of file VolumePlot.hpp.

Referenced by VolumePlot().

◆ mLabelFormat

String vl::VolumePlot::mLabelFormat
protected

Definition at line 139 of file VolumePlot.hpp.

Referenced by VolumePlot().

◆ mMaxCorner

fvec3 vl::VolumePlot::mMaxCorner
protected

Definition at line 142 of file VolumePlot.hpp.

Referenced by VolumePlot().

◆ mMinCorner

fvec3 vl::VolumePlot::mMinCorner
protected

Definition at line 141 of file VolumePlot.hpp.

Referenced by VolumePlot().

◆ mPlotTransform

ref<Transform> vl::VolumePlot::mPlotTransform
protected

Definition at line 137 of file VolumePlot.hpp.

Referenced by compute(), and VolumePlot().

◆ mSamplingResolution

ivec3 vl::VolumePlot::mSamplingResolution
protected

Definition at line 138 of file VolumePlot.hpp.

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

◆ mTextTemplate

ref<Text> vl::VolumePlot::mTextTemplate
protected

Definition at line 147 of file VolumePlot.hpp.

Referenced by VolumePlot().


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