Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::Procedural::TorusKnotGenerator Class Reference

A generator class for a torus knot mesh. More...

#include <torusknotgenerator.h>

+ Inheritance diagram for Mezzanine::Graphics::Procedural::TorusKnotGenerator:
+ Collaboration diagram for Mezzanine::Graphics::Procedural::TorusKnotGenerator:

Public Member Functions

 TorusKnotGenerator (const Real PoloidalRadius, const Real ToroidalRadius, const Integer PParam=2, const Integer QParam=3, const Whole PoloidalSeg=16, const Whole ToroidalSeg=16)
 Class constructor. More...
 
virtual ~TorusKnotGenerator ()
 Class destructor.
 
virtual void AddToTriangleBuffer (TriangleBuffer &Buffer) const
 Adds the vertices and indices as configured in this generator to a triangle buffer. More...
 
TorusKnotGeneratorSetNumPoloidalSeg (const Whole PoloidalSeg)
 Sets the number of segments on the Poloidal ring.

Exceptions
Ifthe number of segments is less than three, a PARAMETERS_EXCEPTION will be thrown.
More...
 
TorusKnotGeneratorSetNumToroidalSeg (const Whole ToroidalSeg)
 Sets the number of segments along the guiding circle.

Exceptions
Ifthe number of segments is less than three, a PARAMETERS_EXCEPTION will be thrown.
More...
 
TorusKnotGeneratorSetPoloidalRadius (const Real PoloidalRadius)
 Sets the radius of the torus.

Exceptions
Ifthe radius is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown.
More...
 
TorusKnotGeneratorSetPParameter (const Integer PParam)
 Sets the p parameter of the knot

Exceptions
Ifthe paramter is set to 0, a PARAMETERS_EXCEPTION will be thrown.
More...
 
TorusKnotGeneratorSetQParameter (const Integer QParam)
 Sets the q parameter of the knot

Exceptions
Ifthe paramter is set to 0, a PARAMETERS_EXCEPTION will be thrown.
More...
 
TorusKnotGeneratorSetToroidalRadius (const Real ToroidalRadius)
 Sets the radius of the torus ring. AKA it's thickness.

Exceptions
Ifthe radius is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown.
More...
 
- Public Member Functions inherited from Mezzanine::Graphics::Procedural::MeshGenerator< TorusKnotGenerator >
 MeshGenerator ()
 Class constructor.
 
virtual ~MeshGenerator ()
 Class destructor.
 
TriangleBuffer BuildTriangleBuffer () const
 Creates a TriangleBuffer with the the vertices and indices as configured in this generator. More...
 
MeshGenerateMesh (const String &MeshName, const String &MeshGroup, const String &MatName, const String &MatGroup) const
 Generates the mesh. More...
 
TorusKnotGeneratorResetTransforms ()
 Resets all transforms (orientation, position and scale) that would have been applied to the mesh to their default values. More...
 
TorusKnotGeneratorSetEnableNormals (Boole EnableNormals)
 Sets whether normals are enabled or not. More...
 
TorusKnotGeneratorSetNumTexCoordSet (const UInt8 NumSets)
 Sets the number of texture coordintate sets. More...
 
TorusKnotGeneratorSetOrientation (const Quaternion &Ori)
 Sets an orientation baked into the resulting mesh. More...
 
TorusKnotGeneratorSetOrientation (const Real X, const Real Y, const Real Z, const Real W)
 Sets an orientation baked into the resulting mesh. More...
 
TorusKnotGeneratorSetPosition (const Vector3 &Loc)
 Sets a translation baked into the resulting mesh. More...
 
TorusKnotGeneratorSetPosition (const Real X, const Real Y, const Real Z)
 Sets a translation baked into the resulting mesh. More...
 
TorusKnotGeneratorSetScale (const Vector3 &Scaling)
 Sets a scale baked into the resulting mesh. More...
 
TorusKnotGeneratorSetScale (const Real Scaling)
 Sets a uniform scale baked into the resulting mesh. More...
 
TorusKnotGeneratorSetScale (const Real X, const Real Y, const Real Z)
 Sets a scale baked into the resulting mesh. More...
 
