import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; /** * This will Rotate a Red-Cyan Anaglyph * in an orthogonal projection * of a tesseract * * @author Chris Thiel, ofmCap * @version November 25, 2026 * */ public class OrthoGraph extends JPanel implements ActionListener { public static int WIDTH=800; public static int HEIGHT=620; public static int SIZE=80; public static int DELTA=640; // fraction of PI for angle change private Tesseract t, t2; private Timer timer; private int steps; public OrthoGraph() { t = new Tesseract(WIDTH, HEIGHT, SIZE, Color.CYAN); t2 = new Tesseract(WIDTH, HEIGHT, SIZE, new Color(255,0,0)); t2.move(Math.PI/64); timer = new Timer(10,this); timer.start(); steps = 0; } public void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(Color.WHITE); g.fillRect(0, 0, WIDTH, HEIGHT); g.setColor(Color.BLACK); g.drawString("Orthographic Tesseract", 30, 30); t.draw(g); //g.fillRect( 30, 30, 30,30); t2.draw(g); //g.fillRect( 60, 30, 30,30); } public static void main(String[] args) { OrthoGraph app = new OrthoGraph(); JFrame window = new JFrame("Orthographic Tesseract"); window.setSize(WIDTH, HEIGHT); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(app); window.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { double unit = Math.PI/DELTA; double a = unit; steps++; if (steps >= 2 * DELTA) { steps = 0; t.initNodesAndEdges(); t2.initNodesAndEdges(); t2.move(Math.PI/64); } t.move(a); t2.move(a); repaint(); } }