use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestPicture method testGetTopRightPoint.
@Test
public void testGetTopRightPoint() {
final Point pt = shape.getTopRightPoint();
assertEquals(shape.getPosition().getX() + shape.getImage().getWidth(), pt.getX(), 0.001);
assertEquals(shape.getPosition().getY(), pt.getY(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestPicture method testMirroV.
@Test
public void testMirroV() {
shape.setPosition(10d, 20d);
final Point gc = shape.getGravityCentre();
shape.mirrorVertical(5d);
assertEquals(gc.verticalSymmetry(5d), shape.getGravityCentre());
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestPoint method testSubstractKO.
@Test
public void testSubstractKO() {
pt.setPoint(10d, 11d);
final Point p = pt.substract(null);
assertThat(p.getX()).isEqualTo(10d, within(0.00001d));
assertThat(p.getY()).isEqualTo(11d, within(0.00001d));
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestPoint method testHorizontalSymmetrySame.
@Test
public void testHorizontalSymmetrySame() {
pt.setPoint(10d, 20d);
final Point sym = pt.horizontalSymmetry(10d);
assertEqualsDouble(pt.getY(), sym.getY());
assertEqualsDouble(10d, sym.getX());
}
use of net.sf.latexdraw.model.api.shape.Point in project latexdraw by arnobl.
the class TestControlPointShapeBase method setRotationAngle.
@Theory
public void setRotationAngle(@CtrlShapeData final ControlPointShape sh) {
sh.translate(100d, 120d);
final Point pt = sh.getGravityCentre();
final double angle = Math.PI / 2d;
List<Point> ctrlPts1 = cloneList(sh.getFirstCtrlPts(), p -> ShapeFactory.INST.createPoint(p));
List<Point> ctrlPts2 = cloneList(sh.getSecondCtrlPts(), p -> ShapeFactory.INST.createPoint(p));
sh.setRotationAngle(angle);
ctrlPts1 = ctrlPts1.stream().map(p -> p.rotatePoint(pt, angle)).collect(Collectors.toList());
ctrlPts2 = ctrlPts2.stream().map(p -> p.rotatePoint(pt, angle)).collect(Collectors.toList());
assertEquals(ctrlPts1, sh.getFirstCtrlPts());
assertEquals(ctrlPts2, sh.getSecondCtrlPts());
}
Aggregations