-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar.pde
More file actions
45 lines (41 loc) · 1.03 KB
/
Star.pde
File metadata and controls
45 lines (41 loc) · 1.03 KB
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
class Star
{
int hab;
String starName;
float distance;
float xg, yg, zg;
float absMag;
int clickFlag;
Star(int hab, String starName, float distance, float xg, float yg, float zg, float absMag)
{
this.hab = hab;
this.starName = starName;
this.distance = distance;
this.xg = xg;
this.yg = yg;
this.zg = zg;
this.absMag = absMag;
this.clickFlag = 0;
}
//To string method
String toString()
{
return hab + "\t" + starName + "\t" + distance + "\t" + xg + "\t" + yg + "\t" + zg + "\t" + absMag;
}
//Draw star method
void drawStar()
{
float mappedxg = map(this.xg, -5, 5, 50, width-50);
float mappedyg = this.yg = map(this.yg, -5, 5, 50, height-50);
stroke(250, 255, 3);
line(mappedxg-4,mappedyg,mappedxg+4,mappedyg);
line(mappedxg,mappedyg-4,mappedxg,mappedyg+4);
stroke(255, 0, 0);
ellipse(mappedxg, mappedyg, 12, 12);
fill(255);
textSize(10);
textAlign(LEFT, CENTER);
text(this.starName, mappedxg+10, mappedyg);
noFill();
}
}