Fixing bounding box calc for arcs
This commit is contained in:
parent
96b5dee48f
commit
b618da1fac
|
@ -22,6 +22,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <geometry/shape_arc.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
|
||||
|
@ -146,6 +148,24 @@ const VECTOR2I SHAPE_ARC::GetP1() const
|
|||
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
|
||||
{
|
||||
assert( false );
|
||||
|
|
|
@ -63,11 +63,7 @@ public:
|
|||
const VECTOR2I GetP1() const;
|
||||
const VECTOR2I& GetCenter() const { return m_pc; }
|
||||
|
||||
const BOX2I BBox( int aClearance = 0 ) const override
|
||||
{
|
||||
assert( false );
|
||||
return BOX2I(); // fixme
|
||||
}
|
||||
const BOX2I BBox( 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;
|
||||
|
|
Loading…
Reference in New Issue