|
@@ -47,28 +47,29 @@ bool Model2DData::istPunktInnen( Vertex p, int polygonId ) const
|
|
if( p < minP || p > maxP || !polygons )
|
|
if( p < minP || p > maxP || !polygons )
|
|
return 0;
|
|
return 0;
|
|
int num = 0;
|
|
int num = 0;
|
|
- for( auto *polygon = &polygons->getArray(); polygon && polygon->set; polygon = polygon->next, num++ )
|
|
|
|
|
|
+ auto outListP = outList.getArray();
|
|
|
|
+ for( auto *polygon = &polygons->getArray(); polygon && polygon->set; polygon = polygon->next, num++, outListP++ )
|
|
{
|
|
{
|
|
if( polygonId >= 0 && num != polygonId )
|
|
if( polygonId >= 0 && num != polygonId )
|
|
continue;
|
|
continue;
|
|
int anz = polygon->var.vertex->getEintragAnzahl();
|
|
int anz = polygon->var.vertex->getEintragAnzahl();
|
|
- int ola = outList.z( num )->getEintragAnzahl();
|
|
|
|
bool c = 0;
|
|
bool c = 0;
|
|
int j = anz - 1;
|
|
int j = anz - 1;
|
|
- for( int k = 0; k < ola; k++ )
|
|
|
|
|
|
+ for( auto outListPP = outListP.var->getArray(); outListPP.set; outListPP++ )
|
|
{
|
|
{
|
|
- Punkt out = outList.z( num )->get( k );
|
|
|
|
|
|
+ Punkt out = outListPP.var;
|
|
if( out.x < out.y && j > out.x && j < out.y )
|
|
if( out.x < out.y && j > out.x && j < out.y )
|
|
j = out.x;
|
|
j = out.x;
|
|
if( out.x > out.y && ( j > out.x || j < out.y ) )
|
|
if( out.x > out.y && ( j > out.x || j < out.y ) )
|
|
j = out.x;
|
|
j = out.x;
|
|
}
|
|
}
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
|
|
|
+ auto point = polygon->var.vertex->getArray();
|
|
|
|
+ for( int i = 0; i < anz; i++, point++ )
|
|
{
|
|
{
|
|
bool cont = 0;
|
|
bool cont = 0;
|
|
- for( int k = 0; k < ola; k++ )
|
|
|
|
|
|
+ for( auto outListPP = outListP.var->getArray(); outListPP.set; outListPP++ )
|
|
{
|
|
{
|
|
- Punkt out = outList.z( num )->get( k );
|
|
|
|
|
|
+ Punkt out = outListPP.var;
|
|
if( out.x < out.y && i > out.x && i < out.y )
|
|
if( out.x < out.y && i > out.x && i < out.y )
|
|
cont = 1;
|
|
cont = 1;
|
|
if( out.x > out.y && ( i > out.x || i < out.y ) )
|
|
if( out.x > out.y && ( i > out.x || i < out.y ) )
|
|
@@ -76,7 +77,7 @@ bool Model2DData::istPunktInnen( Vertex p, int polygonId ) const
|
|
}
|
|
}
|
|
if( cont )
|
|
if( cont )
|
|
continue;
|
|
continue;
|
|
- Vertex a = polygon->var.vertex->get( i );
|
|
|
|
|
|
+ Vertex a = point.var;
|
|
Vertex b = polygon->var.vertex->get( j );
|
|
Vertex b = polygon->var.vertex->get( j );
|
|
if( ( ( a.y >= p.y ) != ( b.y >= p.y ) ) && ( p.x <= ( b.x - a.x ) * ( p.y - a.y ) / (float)( b.y - a.y ) + a.x ) )
|
|
if( ( ( a.y >= p.y ) != ( b.y >= p.y ) ) && ( p.x <= ( b.x - a.x ) * ( p.y - a.y ) / (float)( b.y - a.y ) + a.x ) )
|
|
c = !c;
|
|
c = !c;
|
|
@@ -794,21 +795,23 @@ bool Model2DObject::istPunktInnen( Vertex p ) const
|
|
if( p < Mat3< float >::scaling( size ) * rData->minP || p > Mat3< float >::scaling( size ) * rData->maxP || !rData->polygons )
|
|
if( p < Mat3< float >::scaling( size ) * rData->minP || p > Mat3< float >::scaling( size ) * rData->maxP || !rData->polygons )
|
|
return 0;
|
|
return 0;
|
|
int num = 0;
|
|
int num = 0;
|
|
|
|
+ Mat3< float > mat = Mat3< float >::rotation( -rotation ) * Mat3< float >::scaling( -size );
|
|
|
|
+ p = mat * p;
|
|
for( auto *polygon = &rData->polygons->getArray(); polygon && polygon->set; polygon = polygon->next, num++ )
|
|
for( auto *polygon = &rData->polygons->getArray(); polygon && polygon->set; polygon = polygon->next, num++ )
|
|
{
|
|
{
|
|
if( polygon->var.transparent )
|
|
if( polygon->var.transparent )
|
|
continue;
|
|
continue;
|
|
- Mat3< float > mat = Mat3< float >::rotation( rotation ) * Mat3< float >::scaling( size );
|
|
|
|
- int anz = polygon->var.vertex->getEintragAnzahl();
|
|
|
|
bool c = 0;
|
|
bool c = 0;
|
|
- int j = anz - 1;
|
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
|
|
|
+ for( auto point = polygon->var.vertex->getArray(); point.set; point++ )
|
|
{
|
|
{
|
|
- Vertex a = mat * polygon->var.vertex->get( i );
|
|
|
|
- Vertex b = mat * polygon->var.vertex->get( j );
|
|
|
|
|
|
+ Vertex a;
|
|
|
|
+ if( point.next )
|
|
|
|
+ a = point.next->var;
|
|
|
|
+ else
|
|
|
|
+ a = polygon->var.vertex->get( 0 );
|
|
|
|
+ Vertex b = point.var;
|
|
if( ( ( a.y >= p.y ) != ( b.y >= p.y ) ) && ( p.x <= ( b.x - a.x ) * ( p.y - a.y ) / (float)( b.y - a.y ) + a.x ) )
|
|
if( ( ( a.y >= p.y ) != ( b.y >= p.y ) ) && ( p.x <= ( b.x - a.x ) * ( p.y - a.y ) / (float)( b.y - a.y ) + a.x ) )
|
|
c = !c;
|
|
c = !c;
|
|
- j = i;
|
|
|
|
}
|
|
}
|
|
if( c )
|
|
if( c )
|
|
return 1;
|
|
return 1;
|