use of javafx.scene.shape.QuadCurveTo in project FXyzLib by Birdasaur.
the class Text3DHelper method getPoints.
private void getPoints(PathElement elem) {
if (elem instanceof MoveTo) {
list = new ArrayList<>();
p0 = new Point3D((float) ((MoveTo) elem).getX(), (float) ((MoveTo) elem).getY(), 0f);
list.add(p0);
} else if (elem instanceof LineTo) {
list.add(new Point3D((float) ((LineTo) elem).getX(), (float) ((LineTo) elem).getY(), 0f));
} else if (elem instanceof CubicCurveTo) {
Point3D ini = (list.size() > 0 ? list.get(list.size() - 1) : p0);
IntStream.rangeClosed(1, POINTS_CURVE).forEach(i -> list.add(evalCubicBezier((CubicCurveTo) elem, ini, ((double) i) / POINTS_CURVE)));
} else if (elem instanceof QuadCurveTo) {
Point3D ini = (list.size() > 0 ? list.get(list.size() - 1) : p0);
IntStream.rangeClosed(1, POINTS_CURVE).forEach(i -> list.add(evalQuadBezier((QuadCurveTo) elem, ini, ((double) i) / POINTS_CURVE)));
} else if (elem instanceof ClosePath) {
list.add(p0);
// stored in a LineSegment: a continuous line that can change direction
if (Math.abs(getArea()) > 0.001) {
LineSegment line = new LineSegment(text);
line.setHole(isHole());
line.setPoints(list);
line.setPath(generatePath());
line.setOrigen(p0);
polis.add(line);
}
}
}
Aggregations