Passed
Push — master ( dd7741...68adbd )
by Seth
04:41
created

example.shapes.PathTest.setup()   A

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
dl 0
loc 11
rs 9.85
1
package example.shapes;
2
3
import org.gannacademy.cdf.graphics.geom.Path;
4
5
public class PathTest extends ShapeTest {
6
7
    protected double dTheta;
8
9
    @Override
10
    protected void setup() {
11
        super.setup();
12
        Path path = new Path(getDrawingPanel());
13
        path.moveTo(width, height);
14
        path.lineTo(width, height * 2);
15
        path.curveTo(width * 2, height * 2, width, height, width * 2, height);
16
        path.quadTo(width, height * 2, width * 2, height * 2);
17
        path.closePath();
18
        shape = path;
19
        dTheta = Math.PI / 180.0;
20
    }
21
22
    @Override
23
    protected void loop() {
24
        ((Path) shape).rotate(dTheta, shape.getX() + shape.getWidth() / 2.0, shape.getY() + shape.getHeight() / 2.0);
25
        super.loop();
26
    }
27
28
    public static void main(String[] args) {
29
        new PathTest();
30
    }
31
}
32