package a3test.a3objects;

import jp.sourceforge.acerola3d.a3.*;
import java.awt.*;
import java.awt.event.*;

public class ArcTest {
    static Frame frame;
    public static void main(String args[]) throws Exception {
        frame = new Frame("ArcTest");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) {
                frame.dispose();
                System.exit(0);
            }
        });
        A3Canvas canvas = A3Canvas.createA3Canvas(300,300);
        frame.add(canvas);
        frame.pack();
        frame.setVisible(true);

        A3Arc arc = new A3Arc();
        arc.setHead(0.0,0.0,0.0);
        arc.setTail(1.0,1.0,1.0);
        arc.setLabel("ArcTest");
        canvas.add(arc);
        canvas.setCameraLocImmediately(0.0,0.0,5.0);
        double theta=0.0;
        while (true) {
            try{Thread.sleep(100);}catch(Exception e){;}
            arc.setLoc(Math.cos(theta),Math.sin(theta),-theta);
            arc.setHead( Math.cos(4.0*theta), Math.sin(4.0*theta),0.0);
            arc.setTail(-Math.cos(4.0*theta),-Math.sin(4.0*theta),0.0);
            theta = theta + 0.1;
        }
    }
}
