use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class PreparedGeometryThreadSafeTest method setup.
@Override
public void setup() {
final Geometry sinePoly = newSineStar(new PointDoubleXY(0, 0), 100000.0, this.nPts);
this.pg = sinePoly.prepare();
this.g = newSineStar(new PointDoubleXY(10, 10), 100000.0, 100);
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LineStringGenerator method fillArc.
private static void fillArc(final double x, final double dx, final double y, final double dy, final Point[] coords, final GeometryFactory gf) {
if (coords.length == 2) {
throw new IllegalStateException("Too few points for Arc");
}
final double theta = 360 / coords.length;
final double start = theta / 2;
final double radius = dx < dy ? dx / 3 : dy / 3;
// center
final double cx = x + dx / 2;
// center
final double cy = y + dy / 2;
for (int i = 0; i < coords.length; i++) {
final double angle = Math.toRadians(start + theta * i);
// may be neg.
final double fx = Math.sin(angle) * radius;
// may be neg.
final double fy = Math.cos(angle) * radius;
coords[i] = new PointDoubleXY(gf.makePrecise(0, cx + fx), gf.makePrecise(1, cy + fy));
}
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LineStringGenerator method fillHorz.
private static void fillHorz(final double x, final double dx, final double y, final double dy, final Point[] coords, final GeometryFactory gf) {
final double fy = y + Math.random() * dy;
// remainder of x distance
double rx = dx;
coords[0] = new PointDoubleXY(gf.makePrecise(0, x), gf.makePrecise(1, fy));
for (int i = 1; i < coords.length - 1; i++) {
rx -= Math.random() * rx;
coords[i] = new PointDoubleXY(gf.makePrecise(0, x + dx - rx), gf.makePrecise(1, fy));
}
coords[coords.length - 1] = new PointDoubleXY(gf.makePrecise(0, x + dx), gf.makePrecise(1, fy));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LineStringGenerator method fillVert.
private static void fillVert(final double x, final double dx, final double y, final double dy, final Point[] coords, final GeometryFactory gf) {
final double fx = x + Math.random() * dx;
// remainder of y distance
double ry = dy;
coords[0] = new PointDoubleXY(gf.makePrecise(0, fx), gf.makePrecise(1, y));
for (int i = 1; i < coords.length - 1; i++) {
ry -= Math.random() * ry;
coords[i] = new PointDoubleXY(gf.makePrecise(0, fx), gf.makePrecise(1, y + dy - ry));
}
coords[coords.length - 1] = new PointDoubleXY(gf.makePrecise(0, fx), gf.makePrecise(1, y + dy));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class DiscreteHausdorffDistance method computeOrientedDistance.
private void computeOrientedDistance(final Geometry discreteGeom, final Geometry geom, final PointPairDistance ptDist) {
final PointPairDistance maxPtDist = new PointPairDistance();
final PointPairDistance minPtDist = new PointPairDistance();
for (final Vertex vertex : discreteGeom.vertices()) {
minPtDist.initialize();
DistanceToPoint.computeDistance(geom, vertex, minPtDist);
maxPtDist.setMaximum(minPtDist);
}
ptDist.setMaximum(maxPtDist);
if (this.densifyFrac > 0) {
maxPtDist.initialize();
final int numSubSegs = 0;
for (final Segment segment : discreteGeom.segments()) {
final double x1 = segment.getX(0);
final double y1 = segment.getY(0);
final double x2 = segment.getX(1);
final double y2 = segment.getY(1);
final double delx = (x2 - x1) / numSubSegs;
final double dely = (y2 - y1) / numSubSegs;
for (int i = 0; i < numSubSegs; i++) {
final double x = x1 + i * delx;
final double y = y1 + i * dely;
final Point pt = new PointDoubleXY(x, y);
minPtDist.initialize();
DistanceToPoint.computeDistance(geom, pt, minPtDist);
maxPtDist.setMaximum(minPtDist);
}
}
ptDist.setMaximum(maxPtDist);
}
}
Aggregations