Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ellipsoid.cpp

    r112b09 r5108e1  
    2121#include "tesselation.hpp"
    2222#include "vector.hpp"
     23#include "Matrix.hpp"
    2324#include "verbose.hpp"
    2425
     
    3435  Vector helper, RefPoint;
    3536  double distance = -1.;
    36   double Matrix[NDIM*NDIM];
     37  Matrix Matrix;
    3738  double InverseLength[3];
    3839  double psi,theta,phi; // euler angles in ZX'Z'' convention
     
    5152  theta = EllipsoidAngle[1];
    5253  phi = EllipsoidAngle[2];
    53   Matrix[0] = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi);
    54   Matrix[1] = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi);
    55   Matrix[2] = sin(psi)*sin(theta);
    56   Matrix[3] = sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi);
    57   Matrix[4] = cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi);
    58   Matrix[5] = -cos(psi)*sin(theta);
    59   Matrix[6] = sin(theta)*sin(phi);
    60   Matrix[7] = sin(theta)*cos(phi);
    61   Matrix[8] = cos(theta);
    62   helper.MatrixMultiplication(Matrix);
     54  Matrix.set(0,0, cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi));
     55  Matrix.set(1,0, -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi));
     56  Matrix.set(2,0, sin(psi)*sin(theta));
     57  Matrix.set(0,1, sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi));
     58  Matrix.set(1,1, cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi));
     59  Matrix.set(2,1, -cos(psi)*sin(theta));
     60  Matrix.set(0,2, sin(theta)*sin(phi));
     61  Matrix.set(1,2, sin(theta)*cos(phi));
     62  Matrix.set(2,2, cos(theta));
     63  helper *= Matrix;
    6364  helper.ScaleAll(InverseLength);
    6465  //Log() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl;
     
    7374  phi = -EllipsoidAngle[2];
    7475  helper.ScaleAll(EllipsoidLength);
    75   Matrix[0] = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi);
    76   Matrix[1] = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi);
    77   Matrix[2] = sin(psi)*sin(theta);
    78   Matrix[3] = sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi);
    79   Matrix[4] = cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi);
    80   Matrix[5] = -cos(psi)*sin(theta);
    81   Matrix[6] = sin(theta)*sin(phi);
    82   Matrix[7] = sin(theta)*cos(phi);
    83   Matrix[8] = cos(theta);
    84   helper.MatrixMultiplication(Matrix);
     76  Matrix.set(0,0, cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi));
     77  Matrix.set(1,0, -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi));
     78  Matrix.set(2,0, sin(psi)*sin(theta));
     79  Matrix.set(0,1, sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi));
     80  Matrix.set(1,1, cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi));
     81  Matrix.set(2,1, -cos(psi)*sin(theta));
     82  Matrix.set(0,2, sin(theta)*sin(phi));
     83  Matrix.set(1,2, sin(theta)*cos(phi));
     84  Matrix.set(2,2, cos(theta));
     85  helper *= Matrix;
    8586  //Log() << Verbose(4) << "Intersection is at " << helper << "." << endl;
    8687
Note: See TracChangeset for help on using the changeset viewer.