io.ytcode:geometry

A geometry library for Java

License

License

Categories

Categories

Geo Business Logic Libraries Geospatial
GroupId

GroupId

io.ytcode
ArtifactId

ArtifactId

geometry
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

io.ytcode:geometry
A geometry library for Java
Project URL

Project URL

https://github.com/wangyuntao/geometry
Source Code Management

Source Code Management

https://github.com/wangyuntao/geometry

Download geometry

How to add to project

<!-- https://jarcasting.com/artifacts/io.ytcode/geometry/ -->
<dependency>
    <groupId>io.ytcode</groupId>
    <artifactId>geometry</artifactId>
    <version>0.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.ytcode/geometry/
implementation 'io.ytcode:geometry:0.4.0'
// https://jarcasting.com/artifacts/io.ytcode/geometry/
implementation ("io.ytcode:geometry:0.4.0")
'io.ytcode:geometry:jar:0.4.0'
<dependency org="io.ytcode" name="geometry" rev="0.4.0">
  <artifact name="geometry" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.ytcode', module='geometry', version='0.4.0')
)
libraryDependencies += "io.ytcode" % "geometry" % "0.4.0"
[io.ytcode/geometry "0.4.0"]

Dependencies

test (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.3.1

Project Modules

There are no modules declared in this project.

Geometry

Implementations of geometry algorithms in Java.

Maven Release Javadocs

Usage

// Basics
int angle = Angle.getDegrees(0, 0, 100, 100);
System.out.println("Angle.getDegrees: " + angle);

angle = Angle.getAngularDistanceByRotatingCounterclockwise(angle, 0);
System.out.println("Angle.getAngularDistanceByRotatingCounterclockwise: " + angle);

long p = Point.rotateCounterclockwise(0, 0, 100, 100, angle);
System.out.println("Point.rotateCounterclockwise: " + Point.getX(p) + "-" + Point.getY(p));

// Point
boolean b = Point.isInsideCircle(0, 0, 100, 50, 50);
System.out.println("Point.isInsideCircle: " + b);

b = Point.isInsideRectangle(0, 0, 200, 100, 45, 10, 10);
System.out.println("Point.isInsideRectangle: " + b);

b = Point.isInsidePolygon(new int[] {-50, 50, 0}, new int[] {0, 0, 100}, 10, 10);
System.out.println("Point.isInsidePolygon: " + b);

// Circle
b = Circle.intersectsCircle(0, 0, 10, 30, 0, 20);
System.out.println("Circle.intersectsCircle: " + b);

b = Circle.intersectsRectangle(0, 0, 100, 50, 45, 10, 10, 50);
System.out.println("Circle.intersectsRectangle: " + b);

// Polygon
Polygon polygon =
    Polygon.from(new int[] {0, 50, 100, 0, -100, -50}, new int[] {0, -50, 0, 50, 0, -50});
b = polygon.intersectsCircle(0, 0, 45, 0, 0, 10);
System.out.println("Polygon.intersectsCircle: " + b);

// For more details, see APIs, tests and visual demos

Screenshots

Point.isInsideRectangle

Image of AStar

Point.isInsidePolygon

Image of AStar

Circle.intersectsRectangle

Image of AStar

Polygon.intersectsCircle

Image of AStar

Versions

Version
0.4.0
0.3.0
0.2.0
0.1.0
0.0.1