Loading...
Searching...
No Matches
com.navigine.idl.java.GeometryUtils Class Referenceabstract

A set of functions for working with geometries. More...

Static Public Member Functions

static float distanceBetweenGlobalPoints (GlobalPoint from, GlobalPoint to)
 Get distance between GPS points.
 
static float distanceBetweenPoints (Point from, Point to)
 Get distance between points.
 
static float segmentLength (Segment segment)
 Get length of segment.
 
static float polygonArea (Polygon polygon)
 Get polygon area.
 
static Point polygonCenter (Polygon polygon)
 Get polygon geometric center.
 
static boolean polygonContainsPoint (Polygon polygon, Point point)
 Checks that polygon contains point.
 
static float segmentPointDistance (Segment segment, Point point)
 Get distance from segment to point.
 
static boolean segmentIntersectsSegment (Segment segment1, Segment segment2)
 Checks the intersection of two segments.
 
static Point segmentIntersectionSegment (Segment segment1, Segment segment2)
 Calculate the intersection point of two segments.
 
static float divisionRatioBySegment (Segment segment1, Segment segment2)
 Calculate the division ratio of a segment by a given segment(if intersects)
 
static Point getRatioPoint (Segment segment, double r)
 Calculate projection point on a segment.
 
static double getProjectionRatio (Segment segment, Point point)
 Calculate the division ratio of a segment by a given point Calculate projection point on a segment.
 

Detailed Description

A set of functions for working with geometries.

Definition at line 16 of file GeometryUtils.java.

Member Function Documentation

◆ distanceBetweenGlobalPoints()

static float com.navigine.idl.java.GeometryUtils.distanceBetweenGlobalPoints ( GlobalPoint from,
GlobalPoint to )
inlinestatic

Get distance between GPS points.

Parameters
fromstart point of calculation GlobalPoint
toend point of calculation GlobalPoint
Returns
distance in meters

Java code snippet:

// Calculate distance between global points
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
fromstart point of calculation Point
toend point of calculation Point
Returns
distance in meters

Java code snippet:

// Calculate distance between points
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
segment1first segment of calculation Segment
segment2second segment of calculation Segment
Returns
division ratio

Java code snippet:

// Calculate division ratio
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
segmentsegment of calculation Segment
pointpoint of calculation Point
Returns
division ratio

Java code snippet:

// Calculate projection ratio
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
segmentsegment of calculation Segment
rdivision ratio
Returns
ratio point Point

Java code snippet:

// Get point at specific ratio
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
polygonpolygon object for calculation Polygon
Returns
area in meters

Java code snippet:

// Calculate polygon area
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
polygonpolygon object for calculation Polygon
Returns
center point Point

Java code snippet:

// Calculate polygon center
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
polygonpolygon object in which looking for contents Polygon
pointchecking point object Point
Returns
contains or not

Java code snippet:

// Check if polygon contains point
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
segment1first segment of calculation Segment
segment2second segment of calculation Segment
Returns
intersection point Point

Java code snippet:

// Calculate intersection point
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
segment1first segment of calculation Segment
segment2second segment of calculation Segment
Returns
intersects or not

Java code snippet:

// Check if segments intersect
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
segmentsegment object for calculation Segment
Returns
length in meters

Java code snippet:

// Calculate segment length
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
segmentstart segment of calculation Segment
pointend point of calculation Point
Returns
distance in meters

Java code snippet:

// Calculate distance from segment to point
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: