Search in sources :

Example 1 with Triangle

use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testParse1Coordinates.

@Test
public void testParse1Coordinates() {
    parser("\\pstriangle(35,20)");
    final Triangle tri = getShapeAt(0);
    assertEquals(-35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(0d, tri.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
    assertEquals(20d * Shape.PPC, tri.getHeight(), 0.001);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Example 2 with Triangle

use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testCoordinatesPt.

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

Example 3 with Triangle

use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testGangle.

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

Example 4 with Triangle

use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testCoordinatesMm.

@Test
public void testCoordinatesMm() {
    parser("\\pstriangle(0,0)(350mm,200mm)");
    final Triangle tri = getShapeAt(0);
    assertEquals(-35d / 2d * Shape.PPC, tri.getPosition().getX(), 0.001);
    assertEquals(0d, tri.getPosition().getY(), 0.001);
    assertEquals(35d * Shape.PPC, tri.getWidth(), 0.001);
    assertEquals(20d * Shape.PPC, tri.getHeight(), 0.001);
}
Also used : Triangle(net.sf.latexdraw.model.api.shape.Triangle) Test(org.junit.jupiter.api.Test)

Example 5 with Triangle

use of net.sf.latexdraw.model.api.shape.Triangle in project latexdraw by arnobl.

the class TestParsingPstriangle method testCoordinatesInch.

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

Aggregations

Triangle (net.sf.latexdraw.model.api.shape.Triangle)19 Test (org.junit.jupiter.api.Test)15 HelperTest (net.sf.latexdraw.HelperTest)3 Test (org.junit.Test)3 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 Axes (net.sf.latexdraw.model.api.shape.Axes)1 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)1 CircleArc (net.sf.latexdraw.model.api.shape.CircleArc)1 Dot (net.sf.latexdraw.model.api.shape.Dot)1 Ellipse (net.sf.latexdraw.model.api.shape.Ellipse)1 Freehand (net.sf.latexdraw.model.api.shape.Freehand)1 Grid (net.sf.latexdraw.model.api.shape.Grid)1 Plot (net.sf.latexdraw.model.api.shape.Plot)1 Polygon (net.sf.latexdraw.model.api.shape.Polygon)1 Polyline (net.sf.latexdraw.model.api.shape.Polyline)1 PositionShape (net.sf.latexdraw.model.api.shape.PositionShape)1 RectangularShape (net.sf.latexdraw.model.api.shape.RectangularShape)1 Rhombus (net.sf.latexdraw.model.api.shape.Rhombus)1 Shape (net.sf.latexdraw.model.api.shape.Shape)1