use of eu.esdihumboldt.util.geometry.interpolation.model.ArcByPoints in project hale by halestudio.
the class ArcByPointsImplTest method testNotOrigin.
@Test
public void testNotOrigin() throws IOException {
ArcByPoints arc = new ArcByPointsImpl(new Coordinate(-2, 1), new Coordinate(-1, 2), new Coordinate(0, 1));
drawArcWithMarkers(arc);
assertFalse(arc.isCircle());
assertFalse(InterpolationUtil.isStraightLine(arc));
ArcByCenterPoint converted = arc.toArcByCenterPoint();
assertEqualsCoord(new Coordinate(-1, 1), converted.getCenterPoint());
assertEquals(1.0, converted.getRadius(), 1e-10);
assertEquals(Angle.fromDegrees(180), converted.getStartAngle());
assertEquals(Angle.fromDegrees(0), converted.getEndAngle());
assertEquals(Angle.fromDegrees(-180), converted.getAngleBetween());
assertTrue(converted.isClockwise());
}
use of eu.esdihumboldt.util.geometry.interpolation.model.ArcByPoints in project hale by halestudio.
the class ArcByCenterPointImplTest method testCW2.
@Test
public void testCW2() throws IOException {
ArcByCenterPoint arc = new ArcByCenterPointImpl(new Coordinate(0, 0), Math.sqrt(2.0), Angle.fromDegrees(45), Angle.fromDegrees(135), true);
drawArcWithMarkers(arc);
assertEquals(-270.0, arc.getAngleBetween().getDegrees(), 1e-10);
assertFalse(arc.isCircle());
assertFalse(InterpolationUtil.isStraightLine(arc));
ArcByPoints converted = arc.toArcByPoints();
assertEqualsCoord(new Coordinate(1, 1), converted.getStartPoint());
assertEqualsCoord(new Coordinate(0, -Math.sqrt(2.0)), converted.getMiddlePoint());
assertEqualsCoord(new Coordinate(-1, 1), converted.getEndPoint());
}
use of eu.esdihumboldt.util.geometry.interpolation.model.ArcByPoints in project hale by halestudio.
the class ArcByCenterPointImplTest method testCCW1.
@Test
public void testCCW1() throws IOException {
ArcByCenterPoint arc = new ArcByCenterPointImpl(new Coordinate(0, 0), 1.0, Angle.fromDegrees(0), Angle.fromDegrees(180), false);
drawArcWithMarkers(arc);
assertEquals(180.0, arc.getAngleBetween().getDegrees(), 1e-10);
assertFalse(arc.isCircle());
assertFalse(InterpolationUtil.isStraightLine(arc));
ArcByPoints converted = arc.toArcByPoints();
assertEqualsCoord(new Coordinate(1, 0), converted.getStartPoint());
assertEqualsCoord(new Coordinate(0, 1), converted.getMiddlePoint());
assertEqualsCoord(new Coordinate(-1, 0), converted.getEndPoint());
}
use of eu.esdihumboldt.util.geometry.interpolation.model.ArcByPoints in project hale by halestudio.
the class ArcByCenterPointImplTest method testCCW2.
@Test
public void testCCW2() throws IOException {
ArcByCenterPoint arc = new ArcByCenterPointImpl(new Coordinate(0, 0), Math.sqrt(2.0), Angle.fromDegrees(45), Angle.fromDegrees(135), false);
drawArcWithMarkers(arc);
assertEquals(90.0, arc.getAngleBetween().getDegrees(), 1e-10);
assertFalse(arc.isCircle());
assertFalse(InterpolationUtil.isStraightLine(arc));
ArcByPoints converted = arc.toArcByPoints();
assertEqualsCoord(new Coordinate(1, 1), converted.getStartPoint());
assertEqualsCoord(new Coordinate(0, Math.sqrt(2.0)), converted.getMiddlePoint());
assertEqualsCoord(new Coordinate(-1, 1), converted.getEndPoint());
}
use of eu.esdihumboldt.util.geometry.interpolation.model.ArcByPoints in project hale by halestudio.
the class ArcByPointsImplTest method testLargeArc.
@Test
public void testLargeArc() throws IOException {
ArcByPoints arc = new ArcByPointsImpl(new Coordinate(1, 1), new Coordinate(0, -Math.sqrt(2.0)), new Coordinate(-1, 1));
drawArcWithMarkers(arc);
assertFalse(arc.isCircle());
assertFalse(InterpolationUtil.isStraightLine(arc));
ArcByCenterPoint converted = arc.toArcByCenterPoint();
assertEqualsCoord(new Coordinate(0, 0), converted.getCenterPoint());
assertEquals(Math.sqrt(2.0), converted.getRadius(), 1e-10);
assertEquals(Angle.fromDegrees(45), converted.getStartAngle());
assertEquals(Angle.fromDegrees(135), converted.getEndAngle());
assertEquals(Angle.fromDegrees(-270), converted.getAngleBetween());
assertTrue(converted.isClockwise());
}
Aggregations