use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.
the class SplitInterpolationTest method testByPoints3.
@Test
public void testByPoints3() throws IOException {
Arc arc = new ArcByPointsImpl(new Coordinate(4, 4), new Coordinate(4, 6), new Coordinate(2, 6));
splitInterpolationTest(arc, 0.1);
}
use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.
the class InterpolationAlgorithm method interpolateArcString.
/**
* Interpolate an arc string.
*
* @param arcs the arc string to interpolate
* @return the interpolated geometry
*/
default LineString interpolateArcString(ArcString arcs) {
List<Coordinate> coords = new ArrayList<>();
List<Arc> arcList = new ArrayList<>(arcs.getArcs());
for (int i = 0; i < arcList.size(); i++) {
Arc arc = arcList.get(i);
LineString interpolated = interpolateArc(arc);
Coordinate[] lineCoords = interpolated.getCoordinates();
int startIndex = 1;
if (i == 0) {
startIndex = 0;
}
for (int j = startIndex; j < lineCoords.length; j++) {
Coordinate coord = lineCoords[j];
coords.add(coord);
}
}
return new InterpolatedLineString(getGeometryFactory().getCoordinateSequenceFactory().create(coords.toArray(new Coordinate[coords.size()])), getGeometryFactory(), arcs);
}
use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.
the class ArcGridSegment method getFirstPart.
@Override
public ArcSegment getFirstPart() {
ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
Angle middleAngle = Angle.fromRadians(byCenter.getStartAngle().getRadians() + 0.5 * byCenter.getAngleBetween().getRadians());
Arc part = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), byCenter.getStartAngle(), middleAngle, byCenter.isClockwise());
// match the parent segment's
return new FixedStartEndGridSegment(part, true, gridSize, getStartPoint(), getMiddlePoint());
}
use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.
the class ArcGridSegment method getSecondPart.
@Override
public ArcSegment getSecondPart() {
ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
Angle middleAngle = Angle.fromRadians(byCenter.getStartAngle().getRadians() + 0.5 * byCenter.getAngleBetween().getRadians());
Arc part = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), middleAngle, byCenter.getEndAngle(), byCenter.isClockwise());
// match the parent segment's
return new FixedStartEndGridSegment(part, true, gridSize, getMiddlePoint(), getEndPoint());
}
use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.
the class ArcSplitSegment method getSecondPart.
@Override
public ArcSegment getSecondPart() {
ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
Angle middleAngle = Angle.fromRadians(byCenter.getStartAngle().getRadians() + 0.5 * byCenter.getAngleBetween().getRadians());
Arc part = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), middleAngle, byCenter.getEndAngle(), byCenter.isClockwise());
return new FixedStartEndSplitSegment(part, maxPositionalError, getMiddlePoint(), getEndPoint());
}
Aggregations