package kinectintruderalarm;

import java.awt.Color;

public class Assignment01 {

    public static void main(String args[]) {
        Assignment01 asg01 = new Assignment01();
    }

    public Assignment01() {
        // Create an output frame
        KinectOutputLIGHT ko = new KinectOutputLIGHT();
        ko.depthXYZ.setViewParameters(45, 55, 1500);

        // mainloop: read data, analyze and display
        for (int i = 0; i < 70; i++) {
            // read data
            String filename = "DATA/DepthFile" + i + ".txt";
            int[][] data = KinectTCPClientLIGHT.readDepthFileTo2DArray(filename);

            // analyze
            double distance = computeAverageDistance(data);
            if (distance < 2500.0) {
                KoDepthPanelLIGHT.backgroundColor = new Color(100, 0, 0);
            } else {
                KoDepthPanelLIGHT.backgroundColor = Color.BLACK;
            }

            // display
            ko.displayDepthXYZ(data);
        }
    }

    // This function has to be replaced by your solution!!!
    public double computeAverageDistance(int[][] data) {
        double dist = 10000.0;
        return (dist);
    }
}
