HyperspaceExplorer 0.7.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
Displayable Class Reference

A Displayable is a generalized four-dimensional object. More...

#include <Displayable.h>

Inheritance diagram for Displayable:
Inheritance graph
[legend]
Collaboration diagram for Displayable:
Collaboration graph
[legend]

List of all members.

Classes

struct  Impl

Public Types

typedef void(* function_on_fourspace_vertex )(const VecMath::Vector< 4, double > &)
 function that is applied on the original vertices
typedef void(* function_on_fourspace_and_transformed_vertex )(const VecMath::Vector< 4, double > &, const VecMath::Vector< 4, double > &)
 function that is applied on the original and transformed vertices
typedef void(* function_on_fourspace_transformed_and_projected_vertex )(const VecMath::Vector< 4, double > &, const VecMath::Vector< 4, double > &, const VecMath::Vector< 3, double > &)
 function that is applied on the original and transformed vertices
typedef void(* function_on_projected_vertex )(const VecMath::Vector< 3, double > &)
 function that is applied on vertices transformed and projected into 3-space

Public Member Functions

 Displayable ()
 Displayable default c'tor.
 Displayable (ParameterMap parameters)
 Displayable c'tor given a set of FunctionParameter.
virtual void Transform (const VecMath::Rotation< 4, double > &R, const VecMath::Vector< 4, double > &T, const VecMath::Vector< 4, double > &scale=1.)=0
 Execute the desired rotation and translation to the Displayable object.
void resetTransform ()
 Overloaded function executing the transform to the default state.
virtual void Project (double ScrW, double CamW, bool DepthCue4D)=0
 Projects the vertex data to 3D.
virtual void Draw (UI::View *)=0
 Draw the Displayable object.
virtual void ReInit (double _tmin, double _tmax, double _dt, double _umin, double _umax, double _du, double _vmin, double _vmax, double _dv)=0
 Called when a Displayable must be created anew.
virtual void calibrateColors ()=0
 Called by the ColorManager after setting the Displayable on the CM.
virtual std::string getFunctionName () const =0
virtual unsigned getDefinitionSpaceDimensions ()=0
 number of argument given to the defining function
virtual void SetParameters (const ParameterMap &)
 Set parameters to the Displayable.
ParameterMap getParameters ()
FunctionParameter::parameter_ptr_type getParameter (const std::string &name)
virtual unsigned getNumParameters ()
FunctionParameter::value_ptr_type getParameterValue (const std::string &name)
template<typename T >
void setParameter (const ParameterMap &parms, T &parm, const std::string &key)
 Set a parameter with a specified key from a supplied ParameterMap.
virtual void for_each_vertex (function_on_fourspace_vertex apply)=0
 Loop over all vertices managed by the Displayable and call apply on them.
virtual void for_each_vertex_transformed (function_on_fourspace_and_transformed_vertex apply)
 Loop over all vertices managed by the Displayable and their transformed images and call apply on them.
virtual void for_each_vertex_transformed_projected (function_on_fourspace_transformed_and_projected_vertex apply)
 Loop over all vertices managed by the Displayable, their transformed images and the projection into three-space and call apply on them.
virtual void for_each_projected (function_on_projected_vertex apply)=0
 Loop over all vertices managed by the Displayable and call apply on them.

Protected Member Functions

virtual VecMath::Vector< 4 > & operator() (double, double, double)
 Function evaluation operator for three parameters.
virtual
VecMath::MultiDimensionalVector
< VecMath::Vector< 4 >, 1 > 
df (double, double, double)
 Numerical calculation of the derivatives in t, u and v.
virtual void Initialize (void)=0
 This abstract function is called in the constructor of descendants.
virtual unsigned long MemRequired (void)
 Return the approximate amount of memory needed to display a Function of current definition set.
template<typename T >
void declareParameter (const std::string &, const T &)
 Add a parameter to the list of parameters.
template<typename T >
void declareParameter (const std::string &, const T &, const T &)
 Add a parameter to the list of parameters.

Private Attributes

ImplpImpl_

Detailed Description

A Displayable is a generalized four-dimensional object.

The Displayable interface provides abstract members for the definition of four-dimensional objects, together with methods to rotate and translate the resulting four-dimensional geometry in 4-space, to project the transformed geometry onto 3-space, and to draw the projected grid into a generalized View that can display three-dimensional objects.

It also handles object name, description and any parameters that might be needed to fully describe the object.

abstract members:

virtual members:

other useful members:

Displayable objects can be created directly via their various constructors, or via the createFunction() method of the FunctionFactory class. To enable the latter, a Displayable's definition must be augmented by the following code (for example):

  namespace {
      Displayable *createHypercube() { return new Hypercube(); }
      const bool registered =
          TheFunctionFactory::Instance().registerFunction(createHypercube, "Hypercube");
  }
Todo:

Rename other references to the name "Function"

Vector &normal (double, double, double); - or in derived classes?

operator () (double t, double u, double v) - ditto

Author:
Helge Preuss <lene.preuss@gmail.com>

Constructor & Destructor Documentation

Displayable::Displayable ( )

Displayable default c'tor.

Zeroes everything

Displayable::Displayable ( ParameterMap  parameters)

Displayable c'tor given a set of FunctionParameter.

Parameters:
parametersParameters for the Displayable.

Member Function Documentation

template<typename T >
void Displayable::declareParameter ( const std::string name,
const T &  defaultValue 
) [inline, protected]

Add a parameter to the list of parameters.

Add a parameter with a name and a default value to the parameter list.

Template Parameters:
TType of the parameter to be declared.

