import java.awt.Color; import java.awt.Graphics; /** * Tesseract represents a 4D Hypercube centered at the * origin and going one unit in each 16-hyperoctant. * * @author Chris Thiel, ofmCap * @version Nov 24, 2024 * * Using the notation & formulas of A.R. Forsyth's * Geometry of Four Dimensions * Cambridge University Press, 1930 * https://archive.org/details/geometryoffourdi032760mbp/ * */ public class Tesseract { private Point[] v; private Edge[] e; private int width, height, size; private Color color; public Tesseract(int width, int height, int size, Color c) { this.width = width; this.height = height; this.size = size; this.color = c; initNodesAndEdges(); } public void initNodesAndEdges() { v = new Point[16]; int j = 0; for(int x0=-1; x0<=1; x0 +=2) for(int y0=-1; y0<=1; y0 +=2) for(int z0=-1; z0<=1; z0 +=2) for(int v0=-1; v0<=1; v0 +=2) { v[j] = new Point(x0, y0, z0, v0); j++; } int[][] connect = { { 0, 1}, { 0, 2}, { 0, 4}, { 0, 8}, { 1, 3}, { 1, 5}, { 1, 9}, { 2, 3}, { 2, 6}, { 2,10}, { 3, 7}, { 3,11}, { 4, 5}, { 4, 6}, { 4,12}, { 5, 7}, { 5,13}, { 6,14}, { 7, 6}, { 7,15}, { 8, 9}, { 8,10}, { 8,12}, { 9,11}, { 9,13}, {10,11}, {10,14}, {11,15}, {12,13}, {12,14}, {13,15}, {14,15} }; e = new Edge[4*8]; for(int i=0; i