当前位置: 首页>>代码示例>>Java>>正文


Java DelaunayTriangle.neighborAcross方法代码示例

本文整理汇总了Java中org.poly2tri.triangulation.delaunay.DelaunayTriangle.neighborAcross方法的典型用法代码示例。如果您正苦于以下问题:Java DelaunayTriangle.neighborAcross方法的具体用法?Java DelaunayTriangle.neighborAcross怎么用?Java DelaunayTriangle.neighborAcross使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.poly2tri.triangulation.delaunay.DelaunayTriangle的用法示例。


在下文中一共展示了DelaunayTriangle.neighborAcross方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: edgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void edgeEvent( DTSweepContext tcx, 
                               TriangulationPoint ep,
                               TriangulationPoint eq,
                               DelaunayTriangle triangle, 
                               TriangulationPoint point )
{
    TriangulationPoint p1,p2;
            
    if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setPrimaryTriangle( triangle ); }

    if( isEdgeSideOfTriangle( triangle, ep, eq ) )
    {
        return;
    }
    
    p1 = triangle.pointCCW( point );
    Orientation o1 = orient2d( eq, p1, ep );
    if( o1 == Orientation.Collinear )
    {
        if( triangle.contains( eq, p1 ) )
        {
            triangle.markConstrainedEdge( eq, p1 );
            // We are modifying the constraint maybe it would be better to 
            // not change the given constraint and just keep a variable for the new constraint
            tcx.edgeEvent.constrainedEdge.q = p1;
            triangle = triangle.neighborAcross( point );
            edgeEvent( tcx, ep, p1, triangle, p1 );
        }
        else
        {
            throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" );                
        }            
        if( tcx.isDebugEnabled() ) { logger.info( "EdgeEvent - Point on constrained edge" ); }
        return;
    }

    p2 = triangle.pointCW( point );
    Orientation o2 = orient2d( eq, p2, ep );
    if( o2 == Orientation.Collinear )
    {
        if( triangle.contains( eq, p2 ) )
        {
            triangle.markConstrainedEdge( eq, p2 );
            // We are modifying the constraint maybe it would be better to 
            // not change the given constraint and just keep a variable for the new constraint
            tcx.edgeEvent.constrainedEdge.q = p2;
            triangle = triangle.neighborAcross( point );
            edgeEvent( tcx, ep, p2, triangle, p2 );
        }
        else
        {
            throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" );                
        }            
        if( tcx.isDebugEnabled() ) { logger.info( "EdgeEvent - Point on constrained edge" ); }
        return;
    }

    if( o1 == o2 )
    {
        // Need to decide if we are rotating CW or CCW to get to a triangle
        // that will cross edge
        if( o1 == Orientation.CW )
        {
            triangle = triangle.neighborCCW( point );
        }
        else
        {
            triangle = triangle.neighborCW( point );                
        }
        edgeEvent( tcx, ep, eq, triangle, point );
    }
    else
    {
        // This triangle crosses constraint so lets flippin start!
        flipEdgeEvent( tcx, ep, eq, triangle, point );
    }        
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:78,代码来源:DTSweep.java

