本文整理汇总了Java中org.poly2tri.triangulation.TriangulationPoint.getX方法的典型用法代码示例。如果您正苦于以下问题:Java TriangulationPoint.getX方法的具体用法?Java TriangulationPoint.getX怎么用?Java TriangulationPoint.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.poly2tri.triangulation.TriangulationPoint
的用法示例。
在下文中一共展示了TriangulationPoint.getX方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
}
}
示例3: angle
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
/**
*
* @param node - middle node
* @return the angle between p-a and p-b in range [-pi,pi]
*/
private static double angle( TriangulationPoint p,
TriangulationPoint a,
TriangulationPoint b )
{
// XXX: do we really need a signed angle for holeAngle?
// could possible save some cycles here
/* Complex plane
* ab = cosA +i*sinA
* ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx)
* atan2(y,x) computes the principal value of the argument function
* applied to the complex number x+iy
* Where x = ax*bx + ay*by
* y = ax*by - ay*bx
*/
final double px = p.getX();
final double py = p.getY();
final double ax = a.getX() - px;
final double ay = a.getY() - py;
final double bx = b.getX() - px;
final double by = b.getY() - py;
return Math.atan2( ax*by - ay*bx, ax*bx + ay*by );
}
示例4: 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;
}
示例5: angle
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
/**
*
* @param node - middle node
* @return the angle between p-a and p-b in range [-pi,pi]
*/
private static double angle( TriangulationPoint p,
TriangulationPoint a,
TriangulationPoint b )
{
// XXX: do we really need a signed angle for holeAngle?
// could possible save some cycles here
/* Complex plane
* ab = cosA +i*sinA
* ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx)
* atan2(y,x) computes the principal value of the argument function
* applied to the complex number x+iy
* Where x = ax*bx + ay*by
* y = ax*by - ay*bx
*/
final double px = p.getX();
final double py = p.getY();
final double ax = a.getX() - px;
final double ay = a.getY() - py;
final double bx = b.getX() - px;
final double by = b.getY() - py;
return Math.atan2( ax*by - ay*bx, ax*bx + ay*by );
}
示例6: DTSweepConstraint
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
/**
* Give two points in any order. Will always be ordered so
* that q.y > p.y and q.x > p.x if same y value
*
* @param p1
* @param p2
*/
public DTSweepConstraint( TriangulationPoint p1, TriangulationPoint p2 )
// throws DuplicatePointException
{
p = p1;
q = p2;
if( p1.getY() > p2.getY() )
{
q = p1;
p = p2;
}
else if( p1.getY() == p2.getY() )
{
if( p1.getX() > p2.getX() )
{
q = p1;
p = p2;
}
else if( p1.getX() == p2.getX() )
{
logger.info( "Failed to create constraint {}={}", p1, p2 );
// throw new DuplicatePointException( p1 + "=" + p2 );
// return;
}
}
q.addEdge(this);
}
示例7: prepareTriangulation
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
@Override
public void prepareTriangulation( Triangulatable t )
{
super.prepareTriangulation( t );
double xmax, xmin;
double ymax, ymin;
xmax = xmin = _points.get(0).getX();
ymax = ymin = _points.get(0).getY();
// Calculate bounds. Should be combined with the sorting
for( TriangulationPoint p : _points )
{
if( p.getX() > xmax )
xmax = p.getX();
if( p.getX() < xmin )
xmin = p.getX();
if( p.getY() > ymax )
ymax = p.getY();
if( p.getY() < ymin )
ymin = p.getY();
}
double deltaX = ALPHA * ( xmax - xmin );
double deltaY = ALPHA * ( ymax - ymin );
TPoint p1 = new TPoint( xmax + deltaX, ymin - deltaY );
TPoint p2 = new TPoint( xmin - deltaX, ymin - deltaY );
setHead( p1 );
setTail( p2 );
// long time = System.nanoTime();
// Sort the points along y-axis
Collections.sort( _points, _comparator );
// logger.info( "Triangulation setup [{}ms]", ( System.nanoTime() - time ) / 1e6 );
}
示例8: transform
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
public void transform( TriangulationPoint p, TriangulationPoint store )
{
double x,y,z;
double a,b,c;
a = PI_div180*p.getY();
b = PI_div180*p.getX();
c = _radius*Math.cos( a );
x = c*Math.cos( b );
y = c*Math.sin( b );
z = _radius*Math.sin( a );
store.set( x, y, z );
}
示例9: DTSweepConstraint
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
/**
* Give two points in any order. Will always be ordered so
* that q.y > p.y and q.x > p.x if same y value
*
* @param p1
* @param p2
*/
public DTSweepConstraint( TriangulationPoint p1, TriangulationPoint p2 )
// throws DuplicatePointException
{
p = p1;
q = p2;
if( p1.getY() > p2.getY() )
{
q = p1;
p = p2;
}
else if( p1.getY() == p2.getY() )
{
if( p1.getX() > p2.getX() )
{
q = p1;
p = p2;
}
else if( p1.getX() == p2.getX() )
{
LogUtil.info( "Failed to create constraint {}={}", p1, p2 );
// throw new DuplicatePointException( p1 + "=" + p2 );
// return;
}
}
q.addEdge(this);
}
示例10: locatePoint
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
/**
* This implementation will use simple node traversal algorithm to find
* a point on the front
*
* @param point
* @return
*/
public AdvancingFrontNode locatePoint( final TriangulationPoint point )
{
final double px = point.getX();
AdvancingFrontNode node = findSearchNode(px);
final double nx = node.point.getX();
if( px == nx )
{
if( point != node.point )
{
// We might have two nodes with same x value for a short time
if( point == node.prev.point )
{
node = node.prev;
}
else if( point == node.next.point )
{
node = node.next;
}
else
{
throw new RuntimeException( "Failed to find Node for given afront point");
// node = null;
}
}
}
else if( px < nx )
{
while( (node = node.prev) != null )
{
if( point == node.point )
{
break;
}
}
}
else
{
while( (node = node.next) != null )
{
if( point == node.point )
{
break;
}
}
}
search = node;
return node;
}
示例11: AdvancingFrontNode
import org.poly2tri.triangulation.TriangulationPoint; //导入方法依赖的package包/类
public AdvancingFrontNode( TriangulationPoint point )
{
this.point = point;
value = point.getX();
key = Double.valueOf( value ); // XXX: BST
}