public class Circle
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
Circle.Arc
An arc, or circle segment
|
| Modifier and Type | Field and Description |
|---|---|
private org.locationtech.jts.geom.Coordinate |
center |
private org.locationtech.jts.geom.PrecisionModel |
precisionModel |
private double |
radius |
private static double |
TWO_PI |
| Modifier | Constructor and Description |
|---|---|
protected |
Circle()
Creates a circle whose center is at the origin and whose radius is 0.
|
|
Circle(org.locationtech.jts.geom.Coordinate point1,
org.locationtech.jts.geom.Coordinate point2,
org.locationtech.jts.geom.Coordinate point3)
Three point method of circle construction.
|
|
Circle(org.locationtech.jts.geom.Coordinate center,
double radius)
Create a circle with a defined center and radius
|
|
Circle(double xCenter,
double yCenter,
double radius)
Create a circle using the x/y coordinates for the center.
|
|
Circle(double xLeft,
double yUpper,
double xRight,
double yLower)
Creates a circle based on bounding box.
|
|
Circle(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Three point method of circle construction.
|
| Modifier and Type | Method and Description |
|---|---|
Circle.Arc |
createArc(org.locationtech.jts.geom.Coordinate p1,
org.locationtech.jts.geom.Coordinate p2,
org.locationtech.jts.geom.Coordinate p3)
Creates an arc through the specified points
|
double |
distanceFromCenter(org.locationtech.jts.geom.Coordinate p)
Returns the distance the point is from the center of the circle
|
boolean |
equals(java.lang.Object o) |
double |
getAngle(org.locationtech.jts.geom.Coordinate p)
Returns the angle of the point from the center and the horizontal line
from the center.
|
org.locationtech.jts.geom.Coordinate |
getCenter() |
org.locationtech.jts.geom.Coordinate |
getPoint(double angle)
Returns the coordinate on the circle at the specified angle
|
double |
getRadius() |
int |
hashCode() |
private void |
initThreePointCircle(org.locationtech.jts.geom.Coordinate p1,
org.locationtech.jts.geom.Coordinate p2,
org.locationtech.jts.geom.Coordinate p3)
Defines the circle based on three points.
|
org.locationtech.jts.geom.Coordinate[] |
linearizeArc(org.locationtech.jts.geom.Coordinate p1,
org.locationtech.jts.geom.Coordinate p2,
org.locationtech.jts.geom.Coordinate p3,
double tolerence)
Given 2 points defining an arc on the circle, interpolates the circle
into a collection of points that provide connected chords that
approximate the arc based on the tolerance value.
|
static org.locationtech.jts.geom.Coordinate[] |
linearizeArc(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Given 2 points defining an arc on the circle, interpolates the circle
into a collection of points that provide connected chords that
approximate the arc based on the tolerance value.
|
static org.locationtech.jts.geom.Coordinate[] |
linearizeArc(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double tolerence)
Given 2 points defining an arc on the circle, interpolates the circle
into a collection of points that provide connected chords that
approximate the arc based on the tolerance value.
|
static org.locationtech.jts.geom.Coordinate[] |
linearizeCircle(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Given a circle defined by the 3 points, creates a linearized
interpolation of the circle starting and ending on the first coordinate.
|
private java.util.List<org.locationtech.jts.geom.Coordinate> |
linearizeInternal(java.util.List<org.locationtech.jts.geom.Coordinate> coordinates,
Circle.Arc arc,
double tolerence) |
void |
move(double x,
double y)
Moves the circle to a new center
|
static double |
normalizeAngle(double angle)
Returns an angle between 0 and 2*PI.
|
void |
shift(double deltaX,
double deltaY)
Shifts the center of the circle by delta X and delta Y
|
static double |
subtractAngles(double a1,
double a2)
Returns the angle between the angles a1 and a2 in radians.
|
java.lang.String |
toString() |
private static final double TWO_PI
private org.locationtech.jts.geom.Coordinate center
private double radius
private org.locationtech.jts.geom.PrecisionModel precisionModel
protected Circle()
public Circle(org.locationtech.jts.geom.Coordinate center,
double radius)
center - The coordinate representing the center of the circleradius - The radius of the circlepublic Circle(double xCenter,
double yCenter,
double radius)
xCenter - The x coordinate of the circle's centeryCenter - The y coordinate of the circle's centerradius - the radius of the circlepublic Circle(double xLeft,
double yUpper,
double xRight,
double yLower)
xLeft - The leftmost x coordinateyUpper - The uppermost y coordinatexRight - The rightmost x coordinateyLower - The lowest y coordinatepublic Circle(org.locationtech.jts.geom.Coordinate point1,
org.locationtech.jts.geom.Coordinate point2,
org.locationtech.jts.geom.Coordinate point3)
point1 - The first pointpoint2 - The second pointpoint3 - The third pointpublic Circle(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
x1 - The x coordinate of the first pointy1 - The y coordinate of the first pointx2 - The x coordinate of the second pointy2 - The y coordinate of the second pointx3 - The x coordinate of the third pointy3 - The y coordinate of the third pointpublic static org.locationtech.jts.geom.Coordinate[] linearizeArc(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double tolerence)
x1 - x coordinate of point 1y1 - y coordinate of point 1x2 - x coordinate of point 2y2 - y coordinate of point 2x3 - x coordinate of point 3y3 - y coordinate of point 3tolerence - maximum distance between the center of the chord and the outer
edge of the circlepublic static org.locationtech.jts.geom.Coordinate[] linearizeArc(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
x1 - x coordinate of point 1y1 - y coordinate of point 1x2 - x coordinate of point 2y2 - y coordinate of point 2x3 - x coordinate of point 3y3 - y coordinate of point 3public static org.locationtech.jts.geom.Coordinate[] linearizeCircle(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
x1 - x coordinate of point 1y1 - y coordinate of point 1x2 - x coordinate of point 2y2 - y coordinate of point 2x3 - x coordinate of point 3y3 - y coordinate of point 3public static double normalizeAngle(double angle)
angle - an angle in radians to normalizepublic static double subtractAngles(double a1,
double a2)
a1 - first anglea2 - second anglepublic void shift(double deltaX,
double deltaY)
deltaX - The shift along the X-coordinate axisdeltaY - The shift along the Y-coordinate axispublic void move(double x,
double y)
x - The x coordinate of the new centery - The y coordinate of the new centerprivate void initThreePointCircle(org.locationtech.jts.geom.Coordinate p1,
org.locationtech.jts.geom.Coordinate p2,
org.locationtech.jts.geom.Coordinate p3)
p1 - A point on the desired circlep2 - A point on the desired circlep3 - A point on the desired circlepublic org.locationtech.jts.geom.Coordinate getCenter()
public double getRadius()
public org.locationtech.jts.geom.Coordinate[] linearizeArc(org.locationtech.jts.geom.Coordinate p1,
org.locationtech.jts.geom.Coordinate p2,
org.locationtech.jts.geom.Coordinate p3,
double tolerence)
p1 - begin coordinate of the arcp2 - any other point on the arcp3 - end coordinate of the arctolerence - maximum distance between the center of the chord and the outer
edge of the circleprivate java.util.List<org.locationtech.jts.geom.Coordinate> linearizeInternal(java.util.List<org.locationtech.jts.geom.Coordinate> coordinates,
Circle.Arc arc,
double tolerence)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic double getAngle(org.locationtech.jts.geom.Coordinate p)
p - a point in spacepublic org.locationtech.jts.geom.Coordinate getPoint(double angle)
angle - The anglepublic double distanceFromCenter(org.locationtech.jts.geom.Coordinate p)
p - A point in spacepublic Circle.Arc createArc(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)
p1 - The first pointp2 - The second pointp3 - The third pointArc through the three points