示例2: flipEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void flipEdgeEvent( DTSweepContext tcx, 
                                   TriangulationPoint ep,
                                   TriangulationPoint eq,
                                   DelaunayTriangle t, 
                                   TriangulationPoint p )
{
    TriangulationPoint op, newP;
    DelaunayTriangle ot;
    boolean inScanArea;
    
    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );

    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( tcx.isDebugEnabled() ) 
    { 
        tcx.getDebugContext().setPrimaryTriangle( t ); 
        tcx.getDebugContext().setSecondaryTriangle( ot ); 
     } // TODO: remove

    inScanArea = inScanArea( p,
                             t.pointCCW( p ),
                             t.pointCW( p ), 
                             op );
    if( inScanArea )
    {
        // Lets rotate shared edge one vertex CW
        rotateTrianglePair( t, p, ot, op );
        tcx.mapTriangleToNodes( t );
        tcx.mapTriangleToNodes( ot );
        
        if( p == eq && op == ep )
        {
            if(    eq == tcx.edgeEvent.constrainedEdge.q 
                && ep == tcx.edgeEvent.constrainedEdge.p)
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - constrained edge done" ); } // TODO: remove                    
                t.markConstrainedEdge( ep, eq );
                ot.markConstrainedEdge( ep, eq );
                legalize( tcx, t );                    
                legalize( tcx, ot );  
            }
            else
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - subedge done" ); } // TODO: remove
                // XXX: I think one of the triangles should be legalized here?                    
            }
        }                          
        else
        {
            if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - flipping and continuing with triangle still crossing edge" ); } // TODO: remove
            Orientation o = orient2d( eq, op, ep );
            t = nextFlipTriangle( tcx, o, t, ot, p, op );
            flipEdgeEvent( tcx, ep, eq, t, p );
        }
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, t, ot, newP );
        edgeEvent( tcx, ep, eq, t, p );                
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:70,代码来源:DTSweep.java

示例3: flipScanEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
/**
 * Scan part of the FlipScan algorithm<br>
 * When a triangle pair isn't flippable we will scan for the next 
 * point that is inside the flip triangle scan area. When found 
 * we generate a new flipEdgeEvent
 * 
 * @param tcx
 * @param ep - last point on the edge we are traversing
 * @param eq - first point on the edge we are traversing
 * @param flipTriangle - the current triangle sharing the point eq with edge
 * @param t
 * @param p
 */
private static void flipScanEdgeEvent( DTSweepContext tcx, 
                                       TriangulationPoint ep,
                                       TriangulationPoint eq,
                                       DelaunayTriangle flipTriangle, 
                                       DelaunayTriangle t, 
                                       TriangulationPoint p )
{
    DelaunayTriangle ot;
    TriangulationPoint op,newP;
    boolean inScanArea;
            
    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );        
    
    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( tcx.isDebugEnabled() ) 
    { 
        System.out.println("[FLIP:SCAN] - scan next point" ); // TODO: remove
        tcx.getDebugContext().setPrimaryTriangle( t );        
        tcx.getDebugContext().setSecondaryTriangle( ot ); 
    }
    
    inScanArea = inScanArea( eq,
                             flipTriangle.pointCCW( eq ),
                             flipTriangle.pointCW( eq ), 
                             op );
    if( inScanArea )
    {
        // flip with new edge op->eq
        flipEdgeEvent( tcx, eq, op, ot, op );                
        // TODO: Actually I just figured out that it should be possible to 
        //       improve this by getting the next ot and op before the the above 
        //       flip and continue the flipScanEdgeEvent here
        // set new ot and op here and loop back to inScanArea test
        // also need to set a new flipTriangle first
        // Turns out at first glance that this is somewhat complicated
        // so it will have to wait.
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, flipTriangle, ot, newP );    
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:64,代码来源:DTSweep.java

示例4: flipEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void flipEdgeEvent( DTSweepContext tcx, 
                                   TriangulationPoint ep,
                                   TriangulationPoint eq,
                                   DelaunayTriangle t, 
                                   TriangulationPoint p )
{
    TriangulationPoint op, newP;
    DelaunayTriangle ot;
    boolean inScanArea;
    
    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );

    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( t.getConstrainedEdgeAcross(p) )
    {
        throw new RuntimeException( "Intersecting Constraints" );
    }

    if( tcx.isDebugEnabled() ) 
    { 
        tcx.getDebugContext().setPrimaryTriangle( t ); 
        tcx.getDebugContext().setSecondaryTriangle( ot ); 
     } // TODO: remove

    inScanArea = inScanArea( p,
                             t.pointCCW( p ),
                             t.pointCW( p ), 
                             op );
    if( inScanArea )
    {
        // Lets rotate shared edge one vertex CW
        rotateTrianglePair( t, p, ot, op );
        tcx.mapTriangleToNodes( t );
        tcx.mapTriangleToNodes( ot );
        
        if( p == eq && op == ep )
        {
            if(    eq == tcx.edgeEvent.constrainedEdge.q 
                && ep == tcx.edgeEvent.constrainedEdge.p)
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - constrained edge done" ); } // TODO: remove                    
                t.markConstrainedEdge( ep, eq );
                ot.markConstrainedEdge( ep, eq );
                legalize( tcx, t );                    
                legalize( tcx, ot );  
            }
            else
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - subedge done" ); } // TODO: remove
                // XXX: I think one of the triangles should be legalized here?                    
            }
        }                          
        else
        {
            if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - flipping and continuing with triangle still crossing edge" ); } // TODO: remove
            Orientation o = orient2d( eq, op, ep );
            t = nextFlipTriangle( tcx, o, t, ot, p, op );
            flipEdgeEvent( tcx, ep, eq, t, p );
        }
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, t, ot, newP );
        edgeEvent( tcx, ep, eq, t, p );                
    }
}
 
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:75,代码来源:DTSweep.java

