Search in sources :

Example 6 with IBezierCurve

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

the class TestParsingPSbezier method testSimpleBezierCurve.

@Test
public void testSimpleBezierCurve() {
    parser("\\psbezier[linewidth=0.02](1.3918242,0.7584497)(2.0668242,0.95844966)(4.3168244,0.95844966)(4.991824,0.7584497)");
    final IBezierCurve bc = getShapeAt(0);
    assertEquals(bc.getPtAt(0).getY(), bc.getPtAt(1).getY(), 0.001);
    assertEquals(bc.getFirstCtrlPtAt(0).getY(), bc.getFirstCtrlPtAt(1).getY(), 0.001);
    assertFalse(bc.isFilled());
}
Also used : IBezierCurve(net.sf.latexdraw.models.interfaces.shape.IBezierCurve) Test(org.junit.Test)

Example 7 with IBezierCurve

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

the class TestParsingPSbezier method testSimpleBezierCurveOpen.

@Test
public void testSimpleBezierCurveOpen() {
    parser("\\psbezier[linecolor=black, linewidth=0.04](0.014142151,-1.4747834)(0.7212489,-2.1818902)(4.9070354,-1.3818903)(5.614142," + "-0.6747834777832031)(6.321249,0.032323305)(4.2040915,1.8666378)(3.214142,1.7252165)");
    final IBezierCurve bc = getShapeAt(0);
    assertTrue(bc.isOpened());
}
Also used : IBezierCurve(net.sf.latexdraw.models.interfaces.shape.IBezierCurve) Test(org.junit.Test)

Example 8 with IBezierCurve

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

the class TestParsingPSbezier method testParamBarInSqureBracket.

@Test
public void testParamBarInSqureBracket() {
    parser("\\psbezier{|-]}(1,2)(3,4)(5,6)(7,8)");
    final IBezierCurve bc = getShapeAt(0);
    assertEquals(ArrowStyle.BAR_IN, bc.getArrowStyle(0));
    assertEquals(ArrowStyle.RIGHT_SQUARE_BRACKET, bc.getArrowStyle(1));
}
Also used : IBezierCurve(net.sf.latexdraw.models.interfaces.shape.IBezierCurve) Test(org.junit.Test)

Example 9 with IBezierCurve

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

the class TestIBezierCurve method testCopy.

@Test
public void testCopy() {
    final IBezierCurve sh2 = ShapeFactory.INST.createBezierCurve(Collections.emptyList());
    shape.setOpened(sh2.isOpened());
    sh2.setOpened(!sh2.isOpened());
    shape.copy(sh2);
    assertEquals(shape.isOpened(), sh2.isOpened());
}
Also used : IBezierCurve(net.sf.latexdraw.models.interfaces.shape.IBezierCurve) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 10 with IBezierCurve

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

the class TestShapeFactory method testCreateBezierCurveFromSameNewCtrlPoint.

@Test
public void testCreateBezierCurveFromSameNewCtrlPoint() {
    IBezierCurve bc = ShapeFactory.INST.createBezierCurve(Collections.singletonList(ShapeFactory.INST.createPoint()));
    bc = ShapeFactory.INST.createBezierCurveFrom(bc, ShapeFactory.INST.createPoint(1d, 2d));
    assertEqualsDouble(1d, bc.getFirstCtrlPtAt(1).getX());
    assertEqualsDouble(2d + IBezierCurve.DEFAULT_POSITION_CTRL, bc.getFirstCtrlPtAt(1).getY());
}
Also used : IBezierCurve(net.sf.latexdraw.models.interfaces.shape.IBezierCurve) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)28 Test (org.junit.Test)20 HelperTest (net.sf.latexdraw.HelperTest)6 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)5 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)3 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)3 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)3 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 Point2D (javafx.geometry.Point2D)2 MathUtils (net.sf.latexdraw.models.MathUtils)2 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)2 BorderPos (net.sf.latexdraw.models.interfaces.shape.BorderPos)2 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)2 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)2 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)2 IEllipse (net.sf.latexdraw.models.interfaces.shape.IEllipse)2 IGrid (net.sf.latexdraw.models.interfaces.shape.IGrid)2