TorusKnotGeneratorSetSwitchUV (Boole SwitchUV)
 Sets whether to switch U and V texture coordinates. More...
 
TorusKnotGeneratorSetTextureRectangle (const Real RectLeft, const Real RectRight, const Real RectTop, const Real RectBottom)
 Sets the texture rectangle. More...
 
TorusKnotGeneratorSetUTile (const Real uTile)
 Sets the U Tile. More...
 
TorusKnotGeneratorSetVTile (const Real vTile)
 Sets the V Tile. More...
 

Protected Attributes

Whole NumPoloidalSeg
 The resolution of the Poloidal ring. More...
 
Whole NumToroidalSeg
 The resolution of the Toroidal ring. More...
 
Integer PParameter
 Controls how many times the knot is going around the torus. More...
 
Integer QParameter
 Controls how many times the knot goes through the center of the torus. More...
 
Real TorusPoloidalRadius
 The radius of the primary ring of the torus. More...
 
Real TorusToroidalRadius
 The radius of the secondary ring of the torus. More...
 
- Protected Attributes inherited from Mezzanine::Graphics::Procedural::MeshGenerator< TorusKnotGenerator >
UInt8 GeneratorOpts
 Storage for the boolean options to be used by this generator. More...
 
UInt8 NumTexCoordSet
 The number of texture coordinate sets to include. More...
 
Quaternion Orientation
 Orientation to apply the mesh. More...
 
Vector3 Position
 Position to apply to the mesh. More...
 
Vector3 Scale
 Scale to apply to the mesh. More...
 
Real UTile
 U tile for texture coords generation. More...
 
Vector2 UVOrigin
 Rectangle in which the texture coordinates will be placed. More...
 
Real VTile
 V tile for texture coords generation. More...
 

Additional Inherited Members

- Public Types inherited from Mezzanine::Graphics::Procedural::MeshGenerator< TorusKnotGenerator >
enum  GeneratorOptions
 A convenience enum used to describe boolean options for a generator.
 
- Protected Member Functions inherited from Mezzanine::Graphics::Procedural::MeshGenerator< TorusKnotGenerator >
void AddPoint (TriangleBuffer &Buffer, const Vector3 &Loc, const Vector3 &Norm, const Vector2 &UV) const
 Adds a new point to a triangle buffer, using the format defined for that MeshGenerator. More...
 

Detailed Description

A generator class for a torus knot mesh.

Todo:
This is a fairly simple implementation of a knoted torus, ideally suited to generating a Trefoil Knot. Additional paramters could be added to give this generator more flexibility. See the following link for details: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Curve/Torus_Knot

Definition at line 85 of file torusknotgenerator.h.

Constructor & Destructor Documentation

Mezzanine::Graphics::Procedural::TorusKnotGenerator::TorusKnotGenerator ( const Real  PoloidalRadius,
const Real  ToroidalRadius,
const Integer  PParam = 2,
const Integer  QParam = 3,
const Whole  PoloidalSeg = 16,
const Whole  ToroidalSeg = 16 
)

Class constructor.

Parameters
PoloidalRadiusThe radius of the primary ring of the torus.
ToroidalRadiusThe radius of the secondary ring of the torus.
PParamControls how many times the knot is going around the torus.
QParamControls how many times the knot goes through the center of the torus.
PoloidalSegThe resolution of the primary ring of the torus.
ToroidalSegThe resolution of the secondary ring of the torus.

Definition at line 81 of file torusknotgenerator.cpp.

Member Function Documentation

void Mezzanine::Graphics::Procedural::TorusKnotGenerator::AddToTriangleBuffer ( TriangleBuffer Buffer) const
virtual

Adds the vertices and indices as configured in this generator to a triangle buffer.

Parameters
BufferThe buffer to append this generators vertices and indices to.

Implements Mezzanine::Graphics::Procedural::MeshGenerator< TorusKnotGenerator >.

Definition at line 96 of file torusknotgenerator.cpp.

TorusKnotGenerator & Mezzanine::Graphics::Procedural::TorusKnotGenerator::SetNumPoloidalSeg ( const Whole  PoloidalSeg)

