Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
Generates a 3D plot with labels and isosurface. The isosurface is generated using the MarchingCubes algorithm. More...
#include <VolumePlot.hpp>
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 Actor * | isosurfaceActor () const |
| The Actor representing the isosurface. | |
| Actor * | isosurfaceActor () |
| The Actor representing the isosurface. | |
| const Geometry * | isosurfaceGeometry () const |
| The Geometry representing the isosurface. | |
| Geometry * | isosurfaceGeometry () |
| The Geometry representing the isosurface. | |
| const Effect * | isosurfaceEffect () const |
| Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface. | |
| Effect * | isosurfaceEffect () |
| Used to get/set the rendering options (like color, material, transparency) etc. of the isosurface. | |
| const Effect * | boxEffect () const |
| Used to get/set the rendering options (like color, material, transparency) etc. of the box. | |
| Effect * | boxEffect () |
| Used to get/set the rendering options (like color, material, transparency) etc. of the box. | |
| const fvec3 & | minCorner () const |
| Default value: fvec3(-1,-1,-1) | |
| void | setMinCorner (const fvec3 &min_corner) |
| Default value: fvec3(-1,-1,-1) | |
| const fvec3 & | maxCorner () const |
| Default value: fvec3(+1,+1,+1) | |
| void | setMaxCorner (const fvec3 &max_corner) |
| Default value: fvec3(+1,+1,+1) | |
| const Transform * | plotTransform () const |
| The transform associated to the whole plot. | |
| Transform * | plotTransform () |
| The transform associated to the whole plot. | |
| void | setPlotTransform (Transform *tr) |
| The transform associated to the whole plot. | |
| const ivec3 & | samplingResolution () const |
| Default value: ivec3(64,64,64) | |
| void | setSamplingResolution (const ivec3 &size) |
| Default value: ivec3(64,64,64) | |
| const String & | labelFormat () 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 Font * | labelFont () const |
| The Font to be used for the box labels. | |
| Font * | labelFont () |
| The Font to be used for the box labels. | |
| void | setLabelFont (Font *font) |
| The Font to be used for the box labels. | |
| const Text * | textTemplate () const |
| A Text used to initialize the plot labels. | |
| Text * | textTemplate () |
| A Text used to initialize the plot labels. | |
| ActorTree * | actorTreeMulti () |
| const ActorTree * | actorTreeMulti () 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< Transform > | mPlotTransform |
| ivec3 | mSamplingResolution |
| String | mLabelFormat |
| ref< Font > | mLabelFont |
| fvec3 | mMinCorner |
| fvec3 | mMaxCorner |
| ref< Geometry > | mIsosurfaceGeometry |
| ref< Actor > | mIsosurfaceActor |
| ref< Effect > | mIsosurfaceEffect |
| ref< Effect > | mBoxEffect |
| ref< Text > | mTextTemplate |
| ref< ActorTree > | mActorTreeMulti |
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); 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.
| VolumePlot::VolumePlot | ( | ) |
Constructor.
Definition at line 72 of file VolumePlot.cpp.
References vl::FontManager::acquireFont(), vl::defFontManager(), vl::EN_DEPTH_TEST, vl::EN_LIGHTING, mActorTreeMulti, mBoxEffect, mIsosurfaceActor, mIsosurfaceEffect, mIsosurfaceGeometry, mLabelFont, mLabelFormat, mMaxCorner, mMinCorner, mPlotTransform, mSamplingResolution, mTextTemplate, vl::PM_LINE, vl::Text::setColor(), textTemplate(), and VL_DEBUG_SET_OBJECT_NAME.
| 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.
| func | The function to be evaluated at each grid point. |
| threshold | The 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] |
Definition at line 147 of file VolumePlot.cpp.
References vl::Transform::addChild(), vl::AlignHCenter, vl::AlignVCenter, vl::EN_BLEND, vl::EN_DEPTH_TEST, vl::ref< T >::get(), vl::Matrix4< float >::getTranslation(), mActors, textTemplate(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by compute().
| void VolumePlot::evaluateFunction | ( | float * | scalar, |
| const fvec3 & | min_corner, | ||
| const fvec3 & | max_corner, | ||
| const Function & | func | ||
| ) | [protected] |
Definition at line 209 of file VolumePlot.cpp.
References mSamplingResolution, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by compute().
std::vector< ref<Actor> > vl::VolumePlot::mActors [protected] |
Definition at line 136 of file VolumePlot.hpp.
Referenced by compute(), and setupLabels().
ref<Transform> vl::VolumePlot::mPlotTransform [protected] |
Definition at line 137 of file VolumePlot.hpp.
Referenced by compute(), and VolumePlot().
ivec3 vl::VolumePlot::mSamplingResolution [protected] |
Definition at line 138 of file VolumePlot.hpp.
Referenced by compute(), evaluateFunction(), and VolumePlot().
String vl::VolumePlot::mLabelFormat [protected] |
Definition at line 139 of file VolumePlot.hpp.
Referenced by VolumePlot().
ref< Font > vl::VolumePlot::mLabelFont [protected] |
Definition at line 140 of file VolumePlot.hpp.
Referenced by VolumePlot().
fvec3 vl::VolumePlot::mMinCorner [protected] |
Definition at line 141 of file VolumePlot.hpp.
Referenced by VolumePlot().
fvec3 vl::VolumePlot::mMaxCorner [protected] |
Definition at line 142 of file VolumePlot.hpp.
Referenced by VolumePlot().
ref<Geometry> vl::VolumePlot::mIsosurfaceGeometry [protected] |
Definition at line 143 of file VolumePlot.hpp.
Referenced by compute(), and VolumePlot().
ref<Actor> vl::VolumePlot::mIsosurfaceActor [protected] |
Definition at line 144 of file VolumePlot.hpp.
Referenced by compute(), and VolumePlot().
ref<Effect> vl::VolumePlot::mIsosurfaceEffect [protected] |
Definition at line 145 of file VolumePlot.hpp.
Referenced by compute(), and VolumePlot().
ref<Effect> vl::VolumePlot::mBoxEffect [protected] |
Definition at line 146 of file VolumePlot.hpp.
Referenced by compute(), and VolumePlot().
ref<Text> vl::VolumePlot::mTextTemplate [protected] |
Definition at line 147 of file VolumePlot.hpp.
Referenced by VolumePlot().
ref<ActorTree> vl::VolumePlot::mActorTreeMulti [protected] |
Definition at line 148 of file VolumePlot.hpp.
Referenced by VolumePlot().