本文整理汇总了Java中com.vividsolutions.jts.algorithm.CGAlgorithms.COUNTERCLOCKWISE属性的典型用法代码示例。如果您正苦于以下问题:Java CGAlgorithms.COUNTERCLOCKWISE属性的具体用法?Java CGAlgorithms.COUNTERCLOCKWISE怎么用?Java CGAlgorithms.COUNTERCLOCKWISE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vividsolutions.jts.algorithm.CGAlgorithms
的用法示例。
在下文中一共展示了CGAlgorithms.COUNTERCLOCKWISE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureOrientation
public Coordinate[] ensureOrientation(
final int desiredOrientation, final Coordinate... coord) {
if (coord.length == 0) {
return coord;
}
final int orientation = CGAlgorithms.isCCW(coord) ? CGAlgorithms.COUNTERCLOCKWISE
: CGAlgorithms.CLOCKWISE;
if (orientation != desiredOrientation) {
final Coordinate[] reverse = (Coordinate[]) coord.clone();
reverse(reverse);
return reverse;
}
return coord;
}
示例2: findRightmostEdgeAtVertex
private void findRightmostEdgeAtVertex() {
/**
* The rightmost point is an interior vertex, so it has a segment on either side of it.
* If these segments are both above or below the rightmost point, we need to
* determine their relative orientation to decide which is rightmost.
*/
Coordinate[] pts = this.minDe.getEdge().getCoordinates();
Assert.isTrue(this.minIndex > 0 && this.minIndex < pts.length, "rightmost point expected to be interior vertex of edge");
Coordinate pPrev = pts[this.minIndex - 1];
Coordinate pNext = pts[this.minIndex + 1];
int orientation = CGAlgorithms.computeOrientation(this.minCoord, pNext, pPrev);
boolean usePrev = false;
// both segments are below min point
if (pPrev.y < this.minCoord.y && pNext.y < this.minCoord.y
&& orientation == CGAlgorithms.COUNTERCLOCKWISE) {
usePrev = true;
} else if (pPrev.y > this.minCoord.y && pNext.y > this.minCoord.y
&& orientation == CGAlgorithms.CLOCKWISE) {
usePrev = true;
}
// if both segments are on the same side, do nothing - either is safe
// to select as a rightmost segment
if (usePrev) {
this.minIndex = this.minIndex - 1;
}
}
示例3: findRightmostEdgeAtVertex
private void findRightmostEdgeAtVertex() {
/**
* The rightmost point is an interior vertex, so it has a segment on either side of it.
* If these segments are both above or below the rightmost point, we need to
* determine their relative orientation to decide which is rightmost.
*/
Coordinate[] pts = minDe.getEdge().getCoordinates();
Assert.isTrue(minIndex > 0 && minIndex < pts.length, "rightmost point expected to be interior vertex of edge");
Coordinate pPrev = pts[minIndex - 1];
Coordinate pNext = pts[minIndex + 1];
int orientation = CGAlgorithms.computeOrientation(minCoord, pNext, pPrev);
boolean usePrev = false;
// both segments are below min point
if (pPrev.y < minCoord.y && pNext.y < minCoord.y
&& orientation == CGAlgorithms.COUNTERCLOCKWISE) {
usePrev = true;
} else if (pPrev.y > minCoord.y && pNext.y > minCoord.y
&& orientation == CGAlgorithms.CLOCKWISE) {
usePrev = true;
}
// if both segments are on the same side, do nothing - either is safe
// to select as a rightmost segment
if (usePrev) {
minIndex = minIndex - 1;
}
}
示例4: addNextSegment
public void addNextSegment(Coordinate p, boolean addStartPoint) {
// s0-s1-s2 are the coordinates of the previous segment and the current one
this.s0 = this.s1;
this.s1 = this.s2;
this.s2 = p;
this.seg0.setCoordinates(this.s0, this.s1);
this.computeOffsetSegment(this.seg0, this.side, this.distance, this.offset0);
this.seg1.setCoordinates(this.s1, this.s2);
this.computeOffsetSegment(this.seg1, this.side, this.distance, this.offset1);
// do nothing if points are equal
if (this.s1.equals(this.s2)) {
return;
}
int orientation = CGAlgorithms.computeOrientation(this.s0, this.s1, this.s2);
boolean outsideTurn =
(orientation == CGAlgorithms.CLOCKWISE && this.side == Position.LEFT)
|| (orientation == CGAlgorithms.COUNTERCLOCKWISE && this.side == Position.RIGHT);
if (orientation == 0) { // lines are collinear
this.addCollinear(addStartPoint);
} else if (outsideTurn) {
this.addOutsideTurn(orientation, addStartPoint);
} else { // inside turn
this.addInsideTurn(orientation, addStartPoint);
}
}
示例5: addNextSegment
public void addNextSegment(Coordinate p, boolean addStartPoint)
{
// s0-s1-s2 are the coordinates of the previous segment and the current one
s0 = s1;
s1 = s2;
s2 = p;
seg0.setCoordinates(s0, s1);
computeOffsetSegment(seg0, side, distance, offset0);
seg1.setCoordinates(s1, s2);
computeOffsetSegment(seg1, side, distance, offset1);
// do nothing if points are equal
if (s1.equals(s2)) return;
int orientation = CGAlgorithms.computeOrientation(s0, s1, s2);
boolean outsideTurn =
(orientation == CGAlgorithms.CLOCKWISE && side == Position.LEFT)
|| (orientation == CGAlgorithms.COUNTERCLOCKWISE && side == Position.RIGHT);
if (orientation == 0) { // lines are collinear
addCollinear(addStartPoint);
}
else if (outsideTurn)
{
addOutsideTurn(orientation, addStartPoint);
}
else { // inside turn
addInsideTurn(orientation, addStartPoint);
}
}