Sets the number of segments on the Poloidal ring.

Exceptions
Ifthe number of segments is less than three, a PARAMETERS_EXCEPTION will be thrown.

Parameters
PoloidalSegThe resolution of the primary ring of the torus.
Returns
Returns a reference to this.

Definition at line 183 of file torusknotgenerator.cpp.

TorusKnotGenerator & Mezzanine::Graphics::Procedural::TorusKnotGenerator::SetNumToroidalSeg ( const Whole  ToroidalSeg)

Sets the number of segments along the guiding circle.

Exceptions
Ifthe number of segments is less than three, a PARAMETERS_EXCEPTION will be thrown.

Parameters
ToroidalSegTheresolution of the secondary ring of the torus.
Returns
Returns a reference to this.

Definition at line 192 of file torusknotgenerator.cpp.

TorusKnotGenerator & Mezzanine::Graphics::Procedural::TorusKnotGenerator::SetPoloidalRadius ( const Real  PoloidalRadius)

Sets the radius of the torus.

Exceptions
Ifthe radius is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown.

Parameters
PoloidalRadiusThe radius of the primary ring of the torus.
Returns
Returns a reference to this.

Definition at line 147 of file torusknotgenerator.cpp.

TorusKnotGenerator & Mezzanine::Graphics::Procedural::TorusKnotGenerator::SetPParameter ( const Integer  PParam)

Sets the p parameter of the knot

Exceptions
Ifthe paramter is set to 0, a PARAMETERS_EXCEPTION will be thrown.

Parameters
PParamControls how many times the knot is going around the torus.
Returns
Returns a reference to this.

Definition at line 165 of file torusknotgenerator.cpp.

TorusKnotGenerator & Mezzanine::Graphics::Procedural::TorusKnotGenerator::SetQParameter ( const Integer  QParam)

Sets the q parameter of the knot

Exceptions
Ifthe paramter is set to 0, a PARAMETERS_EXCEPTION will be thrown.

Parameters
QParamControls how many times the knot goes through the center of the torus.
Returns
Returns a reference to this.

Definition at line 174 of file torusknotgenerator.cpp.

TorusKnotGenerator & Mezzanine::Graphics::Procedural::TorusKnotGenerator::SetToroidalRadius ( const Real  ToroidalRadius)

Sets the radius of the torus ring. AKA it's thickness.

Exceptions
Ifthe radius is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown.

Parameters
ToroidalRadiusThe radius of the secondary ring of the torus.
Returns
Returns a reference to this.

Definition at line 156 of file torusknotgenerator.cpp.

Member Data Documentation

Whole Mezzanine::Graphics::Procedural::TorusKnotGenerator::NumPoloidalSeg
protected

The resolution of the Poloidal ring.

Definition at line 104 of file torusknotgenerator.h.

Whole Mezzanine::Graphics::Procedural::TorusKnotGenerator::NumToroidalSeg
protected

The resolution of the Toroidal ring.

Definition at line 107 of file torusknotgenerator.h.

Integer Mezzanine::Graphics::Procedural::TorusKnotGenerator::PParameter
protected

Controls how many times the knot is going around the torus.

Definition at line 98 of file torusknotgenerator.h.

Integer Mezzanine::Graphics::Procedural::TorusKnotGenerator::QParameter
protected

Controls how many times the knot goes through the center of the torus.

Definition at line 101 of file torusknotgenerator.h.

Real Mezzanine::Graphics::Procedural::TorusKnotGenerator::TorusPoloidalRadius
protected

The radius of the primary ring of the torus.

Remarks
This radius does not encapsulate the complete AABB of the torus. Add Toroidal radius to this value to get the full bounds.

Definition at line 91 of file torusknotgenerator.h.

Real Mezzanine::Graphics::Procedural::TorusKnotGenerator::TorusToroidalRadius
protected

The radius of the secondary ring of the torus.

Remarks
This is the value for the "thickness" of the ring.

Definition at line 95 of file torusknotgenerator.h.


The documentation for this class was generated from the following files: