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


Java DelaunayTriangle.neighborCCW方法代码示例

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


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

示例1: finalizationPolygon

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void finalizationPolygon( DTSweepContext tcx )
{
    // Get an Internal triangle to start with
    DelaunayTriangle t = tcx.aFront.head.next.triangle;
    TriangulationPoint p = tcx.aFront.head.next.point;
    while( !t.getConstrainedEdgeCW( p ) )
    {
        t = t.neighborCCW( p );
    }
    
    // Collect interior triangles constrained by edges
    tcx.meshClean( t );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:DTSweep.java

示例2: finalizationPolygon

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
private static void finalizationPolygon( DTSweepContext tcx )
{
    // Get an Internal triangle to start with
    DelaunayTriangle t = tcx.aFront.head.next.triangle;
    TriangulationPoint p = tcx.aFront.head.next.point;
    while( !t.getConstrainedEdgeCW( p ) )
    {
        t = t.neighborCCW( p );
    }

    // Collect interior triangles constrained by edges
    tcx.meshClean( t );
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:14,代码来源:DTSweep.java

示例3: 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

示例4: rotateTrianglePair

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
/**
 * Rotates a triangle pair one vertex CW
 *<pre>
 *       n2                    n2
 *  P +-----+             P +-----+
 *    | t  /|               |\  t |  
 *    |   / |               | \   |
 *  n1|  /  |n3           n1|  \  |n3
 *    | /   |    after CW   |   \ |
 *    |/ oT |               | oT \|
 *    +-----+ oP            +-----+
 *       n4                    n4
 * </pre>
 */
private static void rotateTrianglePair( DelaunayTriangle t, 
                                        TriangulationPoint p, 
                                        DelaunayTriangle ot, 
                                        TriangulationPoint op )
{
    DelaunayTriangle n1,n2,n3,n4;
    n1 = t.neighborCCW( p );
    n2 = t.neighborCW( p );
    n3 = ot.neighborCCW( op );
    n4 = ot.neighborCW( op );

    boolean ce1,ce2,ce3,ce4;
    ce1 = t.getConstrainedEdgeCCW(p);
    ce2 = t.getConstrainedEdgeCW(p);
    ce3 = ot.getConstrainedEdgeCCW(op);
    ce4 = ot.getConstrainedEdgeCW(op);
    
    boolean de1,de2,de3,de4;
    de1 = t.getDelunayEdgeCCW(p);
    de2 = t.getDelunayEdgeCW(p);
    de3 = ot.getDelunayEdgeCCW(op);
    de4 = ot.getDelunayEdgeCW(op);
    
    t.legalize( p, op );
    ot.legalize( op, p );
    
    // Remap dEdge
    ot.setDelunayEdgeCCW( p, de1 );
    t.setDelunayEdgeCW(   p, de2 );
    t.setDelunayEdgeCCW( op, de3 );
    ot.setDelunayEdgeCW( op, de4 );

    // Remap cEdge
    ot.setConstrainedEdgeCCW( p, ce1 );
    t.setConstrainedEdgeCW(   p, ce2 );
    t.setConstrainedEdgeCCW( op, ce3 );
    ot.setConstrainedEdgeCW( op, ce4 );
    
    // Remap neighbors
    // XXX: might optimize the markNeighbor by keeping track of
    //      what side should be assigned to what neighbor after the 
    //      rotation. Now mark neighbor does lots of testing to find 
    //      the right side.
    t.clearNeighbors();
    ot.clearNeighbors();
    if( n1 != null ) ot.markNeighbor( n1 );
    if( n2 != null ) t.markNeighbor( n2 );
    if( n3 != null ) t.markNeighbor( n3 );
    if( n4 != null ) ot.markNeighbor( n4 );
    t.markNeighbor( ot );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:66,代码来源: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: rotateTrianglePair

import org.poly2tri.triangulation.delaunay.DelaunayTriangle; //导入方法依赖的package包/类
/**
 * Rotates a triangle pair one vertex CW
 *<pre>
 *       n2                    n2
 *  P +-----+             P +-----+
 *    | t  /|               |\  t |
 *    |   / |               | \   |
 *  n1|  /  |n3           n1|  \  |n3
 *    | /   |    after CW   |   \ |
 *    |/ oT |               | oT \|
 *    +-----+ oP            +-----+
 *       n4                    n4
 * </pre>
 */
private static void rotateTrianglePair( DelaunayTriangle t,
                                        TriangulationPoint p,
                                        DelaunayTriangle ot,
                                        TriangulationPoint op )
{
    DelaunayTriangle n1,n2,n3,n4;
    n1 = t.neighborCCW( p );
    n2 = t.neighborCW( p );
    n3 = ot.neighborCCW( op );
    n4 = ot.neighborCW( op );

    boolean ce1,ce2,ce3,ce4;
    ce1 = t.getConstrainedEdgeCCW(p);
    ce2 = t.getConstrainedEdgeCW(p);
    ce3 = ot.getConstrainedEdgeCCW(op);
    ce4 = ot.getConstrainedEdgeCW(op);

    boolean de1,de2,de3,de4;
    de1 = t.getDelunayEdgeCCW(p);
    de2 = t.getDelunayEdgeCW(p);
    de3 = ot.getDelunayEdgeCCW(op);
    de4 = ot.getDelunayEdgeCW(op);

    t.legalize( p, op );
    ot.legalize( op, p );

    // Remap dEdge
    ot.setDelunayEdgeCCW( p, de1 );
    t.setDelunayEdgeCW(   p, de2 );
    t.setDelunayEdgeCCW( op, de3 );
    ot.setDelunayEdgeCW( op, de4 );

    // Remap cEdge
    ot.setConstrainedEdgeCCW( p, ce1 );
    t.setConstrainedEdgeCW(   p, ce2 );
    t.setConstrainedEdgeCCW( op, ce3 );
    ot.setConstrainedEdgeCW( op, ce4 );

    // Remap neighbors
    // XXX: might optimize the markNeighbor by keeping track of
    //      what side should be assigned to what neighbor after the
    //      rotation. Now mark neighbor does lots of testing to find
    //      the right side.
    t.clearNeighbors();
    ot.clearNeighbors();
    if( n1 != null ) ot.markNeighbor( n1 );
    if( n2 != null ) t.markNeighbor( n2 );
    if( n3 != null ) t.markNeighbor( n3 );
    if( n4 != null ) ot.markNeighbor( n4 );
    t.markNeighbor( ot );
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:66,代码来源:DTSweep.java

示例7: 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


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