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

example.shapes.PathTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loop() 0 4 1
A main(String[]) 0 2 1
A setup() 0 11 1
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