示例5: edgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void edgeEvent( DTSweepContext tcx,
                               TriangulationPoint ep,
                               TriangulationPoint eq,
                               DelaunayTriangle triangle,
                               TriangulationPoint point )
{
    TriangulationPoint p1,p2;

    if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setPrimaryTriangle( triangle ); }

    if( isEdgeSideOfTriangle( triangle, ep, eq ) )
    {
        return;
    }

    p1 = triangle.pointCCW( point );
    Orientation o1 = orient2d( eq, p1, ep );
    if( o1 == Orientation.Collinear )
    {
        if( triangle.contains( eq, p1 ) )
        {
            triangle.markConstrainedEdge( eq, p1 );
            // We are modifying the constraint maybe it would be better to
            // not change the given constraint and just keep a variable for the new constraint
            tcx.edgeEvent.constrainedEdge.q = p1;
            triangle = triangle.neighborAcross( point );
            edgeEvent( tcx, ep, p1, triangle, p1 );
        }
        else
        {
            throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" );
        }
        if( tcx.isDebugEnabled() ) { LogUtil.info( "EdgeEvent - Point on constrained edge" ); }
        return;
    }

    p2 = triangle.pointCW( point );
    Orientation o2 = orient2d( eq, p2, ep );
    if( o2 == Orientation.Collinear )
    {
        if( triangle.contains( eq, p2 ) )
        {
            triangle.markConstrainedEdge( eq, p2 );
            // We are modifying the constraint maybe it would be better to
            // not change the given constraint and just keep a variable for the new constraint
            tcx.edgeEvent.constrainedEdge.q = p2;
            triangle = triangle.neighborAcross( point );
            edgeEvent( tcx, ep, p2, triangle, p2 );
        }
        else
        {
            throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" );
        }
        if( tcx.isDebugEnabled() ) { LogUtil.info( "EdgeEvent - Point on constrained edge" ); }
        return;
    }

    if( o1 == o2 )
    {
        // Need to decide if we are rotating CW or CCW to get to a triangle
        // that will cross edge
        if( o1 == Orientation.CW )
        {
            triangle = triangle.neighborCCW( point );
        }
        else
        {
            triangle = triangle.neighborCW( point );
        }
        edgeEvent( tcx, ep, eq, triangle, point );
    }
    else
    {
        // This triangle crosses constraint so lets flippin start!
        flipEdgeEvent( tcx, ep, eq, triangle, point );
    }
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:78,代码来源:DTSweep.java

