LDCad 1.6 suggestions/plans


Re: LDCad 1.6 ROTSTEP feedback
Roland Melkert Wrote:Also does anyone know the best/easiest way to extract the angles from an existing rotation matrix?
I think I solved this, but if anyone knows a better method...

Code:
void TLDStepMetaLine::getRotStepAngles(const TGLMatrixd &matrix, double &x, double  &y, double &z, const int roundTo) {

  x=atan2(matrix.array2D[2][1], matrix.array2D[2][2]);

  const double c2=sqrt(SQR(matrix.array2D[0][0])+SQR(matrix.array2D[1][0]));
  y=atan2(-matrix.array2D[2][0], c2);

  const double s1=sin(x);
  const double c1=cos(x);
  z=atan2(s1*matrix.array2D[0][2]-c1*matrix.array2D[0][1], c1*matrix.array2D[1][1]-s1*matrix.array2D[1][2]);

  //allemaal neg nav de sign flips in de ROTSTEP spec.
  x=-rad2Deg(x);
  y=-rad2Deg(y);
  z=-rad2Deg(z);

  if (roundTo>0)
  {
    x=((int)round(x/roundTo))*roundTo;
    y=((int)round(y/roundTo))*roundTo;
    z=((int)round(z/roundTo))*roundTo;
  }
};
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: LDCad 1.6 ROTSTEP feedback - by Roland Melkert - 2016-02-25, 21:43
Re: LDCad 1.6 ROTSTEP feedback - by TestOne - 2016-02-25, 22:56
RE: LDCad 1.6 suggestions/plans - by Kai - 2016-05-23, 18:48
RE: LDCad 1.6 suggestions/plans - by Art - 2016-08-11, 12:56
RE: LDCad 1.6 suggestions/plans - by Art - 2016-08-12, 7:29
RE: LDCad 1.6 suggestions/plans - by Karen M - 2017-10-24, 10:28

Forum Jump:


Users browsing this thread: 12 Guest(s)