# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlVolume/VolumePlot.hpp

Go to the documentation of this file.

    00001 /**************************************************************************************/
    00002 /*                                                                                    */
    00003 /*  Visualization Library                                                             */
    00004 /*  http://www.visualizationlibrary.com                                               */
    00005 /*                                                                                    */
    00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
    00007 /*  All rights reserved.                                                              */
    00008 /*                                                                                    */
    00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
    00010 /*  are permitted provided that the following conditions are met:                     */
    00011 /*                                                                                    */
    00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
    00013 /*  list of conditions and the following disclaimer.                                  */
    00014 /*                                                                                    */
    00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
    00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
    00017 /*  other materials provided with the distribution.                                   */
    00018 /*                                                                                    */
    00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
    00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
    00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
    00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
    00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
    00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
    00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
    00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
    00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
    00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
    00029 /*                                                                                    */
    00030 /**************************************************************************************/
    00031
    00032 #ifndef VolumePlot_INCLUDE_ONCE
    00033 #define VolumePlot_INCLUDE_ONCE
    00034
    00035 #include <vlVolume/link_config.hpp>
    00036 #include <vlGraphics/Actor.hpp>
    00037 #include <vlGraphics/Geometry.hpp>
    00038 #include <vlGraphics/Text.hpp>
    00039 #include <vlGraphics/Effect.hpp>
    00040 #include <vlCore/Transform.hpp>
    00041 #include <vlGraphics/ActorTreeAbstract.hpp>
    00042 #include <vlGraphics/SceneManagerActorTree.hpp>
    00043 #include <vlVolume/MarchingCubes.hpp>
    00044
    00045 namespace vl
    00046 {
    00047   class SceneManager;
    00048
    00050   class VLVOLUME_EXPORT VolumePlot: public Object
    00051   {
    00052   public:
    00054     class Function
    00055     {
    00056     public:
    00057       virtual float operator()(float x, float y, float z) const = 0;
    00058     };
    00059
    00060   public:
    00061     virtual const char* className() { return "vl::VolumePlot"; }
    00062
    00064     VolumePlot();
    00065
    00067     void compute(const Function& func, float threshold);
    00068
    00070     const Actor* isosurfaceActor() const { return mIsosurfaceActor.get(); }
    00072     Actor* isosurfaceActor() { return mIsosurfaceActor.get(); }
    00073
    00075     const Geometry* isosurfaceGeometry() const { return mIsosurfaceGeometry.get(); }
    00077     Geometry* isosurfaceGeometry() { return mIsosurfaceGeometry.get(); }
    00078
    00080     const Effect* isosurfaceEffect() const { return mIsosurfaceEffect.get(); }
    00082     Effect* isosurfaceEffect() { return mIsosurfaceEffect.get(); }
    00083
    00085     const Effect* boxEffect() const { return mBoxEffect.get(); }
    00087     Effect* boxEffect() { return mBoxEffect.get(); }
    00088
    00090     const fvec3& minCorner() const { return mMinCorner; }
    00092     void setMinCorner(const fvec3& min_corner) { mMinCorner = min_corner; }
    00093
    00095     const fvec3& maxCorner() const { return mMaxCorner; }
    00097     void setMaxCorner(const fvec3& max_corner) { mMaxCorner = max_corner; }
    00098
    00100     Transform* plotTransform() const { return mPlotTransform.get(); }
    00102     void setPlotTransform(Transform* tr) { mPlotTransform = tr; }
    00103
    00105     const ivec3& samplingResolution() const { return mSamplingResolution; }
    00107     void setSamplingResolution(const ivec3& size) { mSamplingResolution = size; }
    00108
    00110     const String& labelFormat() const { return mLabelFormat; }
    00112     void setLabelFormat(const String& format) { mLabelFormat = format; }
    00113
    00115     Font* labelFont() const { return mLabelFont.get(); }
    00117     void setLabelFont(Font* font) { mLabelFont = font; }
    00118
    00120     const Text* textTemplate() const { return mTextTemplate.get(); }
    00122     Text* textTemplate() { return mTextTemplate.get(); }
    00123
    00124     ActorTree* actorTreeMulti() { return mActorTreeMulti.get(); }
    00125     const ActorTree* actorTreeMulti() const { return mActorTreeMulti.get(); }
    00126
    00127   protected:
    00128     void setupLabels(const String& format, const fvec3& min_corner, const fvec3& max_corner, Font* font, Transform* root_tr);
    00129     void evaluateFunction(float* scalar, const fvec3& min_corner, const fvec3& max_corner, const Function& func);
    00130
    00131   protected:
    00132     std::vector< ref<Actor> > mActors;
    00133     ref<Transform> mPlotTransform;
    00134     ivec3 mSamplingResolution;
    00135     String mLabelFormat;
    00136     ref< Font > mLabelFont;
    00137     fvec3 mMinCorner;
    00138     fvec3 mMaxCorner;
    00139     ref<Geometry> mIsosurfaceGeometry;
    00140     ref<Actor> mIsosurfaceActor;
    00141     ref<Effect> mIsosurfaceEffect;
    00142     ref<Effect> mBoxEffect;
    00143     ref<Text> mTextTemplate;
    00144     ref<ActorTree> mActorTreeMulti;
    00145   };
    00146 }
    00147
    00148 #endif

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:26.
Permission is granted to use this page to write and publish articles regarding Visualization Library.