示例6: flipEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void flipEdgeEvent( DTSweepContext tcx,
                                   TriangulationPoint ep,
                                   TriangulationPoint eq,
                                   DelaunayTriangle t,
                                   TriangulationPoint p )
{
    TriangulationPoint op, newP;
    DelaunayTriangle ot;
    boolean inScanArea;

    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );

    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( t.getConstrainedEdgeAcross(p) )
    {
        throw new RuntimeException( "Intersecting Constraints" );
    }

    if( tcx.isDebugEnabled() )
    {
        tcx.getDebugContext().setPrimaryTriangle( t );
        tcx.getDebugContext().setSecondaryTriangle( ot );
     } // TODO: remove

    inScanArea = inScanArea( p,
                             t.pointCCW( p ),
                             t.pointCW( p ),
                             op );
    if( inScanArea )
    {
        // Lets rotate shared edge one vertex CW
        rotateTrianglePair( t, p, ot, op );
        tcx.mapTriangleToNodes( t );
        tcx.mapTriangleToNodes( ot );

        if( p == eq && op == ep )
        {
            if(    eq == tcx.edgeEvent.constrainedEdge.q
                && ep == tcx.edgeEvent.constrainedEdge.p)
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - constrained edge done" ); } // TODO: remove
                t.markConstrainedEdge( ep, eq );
                ot.markConstrainedEdge( ep, eq );
                legalize( tcx, t );
                legalize( tcx, ot );
            }
            else
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - subedge done" ); } // TODO: remove
                // XXX: I think one of the triangles should be legalized here?
            }
        }
        else
        {
            if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - flipping and continuing with triangle still crossing edge" ); } // TODO: remove
            Orientation o = orient2d( eq, op, ep );
            t = nextFlipTriangle( tcx, o, t, ot, p, op );
            flipEdgeEvent( tcx, ep, eq, t, p );
        }
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, t, ot, newP );
        edgeEvent( tcx, ep, eq, t, p );
    }
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:75,代码来源:DTSweep.java

示例7: flipScanEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
/**
 * Scan part of the FlipScan algorithm<br>
 * When a triangle pair isn't flippable we will scan for the next
 * point that is inside the flip triangle scan area. When found
 * we generate a new flipEdgeEvent
 *
 * @param tcx
 * @param ep - last point on the edge we are traversing
 * @param eq - first point on the edge we are traversing
 * @param flipTriangle - the current triangle sharing the point eq with edge
 * @param t
 * @param p
 */
private static void flipScanEdgeEvent( DTSweepContext tcx,
                                       TriangulationPoint ep,
                                       TriangulationPoint eq,
                                       DelaunayTriangle flipTriangle,
                                       DelaunayTriangle t,
                                       TriangulationPoint p )
{
    DelaunayTriangle ot;
    TriangulationPoint op,newP;
    boolean inScanArea;

    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );

    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( tcx.isDebugEnabled() )
    {
        System.out.println("[FLIP:SCAN] - scan next point" ); // TODO: remove
        tcx.getDebugContext().setPrimaryTriangle( t );
        tcx.getDebugContext().setSecondaryTriangle( ot );
    }

    inScanArea = inScanArea( eq,
                             flipTriangle.pointCCW( eq ),
                             flipTriangle.pointCW( eq ),
                             op );
    if( inScanArea )
    {
        // flip with new edge op->eq
        flipEdgeEvent( tcx, eq, op, ot, op );
        // TODO: Actually I just figured out that it should be possible to
        //       improve this by getting the next ot and op before the the above
        //       flip and continue the flipScanEdgeEvent here
        // set new ot and op here and loop back to inScanArea test
        // also need to set a new flipTriangle first
        // Turns out at first glance that this is somewhat complicated
        // so it will have to wait.
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, flipTriangle, ot, newP );
    }
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:64,代码来源:DTSweep.java

