Java Code Examples for javafx.scene.shape.CubicCurveTo#getX()
The following examples show how to use
javafx.scene.shape.CubicCurveTo#getX() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Text3DHelper.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private Point3D evalCubicBezier(CubicCurveTo c, Point3D ini, double t){ Point3D p=new Point3D((float)(Math.pow(1-t,3)*ini.x+ 3*t*Math.pow(1-t,2)*c.getControlX1()+ 3*(1-t)*t*t*c.getControlX2()+ Math.pow(t, 3)*c.getX()), (float)(Math.pow(1-t,3)*ini.y+ 3*t*Math.pow(1-t, 2)*c.getControlY1()+ 3*(1-t)*t*t*c.getControlY2()+ Math.pow(t, 3)*c.getY()), 0f); return p; }
Example 2
Source File: Shape2Geometry.java From gef with Eclipse Public License 2.0 | 4 votes |
/** * Converts the given JavaFX {@link Path} to a * {@link org.eclipse.gef.geometry.planar.Path}. * * @param path * The JavaFX {@link Path} to convert. * @return The newly created {@link org.eclipse.gef.geometry.planar.Path} * that describes the given {@link Path}. */ public static final org.eclipse.gef.geometry.planar.Path toPath( Path path) { ObservableList<PathElement> elements = path.getElements(); org.eclipse.gef.geometry.planar.Path.Segment[] segments = new org.eclipse.gef.geometry.planar.Path.Segment[elements .size()]; for (int i = 0; i < segments.length; i++) { PathElement element = elements.get(i); if (element instanceof MoveTo) { MoveTo moveTo = (MoveTo) element; segments[i] = new Segment(Segment.MOVE_TO, new Point(moveTo.getX(), moveTo.getY())); } else if (element instanceof LineTo) { LineTo lineTo = (LineTo) element; segments[i] = new Segment(Segment.LINE_TO, new Point(lineTo.getX(), lineTo.getY())); } else if (element instanceof QuadCurveTo) { QuadCurveTo quadTo = (QuadCurveTo) element; segments[i] = new Segment(Segment.QUAD_TO, new Point(quadTo.getControlX(), quadTo.getControlY()), new Point(quadTo.getX(), quadTo.getY())); } else if (element instanceof CubicCurveTo) { CubicCurveTo cubicTo = (CubicCurveTo) element; segments[i] = new Segment(Segment.CUBIC_TO, new Point(cubicTo.getControlX1(), cubicTo.getControlY1()), new Point(cubicTo.getControlX2(), cubicTo.getControlY2()), new Point(cubicTo.getX(), cubicTo.getY())); } else if (element instanceof ClosePath) { segments[i] = new Segment(Segment.CLOSE); } } int windingRule = path.getFillRule() == FillRule.EVEN_ODD ? org.eclipse.gef.geometry.planar.Path.WIND_EVEN_ODD : org.eclipse.gef.geometry.planar.Path.WIND_NON_ZERO; return new org.eclipse.gef.geometry.planar.Path(windingRule, segments); }
Example 3
Source File: JFXToSVG.java From latexdraw with GNU General Public License v3.0 | 4 votes |
public SVGPathSegCurvetoCubic createSVGPathSegCurvetoCubic(final CubicCurveTo elt) { return new SVGPathSegCurvetoCubic(elt.getX(), elt.getY(), elt.getControlX1(), elt.getControlY1(), elt.getControlX2(), elt.getControlY2(), !elt.isAbsolute()); }