Java Reference
In-Depth Information
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;
/**
* @author Jim
*/
public class MeshCube extends Application {
double anchorX, anchorY;
private static final float EDGE_LENGTH = 380;
private double anchorAngleX = 0;
private double anchorAngleY = 0;
private final DoubleProperty angleX = new SimpleDoubleProperty(25);
private final DoubleProperty angleY = new SimpleDoubleProperty(40);
PerspectiveCamera camera = new PerspectiveCamera(false);
static TriangleMesh createMesh(float w, float h, float d) {
if (w * h * d == 0) {
return null;
}
float hw = w / 2f;
float hh = h / 2f;
float hd = d / 2f;
float x0 = 0f;
float x1 = 1f / 4f;
float x2 = 2f / 4f;
float x3 = 3f / 4f;
float x4 = 1f;
float y0 = 0f;
float y1 = 1f / 3f;
float y2 = 2f / 3f;
float y3 = 1f;
TriangleMesh mesh = new TriangleMesh();
mesh.getPoints().addAll(
hw, hh, hd, //point A
hw, hh, -hd, //point B
hw, -hh, hd, //point C
hw, -hh, -hd, //point D
-hw, hh, hd, //point E
-hw, hh, -hd, //point F
-hw, -hh, hd, //point G
-hw, -hh, -hd //point H
);
Search WWH ::




Custom Search