示例8: edgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void edgeEvent( DTSweepContext tcx, 
                               TriangulationPoint ep,
                               TriangulationPoint eq,
                               DelaunayTriangle triangle, 
                               TriangulationPoint point )
{
    TriangulationPoint p1,p2;
            
    if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setPrimaryTriangle( triangle ); }

    if( isEdgeSideOfTriangle( triangle, ep, eq ) )
    {
        return;
    }
    
    p1 = triangle.pointCCW( point );
    Orientation o1 = orient2d( eq, p1, ep );
    if( o1 == Orientation.Collinear )
    {
        if( triangle.contains( eq, p1 ) )
        {
            triangle.markConstrainedEdge( eq, p1 );
            // We are modifying the constraint maybe it would be better to 
            // not change the given constraint and just keep a variable for the new constraint
            tcx.edgeEvent.constrainedEdge.q = p1;
            triangle = triangle.neighborAcross( point );
            edgeEvent( tcx, ep, p1, triangle, p1 );
        }
        else
        {
            throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" );                
        }            
        if( tcx.isDebugEnabled() ) {  }
        return;
    }

    p2 = triangle.pointCW( point );
    Orientation o2 = orient2d( eq, p2, ep );
    if( o2 == Orientation.Collinear )
    {
        if( triangle.contains( eq, p2 ) )
        {
            triangle.markConstrainedEdge( eq, p2 );
            // We are modifying the constraint maybe it would be better to 
            // not change the given constraint and just keep a variable for the new constraint
            tcx.edgeEvent.constrainedEdge.q = p2;
            triangle = triangle.neighborAcross( point );
            edgeEvent( tcx, ep, p2, triangle, p2 );
        }
        else
        {
            throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" );                
        }            

        return;
    }

    if( o1 == o2 )
    {
        // Need to decide if we are rotating CW or CCW to get to a triangle
        // that will cross edge
        if( o1 == Orientation.CW )
        {
            triangle = triangle.neighborCCW( point );
        }
        else
        {
            triangle = triangle.neighborCW( point );                
        }
        edgeEvent( tcx, ep, eq, triangle, point );
    }
    else
    {
        // This triangle crosses constraint so lets flippin start!
        flipEdgeEvent( tcx, ep, eq, triangle, point );
    }        
}
 
开发者ID:Anarchid,项目名称:zkgbai,代码行数:78,代码来源:DTSweep.java

示例9: flipEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void flipEdgeEvent( DTSweepContext tcx, 
                                   TriangulationPoint ep,
                                   TriangulationPoint eq,
                                   DelaunayTriangle t, 
                                   TriangulationPoint p )
{
    TriangulationPoint op, newP;
    DelaunayTriangle ot;
    boolean inScanArea;
    
    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );

    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( t.getConstrainedEdgeAcross(p) )
    {
        throw new RuntimeException( "Intersecting Constraints" );
    }

    if( tcx.isDebugEnabled() ) 
    { 
        tcx.getDebugContext().setPrimaryTriangle( t ); 
        tcx.getDebugContext().setSecondaryTriangle( ot ); 
     } // TODO: remove

    inScanArea = inScanArea( p,
                             t.pointCCW( p ),
                             t.pointCW( p ), 
                             op );
    if( inScanArea )
    {
        // Lets rotate shared edge one vertex CW
        rotateTrianglePair( t, p, ot, op );
        tcx.mapTriangleToNodes( t );
        tcx.mapTriangleToNodes( ot );
        
        if( p == eq && op == ep )
        {
            if(    eq == tcx.edgeEvent.constrainedEdge.q 
                && ep == tcx.edgeEvent.constrainedEdge.p)
            {
                t.markConstrainedEdge( ep, eq );
                ot.markConstrainedEdge( ep, eq );
                legalize( tcx, t );                    
                legalize( tcx, ot );  
            }
        }                          
        else
        {
            Orientation o = orient2d( eq, op, ep );
            t = nextFlipTriangle( tcx, o, t, ot, p, op );
            flipEdgeEvent( tcx, ep, eq, t, p );
        }
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, t, ot, newP );
        edgeEvent( tcx, ep, eq, t, p );                
    }
}
 
开发者ID:Anarchid,项目名称:zkgbai,代码行数:68,代码来源:DTSweep.java

示例10: flipScanEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
/**
 * Scan part of the FlipScan algorithm<br>
 * When a triangle pair isn't flippable we will scan for the next 
 * point that is inside the flip triangle scan area. When found 
 * we generate a new flipEdgeEvent
 * 
 * @param tcx
 * @param ep - last point on the edge we are traversing
 * @param eq - first point on the edge we are traversing
 * @param flipTriangle - the current triangle sharing the point eq with edge
 * @param t
 * @param p
 */
