forked from javatutorials101/Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DPolygon.java
31 lines (25 loc) · 699 Bytes
/
DPolygon.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
import java.awt.Color;
import java.awt.Polygon;
public class DPolygon {
Color c;
double[] x, y, z;
public DPolygon(double[] x, double[] y, double[] z, Color c)
{
this.x = x;
this.y = y;
this.z = z;
this.c = c;
createPolygon();
}
void createPolygon()
{
double[] newX = new double[x.length];
double [] newY = new double[x.length];
for(int i = 0; i < x.length; i++)
{
newX[i] = 200 * Calculator.CalculatePositionX(Screen.ViewFrom, Screen.ViewTo, x[i], y[i], z[i]);
newY[i] = 200 * Calculator.CalculatePositionY(Screen.ViewFrom, Screen.ViewTo, x[i], y[i], z[i]);
}
Screen.DrawablePolygons[Screen.NumberOfPolygons] = new PolygonObject(newX, newY, c);
}
}