public class CartesianDistCalc extends AbstractDistanceCalculator
| Constructor and Description |
|---|
CartesianDistCalc() |
CartesianDistCalc(boolean squared) |
| Modifier and Type | Method and Description |
|---|---|
double |
area(Circle circle) |
double |
area(Rectangle rect) |
double |
calcBoxByDistFromPt_yHorizAxisDEG(Point from,
double distDEG,
SpatialContext ctx)
The
Y coordinate of the horizontal axis of a circle that has maximum width. |
Rectangle |
calcBoxByDistFromPt(Point from,
double distDEG,
SpatialContext ctx,
Rectangle reuse)
Calculates the bounding box of a circle, as specified by its center point
and distance.
|
double |
distance(Point from,
double toX,
double toY)
The distance between
from and Point(toX,toY). |
boolean |
equals(Object o) |
int |
hashCode() |
Point |
pointOnBearing(Point from,
double distDEG,
double bearingDEG,
SpatialContext ctx,
Point reuse)
Calculates where a destination point is given an origin (
from)
distance, and bearing (given in degrees -- 0-360). |
boolean |
within(Point from,
double toX,
double toY,
double distance)
Returns true if the distance between from and to is <= distance.
|
distance, toStringpublic CartesianDistCalc()
public CartesianDistCalc(boolean squared)
squared - Set to true to have AbstractDistanceCalculator.distance(com.spatial4j.core.shape.Point, com.spatial4j.core.shape.Point)
return the square of the correct answer. This is a
performance optimization used when sorting in which the
actual distance doesn't matter so long as the sort order is
consistent.public double distance(Point from, double toX, double toY)
DistanceCalculatorfrom and Point(toX,toY).public boolean within(Point from, double toX, double toY, double distance)
DistanceCalculatorwithin in interface DistanceCalculatorwithin in class AbstractDistanceCalculatorpublic Point pointOnBearing(Point from, double distDEG, double bearingDEG, SpatialContext ctx, Point reuse)
DistanceCalculatorfrom)
distance, and bearing (given in degrees -- 0-360). If reuse is given, then
this method may reset() it and return it.public Rectangle calcBoxByDistFromPt(Point from, double distDEG, SpatialContext ctx, Rectangle reuse)
DistanceCalculatorpublic double calcBoxByDistFromPt_yHorizAxisDEG(Point from, double distDEG, SpatialContext ctx)
DistanceCalculatorY coordinate of the horizontal axis of a circle that has maximum width. On a
2D plane, this result is always from.getY() but, perhaps surprisingly, on a sphere
it is going to be slightly different.public double area(Rectangle rect)
public double area(Circle circle)
Copyright © 2025. All rights reserved.