Skip to content

Commit

Permalink
Minor formatting tweaks and renaming PolyLine::isCounterClockwise() t…
Browse files Browse the repository at this point in the history
…o PolyLine::isCounterclockwise()
  • Loading branch information
andrewfb committed Oct 21, 2016
1 parent c1a91f3 commit 5e9008b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/cinder/PolyLine.h
Expand Up @@ -54,7 +54,7 @@ class PolyLineT {
//! Returns \c true if PolyLine is clockwise-oriented. If \a isColinear is non-null, it receives \c true if all points are colinear
bool isClockwise( bool *isColinear = nullptr ) const;
//! Returns \c true if PolyLine is counterclockwise-oriented. If \a isColinear is non-null, it receives \c true if all points are colinear
bool isCounterClockwise( bool *isColinear = nullptr ) const;
bool isCounterclockwise( bool *isColinear = nullptr ) const;

T getPosition( float t ) const;
T getDerivative( float t ) const;
Expand Down
7 changes: 4 additions & 3 deletions src/cinder/PolyLine.cpp
Expand Up @@ -47,7 +47,8 @@ bool PolyLineT<T>::isClockwise( bool *isColinear ) const
for( size_t i = 1; i <= last; ++i ) {
if( mPoints[i].x < mPoints[smallest].x ) {
smallest = i;
} else if( mPoints[i].x == mPoints[smallest].x && mPoints[i].y < mPoints[smallest].y ) {
}
else if( mPoints[i].x == mPoints[smallest].x && mPoints[i].y < mPoints[smallest].y ) {
smallest = i;
}
};
Expand All @@ -66,12 +67,12 @@ bool PolyLineT<T>::isClockwise( bool *isColinear ) const
}

template<typename T>
bool PolyLineT<T>::isCounterClockwise( bool *isColinear ) const
bool PolyLineT<T>::isCounterclockwise( bool *isColinear ) const
{
bool colinear;
bool clockwise = this->isClockwise( &colinear );
if( isColinear != nullptr ) *isColinear = colinear;
return colinear ? false : !clockwise;
return colinear ? false : ! clockwise;
}

template<typename T>
Expand Down
8 changes: 4 additions & 4 deletions test/unit/src/PolyLineTest.cpp
Expand Up @@ -23,8 +23,8 @@ TEST_CASE("PolyLine", "Orientation")
REQUIRE( ! p1.isClockwise( &colinear ) );
REQUIRE( colinear );

REQUIRE( ! p1.isCounterClockwise() );
REQUIRE( ! p1.isCounterClockwise( &colinear ) );
REQUIRE( ! p1.isCounterclockwise() );
REQUIRE( ! p1.isCounterclockwise( &colinear ) );
REQUIRE( colinear );
}

Expand All @@ -42,8 +42,8 @@ TEST_CASE("PolyLine", "Orientation")
REQUIRE( ! p1.isClockwise( &colinear ) );
REQUIRE( colinear );

REQUIRE( ! p1.isCounterClockwise() );
REQUIRE( ! p1.isCounterClockwise( &colinear ) );
REQUIRE( ! p1.isCounterclockwise() );
REQUIRE( ! p1.isCounterclockwise( &colinear ) );
REQUIRE( colinear );
}

Expand Down

0 comments on commit 5e9008b

Please sign in to comment.