use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testSimpleBezierCurveClose.
@Test
public void testSimpleBezierCurveClose() {
parser("\\psbezier[linecolor=black, linewidth=0.04](0.10361466,-0.36860093)(0.76211923,-1.1211777)(7.561873,-1.9049373)(8.503614," + "-1.5686009216308594)(9.445356,-1.2322645)(6.693564,1.4899777)(5.7036147,1.631399)(4.713665,1.7728205)(-0.55489,0.38397577)(0.10361466," + "-0.36860093)");
final IBezierCurve bc = getShapeAt(0);
assertFalse(bc.isOpened());
}
use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testParse10Coordinates.
@Test
public void testParse10Coordinates() {
parser("\\psbezier(5,10)(1,2)(3,4)(5,6)(7,8)(9,10)(11,12)(13,14)(15,16)(17,18)");
final IBezierCurve bc = getShapeAt(0);
assertEquals(4, bc.getNbPoints());
assertEquals(5d * IShape.PPC, bc.getPtAt(0).getX(), 0.0001);
assertEquals(-10d * IShape.PPC, bc.getPtAt(0).getY(), 0.0001);
assertEquals(5d * IShape.PPC, bc.getPtAt(1).getX(), 0.0001);
assertEquals(-6d * IShape.PPC, bc.getPtAt(1).getY(), 0.0001);
assertEquals(11d * IShape.PPC, bc.getPtAt(2).getX(), 0.0001);
assertEquals(-12d * IShape.PPC, bc.getPtAt(2).getY(), 0.0001);
assertEquals(17d * IShape.PPC, bc.getPtAt(3).getX(), 0.0001);
assertEquals(-18d * IShape.PPC, bc.getPtAt(3).getY(), 0.0001);
assertEquals(9d * IShape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
assertEquals(-18d * IShape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
assertEquals(7d * IShape.PPC, bc.getSecondCtrlPtAt(1).getX(), 0.0001);
assertEquals(-8d * IShape.PPC, bc.getSecondCtrlPtAt(1).getY(), 0.0001);
assertEquals(13d * IShape.PPC, bc.getSecondCtrlPtAt(2).getX(), 0.0001);
assertEquals(-14d * IShape.PPC, bc.getSecondCtrlPtAt(2).getY(), 0.0001);
assertEquals(3d * IShape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
assertEquals(-4d * IShape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
assertEquals(9d * IShape.PPC, bc.getFirstCtrlPtAt(2).getX(), 0.0001);
assertEquals(-10d * IShape.PPC, bc.getFirstCtrlPtAt(2).getY(), 0.0001);
assertEquals(15d * IShape.PPC, bc.getFirstCtrlPtAt(3).getX(), 0.0001);
assertEquals(-16d * IShape.PPC, bc.getFirstCtrlPtAt(3).getY(), 0.0001);
}
use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testParse9Coordinates.
@Test
public void testParse9Coordinates() {
parser("\\psbezier(1,2)(3,4)(5,6)(7,8)(9,10)(11,12)(13,14)(15,16)(17,18)");
final IBezierCurve bc = getShapeAt(0);
assertEquals(4, bc.getNbPoints());
assertEquals(0d, bc.getPtAt(0).getX(), 0.0001);
assertEquals(0d, bc.getPtAt(0).getY(), 0.0001);
assertEquals(5d * IShape.PPC, bc.getPtAt(1).getX(), 0.0001);
assertEquals(-6d * IShape.PPC, bc.getPtAt(1).getY(), 0.0001);
assertEquals(11d * IShape.PPC, bc.getPtAt(2).getX(), 0.0001);
assertEquals(-12d * IShape.PPC, bc.getPtAt(2).getY(), 0.0001);
assertEquals(17d * IShape.PPC, bc.getPtAt(3).getX(), 0.0001);
assertEquals(-18d * IShape.PPC, bc.getPtAt(3).getY(), 0.0001);
assertEquals(-1d * IShape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
assertEquals(2d * IShape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
assertEquals(7d * IShape.PPC, bc.getSecondCtrlPtAt(1).getX(), 0.0001);
assertEquals(-8d * IShape.PPC, bc.getSecondCtrlPtAt(1).getY(), 0.0001);
assertEquals(13d * IShape.PPC, bc.getSecondCtrlPtAt(2).getX(), 0.0001);
assertEquals(-14d * IShape.PPC, bc.getSecondCtrlPtAt(2).getY(), 0.0001);
assertEquals(3d * IShape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
assertEquals(-4d * IShape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
assertEquals(9d * IShape.PPC, bc.getFirstCtrlPtAt(2).getX(), 0.0001);
assertEquals(-10d * IShape.PPC, bc.getFirstCtrlPtAt(2).getY(), 0.0001);
assertEquals(15d * IShape.PPC, bc.getFirstCtrlPtAt(3).getX(), 0.0001);
assertEquals(-16d * IShape.PPC, bc.getFirstCtrlPtAt(3).getY(), 0.0001);
}
Aggregations