Skip to content

Commit

Permalink
Typos and re indent
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Apr 20, 2018
1 parent f558b74 commit 44c72a0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
12 changes: 6 additions & 6 deletions python/core/qgsvector3d.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class QgsVector3D
{
%Docstring
Class for storage of 3D vectors similar to QgsVector3D, with the difference that it uses double precision
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precision
instead of single precision floating point numbers.

.. versionadded:: 3.0
Expand Down Expand Up @@ -60,16 +60,16 @@ Sets vector coordinates

QgsVector3D operator-( const QgsVector3D &other ) const;

QgsVector3D operator *(const double factor) const;
QgsVector3D operator *( const double factor ) const;

QgsVector3D operator /( const double factor) const;
QgsVector3D operator /( const double factor ) const;

static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2);
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2 );
%Docstring
Returns the dot product of two vectors
%End

static QgsVector3D crossProduct(const QgsVector3D& v1, const QgsVector3D& v2);
static QgsVector3D crossProduct( const QgsVector3D &v1, const QgsVector3D &v2 );
%Docstring
Returns the cross product of two vectors
%End
Expand All @@ -81,7 +81,7 @@ Returns the length of the vector

void normalize();
%Docstring
Normalizes the currect vector in place.
Normalizes the current vector in place.
%End


Expand Down
39 changes: 20 additions & 19 deletions src/core/qgsvector3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* \ingroup 3d
* Class for storage of 3D vectors similar to QgsVector3D, with the difference that it uses double precision
* Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precision
* instead of single precision floating point numbers.
*
* \since QGIS 3.0
Expand Down Expand Up @@ -76,47 +76,48 @@ class CORE_EXPORT QgsVector3D
}

//! Returns a new vector multiplied by scalar
QgsVector3D operator *(const double factor) const
QgsVector3D operator *( const double factor ) const
{

return QgsVector3D( mX * factor, mY * factor, mZ * factor);
return QgsVector3D( mX * factor, mY * factor, mZ * factor );
}

//! Returns a new vector divided by scalar
QgsVector3D operator /( const double factor) const
QgsVector3D operator /( const double factor ) const
{
return QgsVector3D( mX / factor, mY / factor, mZ / factor);
return QgsVector3D( mX / factor, mY / factor, mZ / factor );
}

//! Returns the dot product of two vectors
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2)
static double dotProduct( const QgsVector3D &v1, const QgsVector3D &v2 )
{
return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z();
return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z();
}

//! Returns the cross product of two vectors
static QgsVector3D crossProduct(const QgsVector3D& v1, const QgsVector3D& v2)
static QgsVector3D crossProduct( const QgsVector3D &v1, const QgsVector3D &v2 )
{
return QgsVector3D(v1.y() * v2.z() - v1.z() * v2.y(),
v1.z() * v2.x() - v1.x() * v2.z(),
v1.x() * v2.y() - v1.y() * v2.x());
return QgsVector3D( v1.y() * v2.z() - v1.z() * v2.y(),
v1.z() * v2.x() - v1.x() * v2.z(),
v1.x() * v2.y() - v1.y() * v2.x() );
}

//! Returns the length of the vector
double length() const
{
return sqrt(mX * mX + mY * mY + mZ * mZ);
return sqrt( mX * mX + mY * mY + mZ * mZ );
}

//! Normalizes the currect vector in place.
//! Normalizes the current vector in place.
void normalize()
{
double len = length();
if ( !qgsDoubleNear( len, 0.0 ) ) {
mX /= len;
mY /= len;
mZ /= len;
}
double len = length();
if ( !qgsDoubleNear( len, 0.0 ) )
{
mX /= len;
mY /= len;
mZ /= len;
}
}


Expand Down

0 comments on commit 44c72a0

Please sign in to comment.