这里写目录标题
版本
org.locationtech.jts:jts-core:1.19.0
链接: github
代码
java
public static void main(String[] args) {
OrientationUse orientationUse = new OrientationUse();
orientationUse.test02();
}
public void test02() {
A = new Coordinate(2, 1);
B = new Coordinate(2, 2.5);
C = new Coordinate(3, 4);
int index = Orientation.index(A, B, C);
LOGGER.info("index: {}", index);
// 17:32:49.033 [main] INFO pers.stu.algorithm.AngleUse - index: -1
}
java
public static void main(String[] args) {
OrientationUse orientationUse = new OrientationUse();
orientationUse.test00();
}
public void test00() {
A = new Coordinate(2, 1);
B = new Coordinate(2, 2.5);
C = new Coordinate(2, 4);
int index = Orientation.index(A, B, C);
LOGGER.info("index: {}", index);
// 17:25:11.618 [main] INFO pers.stu.algorithm.AngleUse - index: 0
}
java
public static void main(String[] args) {
OrientationUse orientationUse = new OrientationUse();
orientationUse.test01();
}
public void test01() {
A = new Coordinate(2, 1);
B = new Coordinate(2, 2.5);
C = new Coordinate(1, 4);
int index = Orientation.index(A, B, C);
LOGGER.info("index: {}", index);
// 17:32:49.033 [main] INFO pers.stu.algorithm.AngleUse - index: 1
}
java
public static void main(String[] args) {
OrientationUse orientationUse = new OrientationUse();
orientationUse.test04();
}
public void test04() {
GeometryFactory geometryFactory = new GeometryFactory();
Coordinate[] coordinates1 = new Coordinate[] {new Coordinate(1, 4), new Coordinate(1, 1.5), new Coordinate(4.5, 1.5), new Coordinate(4.5, 4),new Coordinate(1, 4)};
// 是否是逆时针的环:true
Coordinate[] coordinates2 = new Coordinate[] {new Coordinate(1, 4), new Coordinate(4.5, 4), new Coordinate(4.5, 1.5), new Coordinate(1, 1.5),new Coordinate(1, 4)};
// 是否是逆时针的环:false
LOGGER.info("是否是逆时针的环:{}", Orientation.isCCW(coordinates2));
}