#include "DPPTUPoint.h"
#include <math.h>

DPPTUPoint::DPPTUPoint(const char* device, int ncs_timeout, int ncs_vtime) :
  DPPTU(device, ncs_timeout, ncs_vtime)
{
  // nothing else to do
}

DPPTUPoint::~DPPTUPoint(void)
{
  // nothing to do;
}

int DPPTUPoint::get_x(double z)
{
  /*
  cout << "pan step " << get_pan_step_position() << endl;
  cout << ", tilt step " << get_tilt_step_position() << endl;
  */
    return 0;
}

int DPPTUPoint::get_y(double z)
{
    return 0;
}

// using coord system 
bool DPPTUPoint::point_at(double x, double y, double z)
{
  double r;
  double pan_angle;
  double tilt_angle;
  bool rv = false;
  r = sqrt(pow(z, 2) + pow(x, 2));
  pan_angle = 180/M_PI * atan2(x, z);
  tilt_angle = 180/M_PI * atan2(y, r);
  if (pan_to(pan_angle)&&tilt_to(tilt_angle))
    rv = true;

  return rv;
}
