1
2 package org.freehep.graphicsio;
3
4 import java.io.IOException;
5
6
7
8
9
10
11
12
13 public abstract class QuadToCubicPathConstructor extends
14 AbstractPathConstructor {
15
16 protected QuadToCubicPathConstructor() {
17 super();
18 }
19
20 public void move(double x, double y) throws IOException {
21 currentX = x;
22 currentY = y;
23 }
24
25 public void line(double x, double y) throws IOException {
26 currentX = x;
27 currentY = y;
28 }
29
30 public void quad(double x1, double y1, double x2, double y2)
31 throws IOException {
32 double xctrl1 = x1 + (currentX - x1) / 3.;
33 double yctrl1 = y1 + (currentY - y1) / 3.;
34 double xctrl2 = x1 + (x2 - x1) / 3.;
35 double yctrl2 = y1 + (y2 - y1) / 3.;
36
37 cubic(xctrl1, yctrl1, xctrl2, yctrl2, x2, y2);
38
39 currentX = x2;
40 currentY = y2;
41 }
42
43 public void cubic(double x1, double y1, double x2, double y2, double x3,
44 double y3) throws IOException {
45 currentX = x3;
46 currentY = y3;
47 }
48
49 public void closePath(double x0, double y0) throws IOException {
50 currentX = 0;
51 currentY = 0;
52 }
53 }