Performance: check line ends first before doing collision.
This commit is contained in:
parent
2172810600
commit
72a389e612
|
@ -705,13 +705,27 @@ void CN_VISITOR::checkZoneItemConnection( CN_ZONE_LAYER* aZoneLayer, CN_ITEM* aI
|
||||||
if( !aItem->Parent()->IsOnLayer( layer ) )
|
if( !aItem->Parent()->IsOnLayer( layer ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aZoneLayer->Collide( aItem->Parent()->GetEffectiveShape( layer ).get() ) )
|
auto connect =
|
||||||
|
[&]()
|
||||||
{
|
{
|
||||||
aZoneLayer->Connect( aItem );
|
aZoneLayer->Connect( aItem );
|
||||||
aItem->Connect( aZoneLayer );
|
aItem->Connect( aZoneLayer );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Try quick checks first...
|
||||||
|
for( int i = 0; i < aItem->AnchorCount(); ++i )
|
||||||
|
{
|
||||||
|
if( aZoneLayer->ContainsPoint( aItem->GetAnchor( i ) ) )
|
||||||
|
{
|
||||||
|
connect();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( aZoneLayer->Collide( aItem->Parent()->GetEffectiveShape( layer ).get() ) )
|
||||||
|
connect();
|
||||||
|
}
|
||||||
|
|
||||||
void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LAYER* aZoneLayerB )
|
void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LAYER* aZoneLayerB )
|
||||||
{
|
{
|
||||||
const ZONE* zoneA = static_cast<const ZONE*>( aZoneLayerA->Parent() );
|
const ZONE* zoneA = static_cast<const ZONE*>( aZoneLayerA->Parent() );
|
||||||
|
|
Loading…
Reference in New Issue