本文整理汇总了C++中SHAPE_CIRCLE类的典型用法代码示例。如果您正苦于以下问题:C++ SHAPE_CIRCLE类的具体用法?C++ SHAPE_CIRCLE怎么用?C++ SHAPE_CIRCLE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SHAPE_CIRCLE类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushoutForce
static VECTOR2I pushoutForce( const SHAPE_CIRCLE& aA, const SEG& aB, int aClearance )
{
VECTOR2I f( 0, 0 );
const VECTOR2I c = aA.GetCenter();
const VECTOR2I nearest = aB.NearestPoint( c );
const int r = aA.GetRadius();
int dist = ( nearest - c ).EuclideanNorm();
int min_dist = aClearance + r;
if( dist < min_dist )
{
for( int corr = 0; corr < 5; corr++ )
{
f = ( aA.GetCenter() - nearest ).Resize( min_dist - dist + corr );
if( aB.Distance( c + f ) >= min_dist )
break;
}
}
return f;
}
示例2: switch
const SHAPE_LINE_CHAIN PNS_SOLID::Hull( int aClearance, int aWalkaroundThickness ) const
{
int cl = aClearance + aWalkaroundThickness / 2;
switch( m_shape->Type() )
{
case SH_RECT:
{
SHAPE_RECT* rect = static_cast<SHAPE_RECT*>( m_shape );
return OctagonalHull( rect->GetPosition(), rect->GetSize(), cl + 1, 0.2 * cl );
}
case SH_CIRCLE:
{
SHAPE_CIRCLE* circle = static_cast<SHAPE_CIRCLE*>( m_shape );
int r = circle->GetRadius();
return OctagonalHull( circle->GetCenter() - VECTOR2I( r, r ), VECTOR2I( 2 * r, 2 * r ),
cl + 1, 0.52 * ( r + cl ) );
}
case SH_SEGMENT:
{
SHAPE_SEGMENT* seg = static_cast<SHAPE_SEGMENT*> ( m_shape );
return SegmentHull( *seg, aClearance, aWalkaroundThickness );
}
default:
break;
}
return SHAPE_LINE_CHAIN();
}
示例3: pushoutForce
static VECTOR2I pushoutForce( const SHAPE_CIRCLE& aA, const SEG& aB, int aClearance )
{
VECTOR2I nearest = aB.NearestPoint( aA.GetCenter() );
VECTOR2I f (0, 0);
int dist = ( nearest - aA.GetCenter() ).EuclideanNorm();
int min_dist = aClearance + aA.GetRadius();
if( dist < min_dist )
f = ( aA.GetCenter() - nearest ).Resize ( min_dist - dist + 10 );
return f;
}
示例4: Collide
static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN& aB, int aClearance,
bool aNeedMTV, VECTOR2I& aMTV )
{
bool found = false;
for( int s = 0; s < aB.SegmentCount(); s++ )
{
if( aA.Collide( aB.CSegment( s ), aClearance ) )
{
found = true;
break;
}
}
if( !aNeedMTV || !found )
return found;
SHAPE_CIRCLE cmoved( aA );
VECTOR2I f_total( 0, 0 );
for( int s = 0; s < aB.SegmentCount(); s++ )
{
VECTOR2I f = pushoutForce( cmoved, aB.CSegment( s ), aClearance );
cmoved.SetCenter( cmoved.GetCenter() + f );
f_total += f;
}
aMTV = f_total;
return found;
}
示例5: Collide
static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN& aB, int aClearance,
bool aNeedMTV, VECTOR2I& aMTV )
{
for( int s = 0; s < aB.SegmentCount(); s++ )
{
if( aA.Collide( aB.CSegment( s ), aClearance ) )
return true;
}
return false;
}