HyperspaceExplorer 0.7.1
Public Member Functions | Protected Member Functions | Protected Attributes
AltSponge Class Reference

An alternative hypersponge implementation with removal of duplicate faces. More...

#include <Sponge.h>

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

List of all members.

Public Member Functions

 AltSponge (unsigned _level=1, unsigned _distance=2, double _rad=0.8, VecMath::Vector< 4 > _center=VecMath::Vector< 4 >(0., 0., 0., 0.))
 AltSponge constructor.
virtual std::string getFunctionName () const
virtual void SetParameters (const ParameterMap &parms)
 Set parameters to the Displayable.
virtual std::string description ()

Protected Member Functions

virtual void Initialize ()
 Actually creates the Hypercube.
virtual unsigned long MemRequired (unsigned)
 return the approximate amount of memory needed to display a sponge of current level and given distance
void reduceVertices ()
 Remove all duplicate vertices, leaving only unique values.
void removeDuplicateSurfaces ()
 Remove all duplicate surfaces.
void renumberSurfaces (unsigned original_vertex, unsigned duplicate_vertex)
 When a duplicate vertex is removed, let all surfaces referencing it point to the original vertex.
void X_push_back (const VecMath::Vector< 4 > &x)
 This function actually creates the hypersponge.

Protected Attributes

unsigned Level
 Level of the hypersponge.
int distance
 max. distance (see Initialize())
double rad
 radius, more correctly size, of the sponge
VecMath::Vector< 4 > center
 center of the sponge

Detailed Description

An alternative hypersponge implementation with removal of duplicate faces.


Constructor & Destructor Documentation

AltSponge::AltSponge ( unsigned  _level = 1,
unsigned  _distance = 2,
double  _rad = 0.8,
VecMath::Vector< 4 >  _center = VecMath::Vector<4>(0., 0.,0., 0.) 
)

AltSponge constructor.

Construct a Hypersponge of level level.

Parameters:
_levelhypersponge level
_distancedistance of subcubes to center to be counted as part of the fractal
  • = 0: solid hypercube
  • = 1: foam
  • = 2: sponge
  • = 3: dust
  • >= 4: nothing
_radside_length/2
_centercenter
_levelLevel of recursion used in creating the Sponge
_distancesee Initialize()
_radSize of the Sponge - _rad is half the side length
_centerCenter point of the Sponge

References Displayable::declareParameter(), and Initialize().

Here is the call graph for this function:


Member Function Documentation

virtual std::string AltSponge::description ( ) [inline, virtual]
Returns:
A string with a description of the Hypersponge object

Reimplemented from Hypercube.

References std::ends(), and Level.

Here is the call graph for this function:

virtual std::string AltSponge::getFunctionName ( ) const [inline, virtual]
Returns:
The name of the Displayable in cleartext

Reimplemented from Hypercube.

void AltSponge::Initialize ( void  ) [protected, virtual]
unsigned long AltSponge::MemRequired ( unsigned  distance) [protected, virtual]

return the approximate amount of memory needed to display a sponge of current level and given distance

Todo:
uses hardcoded and experimentally found value for memory per hypercube
Parameters:
distancesee Initialize()
Returns:
approx. mem required

References Level, and pow().

Here is the call graph for this function:

void AltSponge::renumberSurfaces ( unsigned  original_vertex,
unsigned  duplicate_vertex 
) [protected]

When a duplicate vertex is removed, let all surfaces referencing it point to the original vertex.

Also, all vertices after the removed one are shifted up by one element, so the surfaces pointing to them must be updated too.

Parameters:
original_vertexThe vertex, first in the vertex array, that is kept.
duplicate_vertexThe removed vertex.
virtual void AltSponge::SetParameters ( const ParameterMap ) [inline, 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 from Hypercube.

References std::map< _Key, _Tp, _Compare, _Alloc >::begin(), std::cerr, distance, std::map< _Key, _Tp, _Compare, _Alloc >::end(), Level, rad, Displayable::setParameter(), and ParameterMap::toString().

Here is the call graph for this function:

void AltSponge::X_push_back ( const VecMath::Vector< 4 > &  x) [protected]

This function actually creates the hypersponge.

It views it as an assembly of $ 3^4 $ smaller sponges, slicing the sponge in three sub-sponges in every one of the four dimensions, and then taking away some of the resulting 81 smaller sub-sponges.

  • if the parameter distance is zero, it only removes the sub-sponge with distance 0 from the center, i.e. the one at the center.
  • if the parameter distance is one, it only removes the sub-sponges with distance <= 1, amounting to nine removed sub-sponges. The three- dimensional surface of the hypercube enveloping the sponge is not breached, because the surface of a hypercube is two units away from the center, instead of one unit, as in 3D.
  • if distance = 2, the holes reach the hypercubes surface, giving an object analogous to the three-dimensional Menger Sponge.
  • if distance = 3, only the 16 corners of the hypercube remain, giving four-dimensional fractal dust.

If the level of the sponge is 1, the sub-sponges are hypercubes. Otherwise, they are Hypersponges with a level reduced by 1.

Todo:
merge joined surfaces into one. not trivial, because the surfaces have holes.

References Loki::SingletonHolder< T, CreationPolicy >::Instance(), Object::setX(), and VertexHolder< 4, 1, double >::X().

Referenced by Initialize().

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