HyperspaceExplorer 0.7.1
|
A Displayable is a generalized four-dimensional object. More...
#include <Displayable.h>
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 | |
Impl * | pImpl_ |
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"); }
Rename other references to the name "Function"
Vector &normal (double, double, double); - or in derived classes?
operator () (double t, double u, double v) - ditto
Displayable::Displayable | ( | ) |
Displayable default c'tor.
Zeroes everything
Displayable::Displayable | ( | ParameterMap | parameters | ) |
Displayable c'tor given a set of FunctionParameter.
parameters | Parameters for the Displayable. |
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.
T | Type 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().
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.
T | Type 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().
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.
The h value is fixed and hardcoded. better approach, please!
I don't think calling operator() is right. Call f()!
tt | t value |
uu | u value |
vv | v value |
References operator()().
Referenced by RealFunction::normal().
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] |
Implemented in CustomFunction, CustomPolarFunction, CustomSurface, CustomComplexFunction, LSystem, Hypercube, Pyramid, Gasket, Sponge, AltSponge, RealFunction, Hypersphere, Torus1, Torus2, Fr3r, GravitationPotential, Fr3rSin, Fr3rExp, PolarSin, PolarSin2, PolarR, Rotope, SimpleComposite, z2, z3, zA, ez, emz2, zm1, zm2, sqrtz, lnz, sinz, cosz, sinhz, coshz, tanz, Surface1, Horizon, and Torus3.
unsigned int Displayable::getNumParameters | ( | ) | [virtual] |
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().
FunctionParameter::parameter_ptr_type Displayable::getParameter | ( | const std::string & | name | ) |
name
References Displayable::Impl::_parameters, and ParameterMap::getParameter().
ParameterMap Displayable::getParameters | ( | ) |
References Displayable::Impl::_parameters.
FunctionParameter::value_ptr_type Displayable::getParameterValue | ( | const std::string & | name | ) |
name
. References Displayable::Impl::_parameters, and ParameterMap::getValue().
unsigned long Displayable::MemRequired | ( | void | ) | [protected, virtual] |
Return the approximate amount of memory needed to display a Function of current definition set.
Reimplemented in Gasket.
Referenced by Sponge::Initialize().
VecMath::Vector< 4 > & Displayable::operator() | ( | double | , |
double | , | ||
double | |||
) | [protected, virtual] |
Function evaluation operator for three parameters.
Reimplemented in Composite, RealFunction, and Surface.
Referenced by df().
void Displayable::setParameter | ( | const ParameterMap & | parms, |
T & | parm, | ||
const std::string & | key | ||
) | [inline] |
Set a parameter with a specified key from a supplied ParameterMap.
T | Type of the parameter to be set. |
References Displayable::Impl::_parameters, std::map< _Key, _Tp, _Compare, _Alloc >::begin(), and std::map< _Key, _Tp, _Compare, _Alloc >::end().
Referenced by emz2::SetParameters(), ez::SetParameters(), zA::SetParameters(), PolarR::SetParameters(), PolarSin::SetParameters(), GravitationPotential::SetParameters(), Torus2::SetParameters(), Torus1::SetParameters(), Hypersphere::SetParameters(), AltSponge::SetParameters(), Sponge::SetParameters(), Gasket::SetParameters(), Pyramid::SetParameters(), and Hypercube::SetParameters().
void Displayable::SetParameters | ( | const ParameterMap & | ) | [virtual] |
Set parameters to the Displayable.
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().