A set of functions for working with geometries.
More...
A set of functions for working with geometries.
Definition at line 16 of file GeometryUtils.java.
◆ distanceBetweenGlobalPoints()
| static float com.navigine.idl.java.GeometryUtils.distanceBetweenGlobalPoints |
( |
GlobalPoint | from, |
|
|
GlobalPoint | to ) |
|
inlinestatic |
Get distance between GPS points.
- Parameters
-
- Returns
- distance in meters
Java code snippet:
double globalDistance = GeometryUtils.distanceBetweenGlobalPoints(globalPoint1, globalPoint2);
System.out.printf("Distance between Moscow and St. Petersburg: %.2f meters%n", globalDistance);
Kotlin code snippet:
// Calculate distance between global points
val globalDistance = GeometryUtils.distanceBetweenGlobalPoints(globalPoint1, globalPoint2)
println("Distance between Moscow and St. Petersburg: ${"%.2f".format(globalDistance)} meters")
Definition at line 32 of file GeometryUtils.java.
◆ distanceBetweenPoints()
| static float com.navigine.idl.java.GeometryUtils.distanceBetweenPoints |
( |
Point | from, |
|
|
Point | to ) |
|
inlinestatic |
Get distance between points.
- Parameters
-
| from | start point of calculation Point |
| to | end point of calculation Point |
- Returns
- distance in meters
Java code snippet:
double distance = GeometryUtils.distanceBetweenPoints(point1, point2);
System.out.printf("Distance between P1 and P2: %.2f meters%n", distance);
Kotlin code snippet:
// Calculate distance between points
val distance = GeometryUtils.distanceBetweenPoints(point1, point2)
println("Distance between P1 and P2: ${"%.2f".format(distance)} meters")
Definition at line 53 of file GeometryUtils.java.
◆ divisionRatioBySegment()
| static float com.navigine.idl.java.GeometryUtils.divisionRatioBySegment |
( |
Segment | segment1, |
|
|
Segment | segment2 ) |
|
inlinestatic |
Calculate the division ratio of a segment by a given segment(if intersects)
- Parameters
-
| segment1 | first segment of calculation Segment |
| segment2 | second segment of calculation Segment |
- Returns
- division ratio
Java code snippet:
double divisionRatio = GeometryUtils.divisionRatioBySegment(segment1, segment2);
System.out.printf("Division ratio: %.2f%n", divisionRatio);
Kotlin code snippet:
// Calculate division ratio
val divisionRatio = GeometryUtils.divisionRatioBySegment(segment1, segment2)
println("Division ratio: ${"%.2f".format(divisionRatio)}")
Definition at line 215 of file GeometryUtils.java.
◆ getProjectionRatio()
| static double com.navigine.idl.java.GeometryUtils.getProjectionRatio |
( |
Segment | segment, |
|
|
Point | point ) |
|
inlinestatic |
Calculate the division ratio of a segment by a given point Calculate projection point on a segment.
- Parameters
-
| segment | segment of calculation Segment |
| point | point of calculation Point |
- Returns
- division ratio
Java code snippet:
double projectionRatio = GeometryUtils.getProjectionRatio(segment1, testPoint);
System.out.printf("Projection ratio: %.2f%n", projectionRatio);
Kotlin code snippet:
// Calculate projection ratio
val projectionRatio = GeometryUtils.getProjectionRatio(segment1, testPoint)
println("Projection ratio: ${"%.2f".format(projectionRatio)}")
Definition at line 258 of file GeometryUtils.java.
◆ getRatioPoint()
| static Point com.navigine.idl.java.GeometryUtils.getRatioPoint |
( |
Segment | segment, |
|
|
double | r ) |
|
inlinestatic |
Calculate projection point on a segment.
- Parameters
-
| segment | segment of calculation Segment |
| r | division ratio |
- Returns
- ratio point Point
Java code snippet:
double ratio = 0.5;
Point ratioPoint = GeometryUtils.getRatioPoint(segment1, ratio);
System.out.printf("Point at ratio %.1f: (%.2f, %.2f)%n", ratio, ratioPoint.getX(), ratioPoint.getY());
Kotlin code snippet:
// Get point at specific ratio
val ratio = 0.5
val ratioPoint = GeometryUtils.getRatioPoint(segment1, ratio)
println("Point at ratio $ratio: (${"%.2f".format(ratioPoint.x)}, ${"%.2f".format(ratioPoint.y)})")
Definition at line 236 of file GeometryUtils.java.
◆ polygonArea()
| static float com.navigine.idl.java.GeometryUtils.polygonArea |
( |
Polygon | polygon | ) |
|
|
inlinestatic |
Get polygon area.
- Parameters
-
| polygon | polygon object for calculation Polygon |
- Returns
- area in meters
Java code snippet:
double area = GeometryUtils.polygonArea(polygon);
System.out.printf("Polygon area: %.2f square meters%n", area);
Kotlin code snippet:
// Calculate polygon area
val area = GeometryUtils.polygonArea(polygon)
println("Polygon area: ${"%.2f".format(area)} square meters")
Definition at line 92 of file GeometryUtils.java.
◆ polygonCenter()
| static Point com.navigine.idl.java.GeometryUtils.polygonCenter |
( |
Polygon | polygon | ) |
|
|
inlinestatic |
Get polygon geometric center.
- Parameters
-
| polygon | polygon object for calculation Polygon |
- Returns
- center point Point
Java code snippet:
Point center = GeometryUtils.polygonCenter(polygon);
System.out.printf("Polygon center: (%.2f, %.2f)%n", center.getX(), center.getY());
Kotlin code snippet:
// Calculate polygon center
val center = GeometryUtils.polygonCenter(polygon)
println("Polygon center: (${"%.2f".format(center.x)}, ${"%.2f".format(center.y)})")
Definition at line 111 of file GeometryUtils.java.
◆ polygonContainsPoint()
| static boolean com.navigine.idl.java.GeometryUtils.polygonContainsPoint |
( |
Polygon | polygon, |
|
|
Point | point ) |
|
inlinestatic |
Checks that polygon contains point.
- Parameters
-
| polygon | polygon object in which looking for contents Polygon |
| point | checking point object Point |
- Returns
- contains or not
Java code snippet:
Point insidePoint = new Point(5.0, 5.0);
Point outsidePoint = new Point(15.0, 15.0);
boolean containsInside = GeometryUtils.polygonContainsPoint(polygon, insidePoint);
boolean containsOutside = GeometryUtils.polygonContainsPoint(polygon, outsidePoint);
System.out.println("Polygon contains inside point: " + containsInside);
System.out.println("Polygon contains outside point: " + containsOutside);
Kotlin code snippet:
// Check if polygon contains point
val insidePoint = Point(5.0, 5.0)
val outsidePoint = Point(15.0, 15.0)
val containsInside = GeometryUtils.polygonContainsPoint(polygon, insidePoint)
val containsOutside = GeometryUtils.polygonContainsPoint(polygon, outsidePoint)
println("Polygon contains inside point: $containsInside")
println("Polygon contains outside point: $containsOutside")
Definition at line 131 of file GeometryUtils.java.
◆ segmentIntersectionSegment()
| static Point com.navigine.idl.java.GeometryUtils.segmentIntersectionSegment |
( |
Segment | segment1, |
|
|
Segment | segment2 ) |
|
inlinestatic |
Calculate the intersection point of two segments.
- Parameters
-
| segment1 | first segment of calculation Segment |
| segment2 | second segment of calculation Segment |
- Returns
- intersection point Point
Java code snippet:
Point intersection = GeometryUtils.segmentIntersectionSegment(segment1, segment2);
System.out.printf("Intersection point: (%.2f, %.2f)%n", intersection.getX(), intersection.getY());
Kotlin code snippet:
// Calculate intersection point
val intersection = GeometryUtils.segmentIntersectionSegment(segment1, segment2)
println("Intersection point: (${"%.2f".format(intersection.x)}, ${"%.2f".format(intersection.y)})")
Definition at line 194 of file GeometryUtils.java.
◆ segmentIntersectsSegment()
| static boolean com.navigine.idl.java.GeometryUtils.segmentIntersectsSegment |
( |
Segment | segment1, |
|
|
Segment | segment2 ) |
|
inlinestatic |
Checks the intersection of two segments.
- Parameters
-
| segment1 | first segment of calculation Segment |
| segment2 | second segment of calculation Segment |
- Returns
- intersects or not
Java code snippet:
boolean intersects = GeometryUtils.segmentIntersectsSegment(segment1, segment2);
System.out.println("Segments intersect: " + intersects);
Kotlin code snippet:
// Check if segments intersect
val intersects = GeometryUtils.segmentIntersectsSegment(segment1, segment2)
println("Segments intersect: $intersects")
Definition at line 173 of file GeometryUtils.java.
◆ segmentLength()
| static float com.navigine.idl.java.GeometryUtils.segmentLength |
( |
Segment | segment | ) |
|
|
inlinestatic |
Get length of segment.
- Parameters
-
| segment | segment object for calculation Segment |
- Returns
- length in meters
Java code snippet:
double length1 = GeometryUtils.segmentLength(segment1);
double length2 = GeometryUtils.segmentLength(segment2);
System.out.printf("Segment1 length: %.2f meters%n", length1);
System.out.printf("Segment2 length: %.2f meters%n", length2);
Kotlin code snippet:
// Calculate segment length
val length1 = GeometryUtils.segmentLength(segment1)
val length2 = GeometryUtils.segmentLength(segment2)
println("Segment1 length: ${"%.2f".format(length1)} meters")
println("Segment2 length: ${"%.2f".format(length2)} meters")
Definition at line 73 of file GeometryUtils.java.
◆ segmentPointDistance()
| static float com.navigine.idl.java.GeometryUtils.segmentPointDistance |
( |
Segment | segment, |
|
|
Point | point ) |
|
inlinestatic |
Get distance from segment to point.
- Parameters
-
| segment | start segment of calculation Segment |
| point | end point of calculation Point |
- Returns
- distance in meters
Java code snippet:
double distanceToPoint = GeometryUtils.segmentPointDistance(segment1, testPoint);
System.out.printf("Distance from segment1 to test point: %.2f meters%n", distanceToPoint);
Kotlin code snippet:
// Calculate distance from segment to point
val distanceToPoint = GeometryUtils.segmentPointDistance(segment1, testPoint)
println("Distance from segment1 to test point: ${"%.2f".format(distanceToPoint)} meters")
Definition at line 152 of file GeometryUtils.java.
The documentation for this class was generated from the following file: