Search in sources :

Example 6 with ICircle

use of net.sf.latexdraw.models.interfaces.shape.ICircle in project latexdraw by arnobl.

the class TestParsingPscircle method testCoordinatesRadius.

@Test
public void testCoordinatesRadius() {
    parser("\\pscircle(35,20){10}");
    ICircle cir = getShapeAt(0);
    assertEquals(35d * IShape.PPC - 10d * IShape.PPC, cir.getPosition().getX(), 0.001);
    assertEquals((20d * IShape.PPC - 10d * IShape.PPC) * -1d, cir.getPosition().getY(), 0.001);
    assertEquals(10d * IShape.PPC * 2d, cir.getWidth(), 0.0000001);
    assertEquals(10d * IShape.PPC * 2d, cir.getHeight(), 0.0000001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Example 7 with ICircle

use of net.sf.latexdraw.models.interfaces.shape.ICircle in project latexdraw by arnobl.

the class TestParsingPscircle method testCoordinatesInch.

@Test
public void testCoordinatesInch() {
    parser("\\pscircle(35in,20in){1.2in}");
    ICircle cir = getShapeAt(0);
    assertEquals(35d * IShape.PPC / 2.54 - 1.2 * IShape.PPC / 2.54, cir.getPosition().getX(), 0.001);
    assertEquals((20d * IShape.PPC / 2.54 - 1.2 * IShape.PPC / 2.54) * -1d, cir.getPosition().getY(), 0.001);
    assertEquals(1.2 * IShape.PPC / 2.54 * 2d, cir.getWidth(), 0.0000001);
    assertEquals(1.2 * IShape.PPC / 2.54 * 2d, cir.getHeight(), 0.0000001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Example 8 with ICircle

use of net.sf.latexdraw.models.interfaces.shape.ICircle in project latexdraw by arnobl.

the class TestParsingPscircle method testCoordinatesMm.

@Test
public void testCoordinatesMm() {
    parser("\\pscircle(350mm,200mm){10mm}");
    ICircle cir = getShapeAt(0);
    assertEquals(35d * IShape.PPC - 1d * IShape.PPC, cir.getPosition().getX(), 0.001);
    assertEquals((20d * IShape.PPC - 1d * IShape.PPC) * -1d, cir.getPosition().getY(), 0.001);
    assertEquals(1d * IShape.PPC * 2d, cir.getWidth(), 0.0000001);
    assertEquals(1d * IShape.PPC * 2d, cir.getHeight(), 0.0000001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Example 9 with ICircle

use of net.sf.latexdraw.models.interfaces.shape.ICircle in project latexdraw by arnobl.

the class TestParsingPscircle method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\pscircle(35cm,20cm){.5cm}");
    ICircle cir = getShapeAt(0);
    assertEquals(35d * IShape.PPC - .5 * IShape.PPC, cir.getPosition().getX(), 0.001);
    assertEquals((20d * IShape.PPC - .5 * IShape.PPC) * -1d, cir.getPosition().getY(), 0.001);
    assertEquals(.5 * IShape.PPC * 2d, cir.getWidth(), 0.0000001);
    assertEquals(.5 * IShape.PPC * 2d, cir.getHeight(), 0.0000001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Example 10 with ICircle

use of net.sf.latexdraw.models.interfaces.shape.ICircle in project latexdraw by arnobl.

the class TestParsingPscircle method testFloatSigns.

@Test
public void testFloatSigns() {
    parser("\\pscircle(+++35.5,--50.5){--+12}");
    ICircle cir = getShapeAt(0);
    assertEquals(35.5 * IShape.PPC - 12d * IShape.PPC, cir.getPosition().getX(), 0.001);
    assertEquals((50.5 * IShape.PPC - 12d * IShape.PPC) * -1d, cir.getPosition().getY(), 0.001);
    assertEquals(12d * IShape.PPC * 2d, cir.getWidth(), 0.0000001);
    assertEquals(12d * IShape.PPC * 2d, cir.getHeight(), 0.0000001);
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) Test(org.junit.Test)

Aggregations

ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)23 Test (org.junit.Test)20 HelperTest (net.sf.latexdraw.HelperTest)2 Point2D (javafx.geometry.Point2D)1 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)1 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)1 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)1 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)1 IPlot (net.sf.latexdraw.models.interfaces.shape.IPlot)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)1 IRhombus (net.sf.latexdraw.models.interfaces.shape.IRhombus)1 ISquare (net.sf.latexdraw.models.interfaces.shape.ISquare)1 IText (net.sf.latexdraw.models.interfaces.shape.IText)1 ITriangle (net.sf.latexdraw.models.interfaces.shape.ITriangle)1