References Displayable::Impl::_parameters, std::map< _Key, _Tp, _Compare, _Alloc >::end(), std::map< _Key, _Tp, _Compare, _Alloc >::find(), Displayable::Impl::insertParameter(), and Loki::SingletonHolder< T, CreationPolicy >::Instance().

Referenced by AltSponge::AltSponge(), emz2::emz2(), ez::ez(), Gasket::Gasket(), GravitationPotential::GravitationPotential(), Hypercube::Hypercube(), Hypersphere::Hypersphere(), PolarR::PolarR(), PolarSin::PolarSin(), Pyramid::Pyramid(), Sponge::Sponge(), Torus1::Torus1(), Torus2::Torus2(), and zA::zA().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void Displayable::declareParameter ( const std::string name,
const T &  defaultValue,
const T &  value 
) [inline, protected]

Add a parameter to the list of parameters.

Add a parameter with a name and a default value to the parameter list.

Template Parameters:
TType of the parameter to be declared.

References Displayable::Impl::_parameters, std::map< _Key, _Tp, _Compare, _Alloc >::end(), std::map< _Key, _Tp, _Compare, _Alloc >::find(), Displayable::Impl::insertParameter(), and Loki::SingletonHolder< T, CreationPolicy >::Instance().

Here is the call graph for this function:

VecMath::MultiDimensionalVector< VecMath::Vector< 4 >, 1 > Displayable::df ( double  tt,
double  uu,
double  vv 
) [protected, virtual]

Numerical calculation of the derivatives in t, u and v.

Todo:
this is not general enough. should take the number of arguments that are actually needed.

\[ \frac{df}{dt} = \lim_{h \rightarrow 0} \frac{f(t+h, u, v) - f(t, u, v)}{h}, \frac{df}{du},\frac{df}{dv}\mbox{analogously} \]

Todo:

The h value is fixed and hardcoded. better approach, please!

I don't think calling operator() is right. Call f()!

Parameters:
ttt value
uuu value
vvv value
Returns:
gradient in t, u and v as array

References operator()().

Referenced by RealFunction::normal().

Here is the call graph for this function:

Here is the caller graph for this function:

void Displayable::for_each_vertex_transformed ( Displayable::function_on_fourspace_and_transformed_vertex  apply) [virtual]

Loop over all vertices managed by the Displayable and their transformed images and call apply on them.

This function is not pure virtual because it would be too tedious to require all implementing classes to provide an implementation.

The default implementation provided here throws an exception.

Reimplemented in Composite, VertexHolder< N, P, NUM >, VertexHolder< 4, 1, double >, and VertexHolder< N, P, double >.

void Displayable::for_each_vertex_transformed_projected ( Displayable::function_on_fourspace_transformed_and_projected_vertex  apply) [virtual]

Loop over all vertices managed by the Displayable, their transformed images and the projection into three-space and call apply on them.

This function is not pure virtual because it would be too tedious to require all implementing classes to provide an implementation.

The default implementation provided here throws an exception.

Reimplemented in Composite, VertexHolder< N, P, NUM >, VertexHolder< 4, 1, double >, and VertexHolder< N, P, double >.

virtual std::string Displayable::getFunctionName ( ) const [pure virtual]
unsigned int Displayable::getNumParameters ( ) [virtual]
Returns:
number of parameters for the Displayable

Reimplemented in FunctionHolder< N, P, NUM >, RealFunction, Surface, FunctionHolder< 4, 3, double >, and FunctionHolder< 4, 2, double >.

References Displayable::Impl::_parameters, and std::map< _Key, _Tp, _Compare, _Alloc >::size().

Here is the call graph for this function:

FunctionParameter::parameter_ptr_type Displayable::getParameter ( const std::string name)
Returns:
The value of the parameter which is named name

References Displayable::Impl::_parameters, and ParameterMap::getParameter().

Here is the call graph for this function:

ParameterMap Displayable::getParameters ( )
Returns:
The collection of all parameters (and their values)

References Displayable::Impl::_parameters.

FunctionParameter::value_ptr_type Displayable::getParameterValue ( const std::string name)
Returns:
Value of the parameter with the name name.

References Displayable::Impl::_parameters, and ParameterMap::getValue().

Here is the call graph for this function:

unsigned long Displayable::MemRequired ( void  ) [protected, virtual]

Return the approximate amount of memory needed to display a Function of current definition set.

Todo:
uses hardcoded and experimentally found value for memory per cell
Returns:
approx. mem required

Reimplemented in Gasket.

Referenced by Sponge::Initialize().

Here is the caller graph for this function:

VecMath::Vector< 4 > & Displayable::operator() ( double  ,
double  ,
double   
) [protected, virtual]

Function evaluation operator for three parameters.

Todo:
this is not general enough. should take the number of arguments that are actually needed.

Reimplemented in Composite, RealFunction, and Surface.

Referenced by df().

Here is the caller graph for this function:

template<typename T >
void Displayable::setParameter ( const ParameterMap parms,
T &  parm,
const std::string key 
) [inline]
void Displayable::SetParameters ( const ParameterMap ) [virtual]

Set parameters to the Displayable.

Todo:
This function is only there to provide an interface, and it's not abstract so that Displayable s which don't have Parameters don't need to reimplement an unneeded method. But the present implementation does not make sense.

Reimplemented in LSystem, Hypercube, Pyramid, Gasket, Sponge, AltSponge, Hypersphere, Torus1, Torus2, GravitationPotential, PolarSin, PolarR, Rotope, zA, ez, and emz2.

References std::cerr, and std::endl().

Referenced by C4DView::ApplyChanges().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:17 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo