Code formatting

This commit is contained in:
Maciej Suminski 2018-02-19 10:03:56 +01:00
parent 0504a6db52
commit 2f4ec0c0c4
1 changed files with 22 additions and 20 deletions

View File

@ -1855,8 +1855,8 @@ SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::chamferFilletPolygon( CORNER_MODE aMode,
for( unsigned int j = 0; j < segments; j++ ) for( unsigned int j = 0; j < segments; j++ )
{ {
nx = xc + cos( startAngle + (j + 1) * deltaAngle ) * radius; nx = xc + cos( startAngle + ( j + 1 ) * deltaAngle ) * radius;
ny = yc - sin( startAngle + (j + 1) * deltaAngle ) * radius; ny = yc - sin( startAngle + ( j + 1 ) * deltaAngle ) * radius;
// Sanity check: the rounding can produce repeated corners; do not add them. // Sanity check: the rounding can produce repeated corners; do not add them.
if( KiROUND( nx ) != prevX || KiROUND( ny ) != prevY ) if( KiROUND( nx ) != prevX || KiROUND( ny ) != prevY )
@ -1878,7 +1878,7 @@ SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::chamferFilletPolygon( CORNER_MODE aMode,
} }
SHAPE_POLY_SET &SHAPE_POLY_SET::operator=(const SHAPE_POLY_SET & aOther) SHAPE_POLY_SET &SHAPE_POLY_SET::operator=( const SHAPE_POLY_SET& aOther )
{ {
static_cast<SHAPE&>(*this) = aOther; static_cast<SHAPE&>(*this) = aOther;
m_polys = aOther.m_polys; m_polys = aOther.m_polys;
@ -1893,7 +1893,6 @@ SHAPE_POLY_SET &SHAPE_POLY_SET::operator=(const SHAPE_POLY_SET & aOther)
class SHAPE_POLY_SET::TRIANGULATION_CONTEXT class SHAPE_POLY_SET::TRIANGULATION_CONTEXT
{ {
public: public:
@ -2051,6 +2050,7 @@ void SHAPE_POLY_SET::triangulateSingle( const POLYGON& aPoly,
ctx.Triangulate(); ctx.Triangulate();
} }
bool SHAPE_POLY_SET::IsTriangulationUpToDate() const bool SHAPE_POLY_SET::IsTriangulationUpToDate() const
{ {
if( !m_triangulationValid ) if( !m_triangulationValid )
@ -2094,7 +2094,7 @@ void SHAPE_POLY_SET::CacheTriangulation()
m_triangulatedPolys.clear(); m_triangulatedPolys.clear();
if ( tmpSet.HasTouchingHoles() ) if( tmpSet.HasTouchingHoles() )
{ {
// temporary workaround for overlapping hole vertices that poly2tri doesn't handle // temporary workaround for overlapping hole vertices that poly2tri doesn't handle
m_triangulationValid = false; m_triangulationValid = false;
@ -2139,6 +2139,7 @@ MD5_HASH SHAPE_POLY_SET::checksum() const
return hash; return hash;
} }
bool SHAPE_POLY_SET::HasTouchingHoles() const bool SHAPE_POLY_SET::HasTouchingHoles() const
{ {
for( int i = 0; i < OutlineCount(); i++ ) for( int i = 0; i < OutlineCount(); i++ )
@ -2152,17 +2153,18 @@ bool SHAPE_POLY_SET::HasTouchingHoles() const
return false; return false;
} }
bool SHAPE_POLY_SET::hasTouchingHoles( const POLYGON& aPoly ) const bool SHAPE_POLY_SET::hasTouchingHoles( const POLYGON& aPoly ) const
{ {
std::vector< VECTOR2I > pts; std::vector< VECTOR2I > pts;
for ( const auto& lc : aPoly ) for( const auto& lc : aPoly )
{ {
for( int i = 0; i < lc.PointCount(); i++ ) for( int i = 0; i < lc.PointCount(); i++ )
{ {
const auto p = lc.CPoint( i ); const auto p = lc.CPoint( i );
if ( std::find( pts.begin(), pts.end(), p) != pts.end() ) if( std::find( pts.begin(), pts.end(), p ) != pts.end() )
{ {
return true; return true;
} }