Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 43 lines (30 sloc) 1.059 kb
1083e78 @cibomahto put blinkeylights array, dome into their own classes.
cibomahto authored
1
2 class BlinkeyLights {
3 ArrayList<BlinkeyLight> blinkeyLights;
4
5 BlinkeyLights( int radius_, int strips_, int lights_per_strip_) {
6 blinkeyLights = new ArrayList<BlinkeyLight>();
7
8 radius_ = radius_ * 10;
9
e2fc527 @cibomahto Receive UDP data correctly, yeah!
cibomahto authored
10 for (int light = lights_per_strip_ -1; light > 0; light--) {
11 for (int strip = 0; strip < strips_; strip++) {
12
1083e78 @cibomahto put blinkeylights array, dome into their own classes.
cibomahto authored
13
14 float inclination = HALF_PI + (HALF_PI)*((float)light/lights_per_strip_);
15 float azimuth = (2*PI)*((float)strip/strips_);
16
17 float x = radius_ * cos(azimuth) * sin(inclination);
18 float z = radius_ * sin(azimuth) * sin(inclination);
19 float y = radius_ * cos(inclination);
20
21 blinkeyLights.add(new BlinkeyLight(x, y, z));
22 }
23 }
24 }
25
26 int size() {
27 return blinkeyLights.size();
28 }
29
31fdb32 @cibomahto Add an update-from-array method to BlinkeyLights
cibomahto authored
30 void update(color[] imageData) {
31 for (int i = 0; i < blinkeyLights.size(); i++) {
32 blinkeyLights.get(i).setColor(imageData[i]);
33 }
1083e78 @cibomahto put blinkeylights array, dome into their own classes.
cibomahto authored
34 }
35
36 void draw() {
37 for (int i = 0; i < blinkeyLights.size(); i++) {
38 (blinkeyLights.get(i)).draw();
39 }
40 }
41 }
31fdb32 @cibomahto Add an update-from-array method to BlinkeyLights
cibomahto authored
42
Something went wrong with that request. Please try again.