#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "synch.h"

void testGVector(int max) {
  vector_t* traj;
  vector_t* sequence;
  printf("running gvector test...\n");

  sequence = getGlobalVectorSequence(max);
  traj = getTrajectoryFromGlobalVectors(max, sequence);
  printTrajectory(stdout, max,traj);

  free(sequence);
  free(traj);
}

void testCentroid(int max) {
  float a,b,c,d;
  vector_t* traj;
  printf("running centroid test...\n");
  traj = getCentroidSequence(max);
  getTrajectoryParameters(max, traj, &a, &b, &c, &d);

  printTrajectory(stderr,max,traj);
  printCurve(stderr,max, traj, a, b, c, d);

  free(traj);
}

void testCardboard(int max) {
  model_t* modelSeq;
  printf("running cardboard test...\n");
  modelSeq = getCardboardSequence(max);
  printModels(max, modelSeq);
  free(modelSeq);
}


int main(int argc, char** argv) {
  int max = MAX_SYNCH_FRAME;
  //DISABLED FOR NOW: computeMotionFlow(max);

  if (argc == 2) {
    if (!strcmp(argv[1], "gvector")) {
      testGVector(max);
    } else if (!strcmp(argv[1], "centroid")) {
      testCentroid(max);
    } else if (!strcmp(argv[1], "cardboard")) {
      testCardboard(max);
    }
  } else if (argc == 1) {
    testCardboard(max);
  } else {
    printf("idiot!\n");
  }

  return 0;
}
