Skip to content
Permalink
Browse files

run astyle on src/*

  • Loading branch information
3nids committed Mar 3, 2017
1 parent dccf8c9 commit 2e7de50b424bf7a417bbfee8ea9f5a859c39b562
Showing 728 changed files with 10,813 additions and 10,803 deletions.
@@ -19,7 +19,7 @@
#include "Vector3D.h"
#include "MathUtils.h"

void Bezier3D::calcFirstDer( float t, Vector3D* v )
void Bezier3D::calcFirstDer( float t, Vector3D *v )
{
if ( v && mControlPoly )
{
@@ -35,13 +35,13 @@ void Bezier3D::calcFirstDer( float t, Vector3D* v )
for ( int n = 1; n <= int( mControlPoly->count() - 1 ); n++ )
{
double bernst = MathUtils::calcBernsteinPoly( mControlPoly->count() - 2, n - 1, t );
v->setX( v->getX() + (( *mControlPoly )[n]->getX() - ( *mControlPoly )[n-1]->getX() )*bernst );
v->setY( v->getY() + (( *mControlPoly )[n]->getY() - ( *mControlPoly )[n-1]->getY() )*bernst );
v->setZ( v->getZ() + (( *mControlPoly )[n]->getZ() - ( *mControlPoly )[n-1]->getZ() )*bernst );
v->setX( v->getX() + ( ( *mControlPoly )[n]->getX() - ( *mControlPoly )[n - 1]->getX() )*bernst );
v->setY( v->getY() + ( ( *mControlPoly )[n]->getY() - ( *mControlPoly )[n - 1]->getY() )*bernst );
v->setZ( v->getZ() + ( ( *mControlPoly )[n]->getZ() - ( *mControlPoly )[n - 1]->getZ() )*bernst );
}
v->setX( v->getX()*( mControlPoly->count() - 1 ) );
v->setY( v->getY()*( mControlPoly->count() - 1 ) );
v->setZ( v->getZ()*( mControlPoly->count() - 1 ) );
v->setX( v->getX() * ( mControlPoly->count() - 1 ) );
v->setY( v->getY() * ( mControlPoly->count() - 1 ) );
v->setZ( v->getZ() * ( mControlPoly->count() - 1 ) );
}

else
@@ -50,7 +50,7 @@ void Bezier3D::calcFirstDer( float t, Vector3D* v )
}
}

void Bezier3D::calcPoint( float t, Point3D* p )
void Bezier3D::calcPoint( float t, Point3D *p )
{

if ( p && mControlPoly )
@@ -62,9 +62,9 @@ void Bezier3D::calcPoint( float t, Point3D* p )
for ( int n = 1; n <= int( mControlPoly->count() ); n++ )
{
double bernst = MathUtils::calcBernsteinPoly( mControlPoly->count() - 1, n - 1, t );
p->setX( p->getX() + ( *mControlPoly )[n-1]->getX()*bernst );
p->setY( p->getY() + ( *mControlPoly )[n-1]->getY()*bernst );
p->setZ( p->getZ() + ( *mControlPoly )[n-1]->getZ()*bernst );
p->setX( p->getX() + ( *mControlPoly )[n - 1]->getX()*bernst );
p->setY( p->getY() + ( *mControlPoly )[n - 1]->getY()*bernst );
p->setZ( p->getZ() + ( *mControlPoly )[n - 1]->getZ()*bernst );
}
}

@@ -74,7 +74,7 @@ void Bezier3D::calcPoint( float t, Point3D* p )
}
}

void Bezier3D::calcSecDer( float t, Vector3D* v )
void Bezier3D::calcSecDer( float t, Vector3D *v )
{
if ( v && mControlPoly )
{
@@ -91,9 +91,9 @@ void Bezier3D::calcSecDer( float t, Vector3D* v )
for ( int n = 1; n <= int( nodes - 2 ); n++ )
{
double bernst = MathUtils::calcBernsteinPoly( nodes - 3, n - 1, t );
v->setX( v->getX() + (( *mControlPoly )[n+1]->getX() - 2*( *mControlPoly )[n]->getX() + ( *mControlPoly )[n-1]->getX() )*bernst );
v->setY( v->getY() + (( *mControlPoly )[n+1]->getY() - 2*( *mControlPoly )[n]->getY() + ( *mControlPoly )[n-1]->getY() )*bernst );
v->setZ( v->getZ() + (( *mControlPoly )[n+1]->getZ() - 2*( *mControlPoly )[n]->getZ() + ( *mControlPoly )[n-1]->getZ() )*bernst );
v->setX( v->getX() + ( ( *mControlPoly )[n + 1]->getX() - 2 * ( *mControlPoly )[n]->getX() + ( *mControlPoly )[n - 1]->getX() )*bernst );
v->setY( v->getY() + ( ( *mControlPoly )[n + 1]->getY() - 2 * ( *mControlPoly )[n]->getY() + ( *mControlPoly )[n - 1]->getY() )*bernst );
v->setZ( v->getZ() + ( ( *mControlPoly )[n + 1]->getZ() - 2 * ( *mControlPoly )[n]->getZ() + ( *mControlPoly )[n - 1]->getZ() )*bernst );
}
v->setX( v->getX()*MathUtils::faculty( nodes - 1 ) / MathUtils::faculty( nodes - 3 ) );
v->setY( v->getY()*MathUtils::faculty( nodes - 1 ) / MathUtils::faculty( nodes - 3 ) );
@@ -111,15 +111,15 @@ void Bezier3D::changeDirection()//does this work correctly? more testing is need
{
if ( mControlPoly )
{
Point3D** pointer = new Point3D*[mControlPoly->count()];//create an array to temporarily store pointer to the control points
Point3D **pointer = new Point3D*[mControlPoly->count()];//create an array to temporarily store pointer to the control points
for ( int i = 0; i < mControlPoly->count(); i++ )//store the points
{
pointer[i] = ( *mControlPoly )[i];
}

for ( int i = 0; i < mControlPoly->count(); i++ )
{
mControlPoly->insert( i, pointer[( mControlPoly->count()-1 )-i] );
mControlPoly->insert( i, pointer[( mControlPoly->count() - 1 ) - i] );
}
delete [] pointer;
}
@@ -31,36 +31,36 @@ class ANALYSIS_EXPORT Bezier3D: public ParametricLine
//! Default constructor
Bezier3D();
//! Constructor, par is a pointer to the parent, controlpoly a controlpolygon
Bezier3D( ParametricLine* par, QVector<Point3D*>* controlpoly );
Bezier3D( ParametricLine *par, QVector<Point3D *> *controlpoly );

virtual ~Bezier3D();
//! Do not use this method, since a Bezier curve does not consist of other curves
virtual void add( ParametricLine *pl ) override;
//! Calculates the first derivative and assigns it to v
virtual void calcFirstDer( float t, Vector3D* v ) override;
virtual void calcFirstDer( float t, Vector3D *v ) override;
//! Calculates the second derivative and assigns it to v
virtual void calcSecDer( float t, Vector3D* v ) override;
virtual void calcSecDer( float t, Vector3D *v ) override;
//virtual Point3D calcPoint(float t);
//! Calculates the point on the curve and assigns it to p
virtual void calcPoint( float t, Point3D* p ) override;
virtual void calcPoint( float t, Point3D *p ) override;
//! Changes the order of control points
virtual void changeDirection() override;
//virtual void draw(QPainter* p);
//virtual bool intersects(ParametricLine* pal);
//! Do not use this method, since a Bezier curve does not consist of other curves
virtual void remove( int i ) override;
//! Returns a control point
virtual const Point3D* getControlPoint( int number ) const override;
virtual const Point3D *getControlPoint( int number ) const override;
//! Returns a pointer to the control polygon
virtual const QVector<Point3D*>* getControlPoly() const override;
virtual const QVector<Point3D *> *getControlPoly() const override;
//! Returns the degree of the curve
virtual int getDegree() const override;
//! Returns the parent
virtual ParametricLine* getParent() const override;
virtual ParametricLine *getParent() const override;
//! Sets the parent
virtual void setParent( ParametricLine* par ) override;
virtual void setParent( ParametricLine *par ) override;
//! Sets the control polygon
virtual void setControlPoly( QVector<Point3D*>* cp ) override;
virtual void setControlPoly( QVector<Point3D *> *cp ) override;

};

@@ -71,7 +71,7 @@ inline Bezier3D::Bezier3D() : ParametricLine()//default constructor

}

inline Bezier3D::Bezier3D( ParametricLine* parent, QVector<Point3D*>* controlpoly ) : ParametricLine( parent, controlpoly )
inline Bezier3D::Bezier3D( ParametricLine *parent, QVector<Point3D *> *controlpoly ) : ParametricLine( parent, controlpoly )
{
mDegree = mControlPoly->count() - 1;
}
@@ -97,12 +97,12 @@ inline void Bezier3D::remove( int i )

//-----------------------------------------------setters and getters---------------------------------------------------------------

inline const Point3D* Bezier3D::getControlPoint( int number ) const
inline const Point3D *Bezier3D::getControlPoint( int number ) const
{
return ( *mControlPoly )[number-1];
return ( *mControlPoly )[number - 1];
}

inline const QVector<Point3D*>* Bezier3D::getControlPoly() const
inline const QVector<Point3D *> *Bezier3D::getControlPoly() const
{
return mControlPoly;
}
@@ -112,17 +112,17 @@ inline int Bezier3D::getDegree() const
return mDegree;
}

inline ParametricLine* Bezier3D::getParent() const
inline ParametricLine *Bezier3D::getParent() const
{
return mParent;
}

inline void Bezier3D::setParent( ParametricLine* par )
inline void Bezier3D::setParent( ParametricLine *par )
{
mParent = par;
}

inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp )
inline void Bezier3D::setControlPoly( QVector<Point3D *> *cp )
{
mControlPoly = cp;
mDegree = mControlPoly->count() - 1;

0 comments on commit 2e7de50

Please sign in to comment.
You can’t perform that action at this time.