private static void flipScanEdgeEvent( DTSweepContext tcx, 
                                       TriangulationPoint ep,
                                       TriangulationPoint eq,
                                       DelaunayTriangle flipTriangle, 
                                       DelaunayTriangle t, 
                                       TriangulationPoint p )
{
    DelaunayTriangle ot;
    TriangulationPoint op,newP;
    boolean inScanArea;
            
    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );        
    
    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( tcx.isDebugEnabled() ) 
    { 
        tcx.getDebugContext().setPrimaryTriangle( t );        
        tcx.getDebugContext().setSecondaryTriangle( ot ); 
    }
    
    inScanArea = inScanArea( eq,
                             flipTriangle.pointCCW( eq ),
                             flipTriangle.pointCW( eq ), 
                             op );
    if( inScanArea )
    {
        // flip with new edge op->eq
        flipEdgeEvent( tcx, eq, op, ot, op );                
        // TODO: Actually I just figured out that it should be possible to 
        //       improve this by getting the next ot and op before the the above 
        //       flip and continue the flipScanEdgeEvent here
        // set new ot and op here and loop back to inScanArea test
        // also need to set a new flipTriangle first
        // Turns out at first glance that this is somewhat complicated
        // so it will have to wait.
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, flipTriangle, ot, newP );    
    }
}
 
开发者ID:Anarchid,项目名称:zkgbai,代码行数:63,代码来源:DTSweep.java

示例11: flipEdgeEvent

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void flipEdgeEvent( DTSweepContext tcx, 
                                   TriangulationPoint ep,
                                   TriangulationPoint eq,
                                   DelaunayTriangle t, 
                                   TriangulationPoint p )
{
    TriangulationPoint op, newP;
    DelaunayTriangle ot;
    boolean inScanArea;
    
    ot = t.neighborAcross( p );
    op = ot.oppositePoint( t, p );

    if( ot == null )
    {
        // If we want to integrate the fillEdgeEvent do it here
        // With current implementation we should never get here
        throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
    }

    if( t.getConstrainedEdgeAcross(p) )
    {
        throw new RuntimeException( "JAMES IS THE BEST" );
    	//System.out.println("Intersecting Constraints, if this happens often, tell James");
    }

    if( tcx.isDebugEnabled() ) 
    { 
        tcx.getDebugContext().setPrimaryTriangle( t ); 
        tcx.getDebugContext().setSecondaryTriangle( ot ); 
     } // TODO: remove

    inScanArea = inScanArea( p,
                             t.pointCCW( p ),
                             t.pointCW( p ), 
                             op );
    if( inScanArea )
    {
        // Lets rotate shared edge one vertex CW
        rotateTrianglePair( t, p, ot, op );
        tcx.mapTriangleToNodes( t );
        tcx.mapTriangleToNodes( ot );
        
        if( p == eq && op == ep )
        {
            if(    eq == tcx.edgeEvent.constrainedEdge.q 
                && ep == tcx.edgeEvent.constrainedEdge.p)
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - constrained edge done" ); } // TODO: remove                    
                t.markConstrainedEdge( ep, eq );
                ot.markConstrainedEdge( ep, eq );
                legalize( tcx, t );                    
                legalize( tcx, ot );  
            }
            else
            {
                if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - subedge done" ); } // TODO: remove
                // XXX: I think one of the triangles should be legalized here?                    
            }
        }                          
        else
        {
            if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - flipping and continuing with triangle still crossing edge" ); } // TODO: remove
            Orientation o = orient2d( eq, op, ep );
            t = nextFlipTriangle( tcx, o, t, ot, p, op );
            flipEdgeEvent( tcx, ep, eq, t, p );
        }
    }
    else
    {
        newP = nextFlipPoint( ep, eq, ot, op );
        flipScanEdgeEvent( tcx, ep, eq, t, ot, newP );
        edgeEvent( tcx, ep, eq, t, p );                
    }
}
 
开发者ID:underclocker,项目名称:Blob-Game,代码行数:76,代码来源:DTSweep.java


注:本文中的org.poly2tri.triangulation.delaunay.DelaunayTriangle.neighborAcross方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。