Refactoring
This commit is contained in:
parent
73fb85a352
commit
2aa5e568e8
|
@ -119,28 +119,24 @@ void DP_PRIMITIVE_PAIR::CursorOrientation( const VECTOR2I& aCursorPos, VECTOR2I&
|
||||||
{
|
{
|
||||||
assert( m_primP && m_primN );
|
assert( m_primP && m_primN );
|
||||||
|
|
||||||
VECTOR2I aP, aN, dir, midpoint;
|
VECTOR2I aP, aN;
|
||||||
|
|
||||||
if( m_primP->OfKind( ITEM::SEGMENT_T ) && m_primN->OfKind( ITEM::SEGMENT_T ) )
|
if( m_primP->OfKind( ITEM::SEGMENT_T ) && m_primN->OfKind( ITEM::SEGMENT_T ) )
|
||||||
{
|
{
|
||||||
aP = m_primP->Anchor( 1 );
|
aP = m_primP->Anchor( 1 );
|
||||||
aN = m_primN->Anchor( 1 );
|
aN = m_primN->Anchor( 1 );
|
||||||
midpoint = ( aP + aN ) / 2;
|
|
||||||
dir = ( aP - aN ).Perpendicular();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aP = m_primP->Anchor( 0 );
|
aP = m_primP->Anchor( 0 );
|
||||||
aN = m_primN->Anchor( 0 );
|
aN = m_primN->Anchor( 0 );
|
||||||
midpoint = ( aP + aN ) / 2;
|
|
||||||
dir = ( aP - aN ).Perpendicular();
|
|
||||||
|
|
||||||
if( dir.Dot( aCursorPos - midpoint ) < 0 )
|
|
||||||
dir = -dir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aMidpoint = midpoint;
|
aMidpoint = ( aP + aN ) / 2;
|
||||||
aDirection = dir;
|
aDirection = ( aP - aN ).Perpendicular();
|
||||||
|
|
||||||
|
if( aDirection.Dot( aCursorPos - aMidpoint ) < 0 )
|
||||||
|
aDirection = -aDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue