-
Notifications
You must be signed in to change notification settings - Fork 0
/
AxialStar.java
67 lines (61 loc) · 2.05 KB
/
AxialStar.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.awt.Color;
/**
* The original AxialStar model.
*
* @author Justin C
*/
public class AxialStar extends AnimatedModel
{
public static final Color[] colorsAxial =
{ Color.green, Color.red, Color.blue, Color.magenta, Color.yellow, Color.orange };
/**
* Constructs an AxialStar.
*
* @param d
* 6d is the length from the center of the star to one of its tips.
*/
public AxialStar(Vec3 o, boolean s, double d)
{
super(o, s, 20, 128);
// length of a star point, from center to tip
double l = 8 * d;
// width of a star point, from center to edge
double w = 2 * d;
// gap between parts of a star point
double g = d / 10;
double[][] coords = {
{ 0, 0, +l, +d, +g, +w, +g, +d, +w },
{ 0, 0, -l, +d, +g, -w, +g, +d, -w },
{ 0, +l, 0, +d, +w, +g, +g, +w, +d },
{ 0, -l, 0, +d, -w, +g, +g, -w, +d },
{ +l, 0, 0, +w, +d, +g, +w, +g, +d },
{ -l, 0, 0, -w, +d, +g, -w, +g, +d },
{ 0, 0, +l, -d, -g, +w, -g, -d, +w },
{ 0, 0, -l, -d, -g, -w, -g, -d, -w },
{ 0, +l, 0, -d, +w, -g, -g, +w, -d },
{ 0, -l, 0, -d, -w, -g, -g, -w, -d },
{ +l, 0, 0, +w, -d, -g, +w, -g, -d },
{ -l, 0, 0, -w, -d, -g, -w, -g, -d },
{ 0, 0, +l, +d, -g, +w, +g, -d, +w },
{ 0, 0, -l, +d, -g, -w, +g, -d, -w },
{ 0, +l, 0, +d, +w, -g, +g, +w, -d },
{ 0, -l, 0, +d, -w, -g, +g, -w, -d },
{ +l, 0, 0, +w, +d, -g, +w, +g, -d },
{ -l, 0, 0, -w, +d, -g, -w, +g, -d },
{ 0, 0, +l, -d, +g, +w, -g, +d, +w },
{ 0, 0, -l, -d, +g, -w, -g, +d, -w },
{ 0, +l, 0, -d, +w, +g, -g, +w, +d },
{ 0, -l, 0, -d, -w, +g, -g, -w, +d },
{ +l, 0, 0, +w, -d, +g, +w, -g, +d },
{ -l, 0, 0, -w, -d, +g, -w, -g, +d }
};
for (int i = 0; i < 24; i++)
tris.add(new Triangle(coords[i], colorsAxial[i % 6]));
}
public void tick() {
super.tick();
rX = Rotation.rX;
rY = Rotation.rY;
rZ = Rotation.rZ;
}
}