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