67 #ifndef _graphicsproceduralcycloidmodifier_cpp
68 #define _graphicsproceduralcycloidmodifier_cpp
70 #include "Graphics/Procedural/Texture/cycloidmodifier.h"
72 #include "MathTools/mathtools.h"
83 CycloidColour(1.0,1.0,1.0,1.0),
84 CycloidCenter(0.5,0.5),
108 CurrX = XPos +
static_cast<Integer>( MathTools::Floor( DeltaX + 0.5 ) );
109 CurrY = YPos -
static_cast<Integer>( MathTools::Floor( DeltaY + 0.5 ) );
110 this->
Paint(CurrX,CurrY,Step,Buffer);
114 while( !( SignedX == CurrX && SignedY == CurrY && Phi < 100.0 * MathTools::GetPi() ) || Phi < MathTools::GetTwoPi() );
130 CurrX = XPos +
static_cast<Integer>( MathTools::Floor( DeltaX + 0.5 ) );
131 CurrY = YPos -
static_cast<Integer>( MathTools::Floor( DeltaY + 0.5 ) );
132 this->
Paint(CurrX,CurrY,Step,Buffer);
136 while( !( SignedX == CurrX && SignedY == CurrY && Phi < 100.0 * MathTools::GetPi() ) || Phi < MathTools::GetTwoPi() );
152 CurrX = XPos +
static_cast<Integer>( MathTools::Floor( DeltaX + 0.5 ) );
153 CurrY = YPos -
static_cast<Integer>( MathTools::Floor( DeltaY + 0.5 ) );
154 this->
Paint(CurrX,CurrY,Step,Buffer);
158 while( !( SignedX == CurrX && SignedY == CurrY && Phi < 100.0 * MathTools::GetPi() ) || Phi < MathTools::GetTwoPi() );
174 CurrX = XPos +
static_cast<Integer>( MathTools::Floor( DeltaX + 0.5 ) );
175 CurrY = YPos -
static_cast<Integer>( MathTools::Floor( DeltaY + 0.5 ) );
176 this->
Paint(CurrX,CurrY,Step,Buffer);
180 while( !( SignedX == CurrX && SignedY == CurrY && Phi < 100.0 * MathTools::GetPi() ) || Phi < MathTools::GetTwoPi() );
189 Real ActualStep = Step / 10.0;
195 Real DeltaX = this->
Parameter_R * MathTools::Cos(k * t) * MathTools::Sin(t);
196 Real DeltaY = this->
Parameter_R * MathTools::Cos(k * t) * MathTools::Cos(t);
198 CurrX = XPos +
static_cast<Integer>( MathTools::Floor( DeltaX + 0.5 ) );
199 CurrY = YPos -
static_cast<Integer>( MathTools::Floor( DeltaY + 0.5 ) );
200 this->
Paint(CurrX,CurrY,ActualStep,Buffer);
204 while( t <= MathTools::GetTwoPi() );
212 Real ActualStep = Step / 10.0;
221 CurrX = XPos +
static_cast<Integer>( MathTools::Floor( DeltaX + 0.5 ) );
222 CurrY = YPos -
static_cast<Integer>( MathTools::Floor( DeltaY + 0.5 ) );
223 this->
Paint(CurrX,CurrY,ActualStep,Buffer);
227 while( t <= MathTools::GetTwoPi() );
233 if( XPos < 0 || YPos < 0 || XPos >= static_cast<Integer>( Buffer.
GetWidth() ) || YPos >= static_cast<Integer>( Buffer.
GetHeight() ) ) {
238 for(
Real Phi = 0 ; Phi <= MathTools::GetTwoPi() ; Phi += Step )
240 Real DeltaX = MathTools::Cos(Phi);
241 Real DeltaY = MathTools::Sin(Phi);
244 Integer CurrX = XPos +
static_cast<Integer>( MathTools::Floor( static_cast<Real>(r) * DeltaX + 0.5 ) );
245 Integer CurrY = YPos -
static_cast<Integer>( MathTools::Floor( static_cast<Real>(r) * DeltaY + 0.5 ) );
246 if( CurrX >= 0 && CurrY >= 0 && CurrX < static_cast<Integer>( Buffer.
GetWidth() ) && CurrY < static_cast<Integer>( Buffer.
GetHeight() ) ) {
306 {
return "CycloidModifier"; }
324 Real Size =
static_cast<Real>( std::min( TextureWidth, TextureHeight ) );
void ProcessLissajousCurve(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Draws a Lissajous Curve to the texture.
Sets defaults for drawing a Epicycloid. See class detailed description for more information.
Sets defaults for drawing a Epitrochoid. See class detailed description for more information.
void ProcessHypocycloid(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Draws a Hypocycloid to the texture.
Sets defaults for drawing a Rose Curve. See class detailed description for more information.
Whole GetWidth() const
Get the pixel width of this texture.
CycloidModifier & SetDefaultParameters(const Whole SquareSize)
Sets the default values for every parameter.
CycloidModifier & SetCycloidPenSize(const Real Size)
Sets the size of the line to draw for the Cycloid.
void ProcessRoseCurve(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Draws a Rose Curve to the texture.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
virtual ~CycloidModifier()
Class destructor.
Real Parameter_R
See CycloidParameter enum for details.
int Integer
A datatype used to represent any integer close to.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
void Paint(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Convenience method for the setting of the actual pixels being drawn.
CycloidModifier & SetColour(const ColourValue &Colour)
Sets the colour of the lines to be drawn for the Cycloid.
CycloidModifier()
Blank constructor.
Real Parameter_e
See CycloidParameter enum for details.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
CycloidModifier & SetCycloidParameter(const CycloidParameter Param, const Real Value)
Sets a Cycloid parameter.
This implements the exception hiearchy for Mezzanine.
CycloidType Type
The type of Cycloid to draw.
float Real
A Datatype used to represent a real floating point number.
This is exclusively used by a Lissajous Curve and skews the angle at which the drawing perspective is...
Sets defaults for drawing a Hypotrochoid. See class detailed description for more information...
Real Y
Coordinate on the Y vector.
Generally this is altering the distance of the drawing pen from the center of the drawing circle...
CycloidParameter
An enum describing the parameters that can be altered for each type of Cycloid.
CycloidModifier & SetCycloidCenterY(const Real Y)
Sets the center position of the Cycloid on the Y axis.
void ProcessEpicycloid(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Draws a Epicycloid to the texture.
Real X
Coordinate on the X vector.
Generally this is altering the radius of the drawing circle.
This is used to represent a point on a 2 dimentional area, such as a screen.
Vector2 CycloidCenter
The center of the cycloid on the target texture.
virtual String GetName() const
Gets the name of this modifier.
Whole CycloidPenSize
The size of the curved line to draw.
void ProcessEpitrochoid(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Draws a Epitrochoid to the texture.
CycloidModifier & SetCycloidCenter(const Vector2 &Center)
Sets the center position of the Cycloid.
Real Parameter_r
See CycloidParameter enum for details.
void SetValues(const Real &x, const Real &y)
Sets the X and Y values of this vector2.
CycloidModifier & SetCycloidType(const CycloidType ToDraw)
Sets the type of Cycloid that will be rendered.
void SetValues(const Real Red, const Real Green, const Real Blue, const Real Alpha)
Sets each of the colour channels.
Thrown when the available information should have worked but failed for unknown reasons.
ColourValue CycloidColour
The colour of the curve line to draw.
Sets defaults for drawing a Hypocyloid. See class detailed description for more information.
A convenience buffer that stores pixel colour values of a texture to be generated.
void ProcessHypotrochoid(const Integer XPos, const Integer YPos, const Real Step, TextureBuffer &Buffer)
Draws a Hypotrochoid to the texture.
Sets defaults for drawing a Lissajous Curve. See class detailed description for more information...
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Whole GetHeight() const
Get the pixel height of this texture.
Real Parameter_d
See CycloidParameter enum for details.
In a Rose Curve this will generate k petals if 2*k is even. If k is odd then it will generate k petal...
void SetPixel(const Whole X, const Whole Y, const ColourValue &Colour)
Set colour of a specified pixel using a ColourValue. the X or Y location go beyond the set size of th...
Generally this is altering the radius of the base circle that the drawing circle rotates around...
A modifier that will draw a series of curved line segments.
CycloidType
The type of Cycloid to draw.
std::string String
A datatype used to a series of characters.
CycloidModifier & SetCycloidCenterX(const Real X)
Sets the center position of the Cycloid on the X axis.