Search in sources :

Example 11 with ITriangle

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

the class TestParsingPstriangle method testCoordinatesPt.

@Test
public void testCoordinatesPt() {
    parser("\\pstriangle(0,0)(35pt,20pt)");
    ITriangle tri = getShapeAt(0);
    assertEquals(-35d / 2d * IShape.PPC / PSTricksConstants.CM_VAL_PT, tri.getPosition().getX(), 0.001);
    assertEquals(0d, tri.getPosition().getY(), 0.001);
    assertEquals(35d * IShape.PPC / PSTricksConstants.CM_VAL_PT, tri.getWidth(), 0.001);
    assertEquals(20d * IShape.PPC / PSTricksConstants.CM_VAL_PT, tri.getHeight(), 0.001);
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Example 12 with ITriangle

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

the class TestParsingPstriangle method testCoordinatesInch.

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

Example 13 with ITriangle

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

the class TestParsingPstriangle method testParse2CoordinatesFloatSigns2.

@Test
public void testParse2CoordinatesFloatSigns2() {
    parser("\\pstriangle(-+.5,+-5)(+++35.5,--50.5)");
    ITriangle tri = getShapeAt(0);
    assertEquals(-.5 * IShape.PPC - 35.5 / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(-5d * -IShape.PPC, tri.getPosition().getY(), 0.001);
    assertEquals(35.5 * IShape.PPC, tri.getWidth(), 0.001);
    assertEquals(50.5 * IShape.PPC, tri.getHeight(), 0.001);
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Example 14 with ITriangle

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

the class TestParsingPstriangle method testParse2CoordinatesTwoFirstMissing.

@Test
public void testParse2CoordinatesTwoFirstMissing() {
    parser("\\pstriangle(,)(35,50)");
    ITriangle tri = getShapeAt(0);
    assertEquals(IShape.PPC - 35d / 2d * IShape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(IShape.PPC * -1d, tri.getPosition().getY(), 0.001);
    assertEquals(35d * IShape.PPC, tri.getWidth(), 0.001);
    assertEquals(50d * IShape.PPC, tri.getHeight(), 0.001);
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Example 15 with ITriangle

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

the class TestParsingPstriangle method testGangle.

@Test
public void testGangle() {
    parser("\\pstriangle[gangle=180](2,2)(4,1)");
    ITriangle tri = getShapeAt(0);
    assertEquals(0d, tri.getPosition().getX(), 0.001);
    assertEquals(-1d * IShape.PPC, tri.getPosition().getY(), 0.001);
    assertEquals(4d * IShape.PPC, tri.getWidth(), 0.001);
    assertEquals(1d * IShape.PPC, tri.getHeight(), 0.001);
    assertEquals(Math.toRadians(180d), tri.getRotationAngle(), 0.001);
}
Also used : ITriangle(net.sf.latexdraw.models.interfaces.shape.ITriangle) Test(org.junit.Test)

Aggregations

ITriangle (net.sf.latexdraw.models.interfaces.shape.ITriangle)20 Test (org.junit.Test)18 HelperTest (net.sf.latexdraw.HelperTest)3 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)2 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 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)1 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 IPositionShape (net.sf.latexdraw.models.interfaces.shape.IPositionShape)1 IRectangularShape (net.sf.latexdraw.models.interfaces.shape.IRectangularShape)1 IRhombus (net.sf.latexdraw.models.interfaces.shape.IRhombus)1 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)1