本文整理汇总了Java中org.poly2tri.triangulation.TriangulationPoint类的典型用法代码示例。如果您正苦于以下问题:Java TriangulationPoint类的具体用法?Java TriangulationPoint怎么用?Java TriangulationPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TriangulationPoint类属于org.poly2tri.triangulation包,在下文中一共展示了TriangulationPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: index
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public int index( TriangulationPoint p )
{
if( p == points[0] )
{
return 0;
}
else if( p == points[1] )
{
return 1;
}
else if( p == points[2] )
{
return 2;
}
throw new RuntimeException("Calling index with a point that doesn't exist in triangle");
}
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:DelaunayTriangle.java
示例2: markNeighbor
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
private void markNeighbor( TriangulationPoint p1,
TriangulationPoint p2,
DelaunayTriangle t )
{
if( ( p1 == points[2] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[2] ) )
{
neighbors[0] = t;
}
else if( ( p1 == points[0] && p2 == points[2] ) || ( p1 == points[2] && p2 == points[0] ) )
{
neighbors[1] = t;
}
else if( ( p1 == points[0] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[0] ) )
{
neighbors[2] = t;
}
else
{
logger.error( "Neighbor error, please report!" );
// throw new Exception("Neighbor error, please report!");
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:DelaunayTriangle.java
示例3: pointCCW
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public TriangulationPoint pointCCW( TriangulationPoint point )
{
if( point == points[0] )
{
return points[1];
}
else if( point == points[1] )
{
return points[2];
}
else if( point == points[2] )
{
return points[0];
}
logger.error( "point location error" );
throw new RuntimeException("[FIXME] point location error");
}
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:DelaunayTriangle.java
示例4: pointCW
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public TriangulationPoint pointCW( TriangulationPoint point )
{
if( point == points[0] )
{
return points[2];
}
else if( point == points[1] )
{
return points[0];
}
else if( point == points[2] )
{
return points[1];
}
logger.error( "point location error" );
throw new RuntimeException("[FIXME] point location error");
}
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:DelaunayTriangle.java
示例5: legalize
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public void legalize( TriangulationPoint oPoint, TriangulationPoint nPoint )
{
if( oPoint == points[0] )
{
points[1] = points[0];
points[0] = points[2];
points[2] = nPoint;
}
else if( oPoint == points[1] )
{
points[2] = points[1];
points[1] = points[0];
points[0] = nPoint;
}
else if( oPoint == points[2] )
{
points[0] = points[2];
points[2] = points[1];
points[1] = nPoint;
}
else
{
logger.error( "legalization error" );
throw new RuntimeException("legalization bug");
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:DelaunayTriangle.java
示例6: sweep
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* Start sweeping the Y-sorted point set from bottom to top
*
* @param tcx
*/
private static void sweep( DTSweepContext tcx )
{
List<TriangulationPoint> points;
TriangulationPoint point;
AdvancingFrontNode node;
points = tcx.getPoints();
for( int i=1; i<points.size(); i++ )
{
point = points.get(i);
node = pointEvent( tcx, point );
if( point.hasEdges() )
{
for( DTSweepConstraint e : point.getEdges() )
{
if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveConstraint( e ); }
edgeEvent( tcx, e, node );
}
}
tcx.update( null );
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:DTSweep.java
示例7: pointEvent
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* Find closes node to the left of the new point and
* create a new triangle. If needed new holes and basins
* will be filled to.
*
* @param tcx
* @param point
* @return
*/
private static AdvancingFrontNode pointEvent( DTSweepContext tcx,
TriangulationPoint point )
{
AdvancingFrontNode node,newNode;
node = tcx.locateNode( point );
if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); }
newNode = newFrontTriangle( tcx, point, node );
// Only need to check +epsilon since point never have smaller
// x value than node due to how we fetch nodes from the front
if( point.getX() <= node.point.getX() + EPSILON )
{
fill( tcx, node );
}
tcx.addNode( newNode );
fillAdvancingFront( tcx, newNode );
return newNode;
}
开发者ID:mleoking,项目名称:PhET,代码行数:30,代码来源:DTSweep.java
示例8: isEdgeSideOfTriangle
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
private static boolean isEdgeSideOfTriangle( DelaunayTriangle triangle,
TriangulationPoint ep,
TriangulationPoint eq )
{
int index;
index = triangle.edgeIndex( ep, eq );
if( index != -1 )
{
triangle.markConstrainedEdge( index );
triangle = triangle.neighbors[ index ];
if( triangle != null )
{
triangle.markConstrainedEdge( ep, eq );
}
return true;
}
return false;
}
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:DTSweep.java
示例9: nextFlipPoint
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* When we need to traverse from one triangle to the next we need
* the point in current triangle that is the opposite point to the next
* triangle.
*
* @param ep
* @param eq
* @param ot
* @param op
* @return
*/
private static TriangulationPoint nextFlipPoint( TriangulationPoint ep,
TriangulationPoint eq,
DelaunayTriangle ot,
TriangulationPoint op )
{
Orientation o2d = orient2d( eq, op, ep );
if( o2d == Orientation.CW )
{
// Right
return ot.pointCCW( op );
}
else if( o2d == Orientation.CCW )
{
// Left
return ot.pointCW( op );
}
else
{
// TODO: implement support for point on constraint edge
throw new PointOnEdgeException("Point on constrained edge not supported yet");
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:34,代码来源:DTSweep.java
示例10: nextFlipTriangle
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* After a flip we have two triangles and know that only one will still be
* intersecting the edge. So decide which to contiune with and legalize the other
*
* @param tcx
* @param o - should be the result of an orient2d( eq, op, ep )
* @param t - triangle 1
* @param ot - triangle 2
* @param p - a point shared by both triangles
* @param op - another point shared by both triangles
* @return returns the triangle still intersecting the edge
*/
private static DelaunayTriangle nextFlipTriangle( DTSweepContext tcx,
Orientation o,
DelaunayTriangle t,
DelaunayTriangle ot,
TriangulationPoint p,
TriangulationPoint op)
{
int edgeIndex;
if( o == Orientation.CCW )
{
// ot is not crossing edge after flip
edgeIndex = ot.edgeIndex( p, op );
ot.dEdge[edgeIndex] = true;
legalize( tcx, ot );
ot.clearDelunayEdges();
return t;
}
// t is not crossing edge after flip
edgeIndex = t.edgeIndex( p, op );
t.dEdge[edgeIndex] = true;
legalize( tcx, t );
t.clearDelunayEdges();
return ot;
}
开发者ID:mleoking,项目名称:PhET,代码行数:37,代码来源:DTSweep.java
示例11: compare
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public int compare( TriangulationPoint p1, TriangulationPoint p2 )
{
if(p1.getY() < p2.getY() )
{
return -1;
}
else if( p1.getY() > p2.getY())
{
return 1;
}
else
{
if(p1.getX() < p2.getX())
{
return -1;
}
else if( p1.getX() > p2.getX() )
{
return 1;
}
else
{
return 0;
}
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:DTSweepPointComparator.java
示例12: uniformGrid
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public static List<TriangulationPoint> uniformGrid( int n, double scale )
{
double x=0;
double size = scale/n;
double halfScale = 0.5*scale;
ArrayList<TriangulationPoint> points = new ArrayList<TriangulationPoint>();
for( int i=0; i<n+1; i++ )
{
x = halfScale - i*size;
for( int j=0; j<n+1; j++ )
{
points.add( new TPoint( x, halfScale - j*size ) );
}
}
return points;
}
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:PointGenerator.java
示例13: pointCW
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public TriangulationPoint pointCW( TriangulationPoint point )
{
if( point == points[0] )
{
return points[2];
}
else if( point == points[1] )
{
return points[0];
}
else if( point == points[2] )
{
return points[1];
}
throw new RuntimeException("[FIXME] point location error");
}
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:17,代码来源:DelaunayTriangle.java
示例14: initExample
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
@Override
protected void initExample()
{
super.initExample();
Mesh mesh = new Mesh();
mesh.setDefaultColor( ColorRGBA.BLUE );
_node.attachChild( mesh );
double scale = 100;
int size = 1000;
int index = (int)(Math.random()*size);
List<TriangulationPoint> points = PointGenerator.uniformDistribution( size, scale );
// Lets add a constraint that cuts the uniformDistribution in half
points.add( new TPoint(0,scale/2) );
points.add( new TPoint(0,-scale/2) );
index = size;
ConstrainedPointSet cps = new ConstrainedPointSet( points, new int[]{ index, index+1 } );
Poly2Tri.triangulate( cps );
ArdorMeshMapper.updateTriangleMesh( mesh, cps );
}
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:24,代码来源:CDTUniformDistributionExample.java
示例15: buildCustom
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
private ConstrainedPointSet buildCustom()
{
ArrayList<TriangulationPoint> list = new ArrayList<TriangulationPoint>(20);
int[] index;
list.add( new TPoint(2.2715518,-4.5233157) );
list.add( new TPoint(3.4446202,-3.5232647) );
list.add( new TPoint(4.7215156,-4.5233157) );
list.add( new TPoint(6.0311967,-3.5232647) );
list.add( new TPoint(3.4446202,-7.2578132) );
list.add( new TPoint(.81390847,-3.5232647) );
index = new int[]{3,5};
return new ConstrainedPointSet( list, index );
}
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:17,代码来源:CDTModelExample.java
示例16: legalize
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
public void legalize( TriangulationPoint oPoint, TriangulationPoint nPoint )
{
if( oPoint == points[0] )
{
points[1] = points[0];
points[0] = points[2];
points[2] = nPoint;
}
else if( oPoint == points[1] )
{
points[2] = points[1];
points[1] = points[0];
points[0] = nPoint;
}
else if( oPoint == points[2] )
{
points[0] = points[2];
points[2] = points[1];
points[1] = nPoint;
}
else
{
throw new RuntimeException("legalization error legalization bug");
}
}
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:26,代码来源:DelaunayTriangle.java
示例17: markNeighbor
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
private void markNeighbor( TriangulationPoint p1,
TriangulationPoint p2,
DelaunayTriangle t )
{
if( ( p1 == points[2] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[2] ) )
{
neighbors[0] = t;
}
else if( ( p1 == points[0] && p2 == points[2] ) || ( p1 == points[2] && p2 == points[0] ) )
{
neighbors[1] = t;
}
else if( ( p1 == points[0] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[0] ) )
{
neighbors[2] = t;
}
else
{
LogUtil.error( "Neighbor error, please report!" );
// throw new Exception("Neighbor error, please report!");
}
}
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:23,代码来源:DelaunayTriangle.java
示例18: pointEvent
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* Find closes node to the left of the new point and
* create a new triangle. If needed new holes and basins
* will be filled to.
*
* @param tcx
* @param point
* @return
*/
private static AdvancingFrontNode pointEvent( DTSweepContext tcx,
TriangulationPoint point )
{
AdvancingFrontNode node,newNode;
node = tcx.locateNode( point );
if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); }
newNode = newFrontTriangle( tcx, point, node );
// Only need to check +epsilon since point never have smaller
// x value than node due to how we fetch nodes from the front
if( point.getX() <= node.point.getX() + EPSILON )
{
fill( tcx, node );
}
tcx.addNode( newNode );
fillAdvancingFront( tcx, newNode );
return newNode;
}
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:30,代码来源:DTSweep.java
示例19: sweep
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* Start sweeping the Y-sorted point set from bottom to top
*
* @param tcx
*/
private static void sweep( DTSweepContext tcx )
{
List<TriangulationPoint> points;
TriangulationPoint point;
AdvancingFrontNode node;
points = tcx.getPoints();
for( int i=1; i<points.size(); i++ )
{
point = points.get(i);
node = pointEvent( tcx, point );
if( point.hasEdges() )
{
for( DTSweepConstraint e : point.getEdges() )
{
if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveConstraint( e ); }
edgeEvent( tcx, e, node );
}
}
tcx.update( null );
}
}
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:31,代码来源:DTSweep.java
示例20: nextFlipPoint
import org.poly2tri.triangulation.TriangulationPoint; //导入依赖的package包/类
/**
* When we need to traverse from one triangle to the next we need
* the point in current triangle that is the opposite point to the next
* triangle.
*
* @param ep
* @param eq
* @param ot
* @param op
* @return
*/
private static TriangulationPoint nextFlipPoint( TriangulationPoint ep,
TriangulationPoint eq,
DelaunayTriangle ot,
TriangulationPoint op )
{
Orientation o2d = orient2d( eq, op, ep );
if( o2d == Orientation.CW )
{
// Right
return ot.pointCCW( op );
}
else if( o2d == Orientation.CCW )
{
// Left
return ot.pointCW( op );
}
else
{
// TODO: implement support for point on constraint edge
throw new PointOnEdgeException("Point on constrained edge not supported yet");
}
}
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:34,代码来源:DTSweep.java
注:本文中的org.poly2tri.triangulation.TriangulationPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论