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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations