Fixing bounding box calc for arcs

This commit is contained in:
Seth Hillbrand 2018-04-19 13:20:25 -07:00
parent 96b5dee48f
commit b618da1fac
2 changed files with 21 additions and 5 deletions

View File

@ -22,6 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <vector>
#include <geometry/shape_arc.h> #include <geometry/shape_arc.h>
#include <geometry/shape_line_chain.h> #include <geometry/shape_line_chain.h>
@ -146,6 +148,24 @@ const VECTOR2I SHAPE_ARC::GetP1() const
return p1; return p1;
} }
const BOX2I SHAPE_ARC::BBox( int aClearance ) const
{
BOX2I bbox;
std::vector<VECTOR2I> points;
points.push_back( m_pc );
points.push_back( m_p0 );
points.push_back( GetP1() );
bbox.Compute( points );
if( aClearance != 0 )
bbox.Inflate( aClearance );
return bbox;
}
bool SHAPE_ARC::Collide( const VECTOR2I& aP, int aClearance ) const bool SHAPE_ARC::Collide( const VECTOR2I& aP, int aClearance ) const
{ {
assert( false ); assert( false );

View File

@ -63,11 +63,7 @@ public:
const VECTOR2I GetP1() const; const VECTOR2I GetP1() const;
const VECTOR2I& GetCenter() const { return m_pc; } const VECTOR2I& GetCenter() const { return m_pc; }
const BOX2I BBox( int aClearance = 0 ) const override const BOX2I BBox( int aClearance = 0 ) const override;
{
assert( false );
return BOX2I(); // fixme
}
bool Collide( const SEG& aSeg, int aClearance = 0 ) const override; bool Collide( const SEG& aSeg, int aClearance = 0 ) const override;
bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const override; bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const override;