示例#1
0
void MCoord::Transform(const double in[], double out[]) const {
  for (UInt i = 0; i < ManifoldDim(); i++) {
    out[i] = 0;
    for (UInt j = 0; j < SpaceDim(); j++) {
      out[i] += (in[j] - ct[j])*u[i*SpaceDim() + j];
    }
  }
}
示例#2
0
MCoord::MCoord(const double c[], const double n[]) {
  for (UInt i = 0; i < SpaceDim(); i++) {
    ct[i] = c[i];
  }
  if(n != NULL){
    double tmp = std::sqrt(n[1]*n[1] + n[2]*n[2]);
    // An orthogonal basis for the cospace of the vector n;
    u[0] = 0; u[1] = n[2]/tmp; u[2] = -n[1]/tmp;
    u[3] = tmp; u[4] = -n[0]*n[1]/tmp; u[5] = -n[0]*n[2]/tmp;
  }else{
    for (UInt i = 0; i < 3; i++) {
      u[2*i] = 0;
      u[2*i+1] = 0;
    }
  }
}
示例#3
0
MCoord::MCoord(const double c[], const double n[]) {
    for (UInt i = 0; i < SpaceDim(); i++) {
        ct[i] = c[i];
    }
    double tmp = std::sqrt(n[1]*n[1] + n[2]*n[2]);

    if (std::abs(tmp) > 1e-8) { // vector could be in x direction
        // An orthogonal basis for the cospace of the vector n;
        u[0] = 0;
        u[1] = n[2]/tmp;
        u[2] = -n[1]/tmp;
        u[3] = tmp;
        u[4] = -n[0]*n[1]/tmp;
        u[5] = -n[0]*n[2]/tmp;
    } else {
        tmp = std::sqrt(n[0]*n[0] + n[2]*n[2]);
        u[0] = n[2]/tmp;
        u[1] = 0;
        u[2] = -n[0]/tmp;
        u[3] = -n[1]*n[0]/tmp;
        u[4] = tmp;
        u[5] = -n[1]*n[2]/tmp;
    }
}