Ejemplo n.º 1
0
static int
Qs(q_g_mul_p_)(lua_State *L)
{
    mClifford *m = qlua_checkClifford(L, 1);
    Qs(mSeqDirProp) *f = Qs(qlua_checkSeqDirProp)(L, 2, -1);
    Qs(mSeqDirProp) *mf = Qs(qlua_newSeqDirProp)(L, QC(f));
    Qs(mSeqDirProp) *r = Qs(qlua_newZeroSeqDirProp)(L, QC(f));
    int i;
    
    for (i = 0; i < 16; i++) {
        switch (m->g[i].t) {
        case qG_z: continue;
        case qG_p:
            Qx(QLA_D,_P_eq_gamma_times_P)(QNC(QC(f)) mf->ptr, f->ptr, i);
            Qx(QLA_D,_P_peq_P)(QNC(QC(f)) r->ptr, mf->ptr);
            break;
        case qG_m:
            Qx(QLA_D,_P_eq_gamma_times_P)(QNC(QC(f)) mf->ptr, f->ptr, i);
            Qx(QLA_D,_P_meq_P)(QNC(QC(f)) r->ptr, mf->ptr);
            break;
        case qG_r:
            Qx(QLA_D,_P_eq_gamma_times_P)(QNC(QC(f)) mf->ptr, f->ptr, i);
            Qx(QLA_D,_P_peq_r_times_P)(QNC(QC(f)) r->ptr, &m->g[i].r, mf->ptr);
            break;
        case qG_c:
            Qx(QLA_D,_P_eq_gamma_times_P)(QNC(QC(f)) mf->ptr, f->ptr, i);
            Qx(QLA_D,_P_peq_c_times_P)(QNC(QC(f)) r->ptr, &m->g[i].c, mf->ptr);
            break;
        }
    }
    return 1;
}
Ejemplo n.º 2
0
static int
Qs(q_g_mul_D_)(lua_State *L)
{
    mClifford *m = qlua_checkClifford(L, 1);
    Qs(mLatDirFerm) *f = Qs(qlua_checkLatDirFerm)(L, 2, NULL, -1);
    mLattice *S = qlua_ObjLattice(L, 2);
    int Sidx = lua_gettop(L);
    Qs(mLatDirFerm) *mf = Qs(qlua_newLatDirFerm)(L, Sidx, QC(f));
    Qs(mLatDirFerm) *r = Qs(qlua_newZeroLatDirFerm)(L, Sidx, QC(f));
    int i;

    CALL_QDP(L);
    for (i = 0; i < 16; i++) {
        switch (m->g[i].t) {
        case qG_z: continue;
        case qG_p:
            Qx(QDP_D,_D_eq_gamma_times_D)(mf->ptr, f->ptr, i, *S->qss);
            Qx(QDP_D,_D_peq_D)(r->ptr, mf->ptr, *S->qss);
            break;
        case qG_m:
            Qx(QDP_D,_D_eq_gamma_times_D)(mf->ptr, f->ptr, i, *S->qss);
            Qx(QDP_D,_D_meq_D)(r->ptr, mf->ptr, *S->qss);
            break;
        case qG_r:
            Qx(QDP_D,_D_eq_gamma_times_D)(mf->ptr, f->ptr, i, *S->qss);
            Qx(QDP_D,_D_peq_r_times_D)(r->ptr, &m->g[i].r, mf->ptr, *S->qss);
            break;
        case qG_c:
            Qx(QDP_D,_D_eq_gamma_times_D)(mf->ptr, f->ptr, i, *S->qss);
            Qx(QDP_D,_D_peq_c_times_D)(r->ptr, &m->g[i].c, mf->ptr, *S->qss);
            break;
        }
    }
    return 1;
}
Ejemplo n.º 3
0
/////////////////////////////////////////////////////////////
/// Construit le quaternion à partir de 3 angles d'Euler
///
/// \param X : Angle autour de X
/// \param Y : Angle autour de Y
/// \param Z : Angle autour de Z
///
////////////////////////////////////////////////////////////
void Quaternion::FromEulerAngles(float X, float Y, float Z)
{
    Quaternion Qx(Vector3F(1, 0, 0), X);
    Quaternion Qy(Vector3F(0, 1, 0), Y);
    Quaternion Qz(Vector3F(0, 0, 1), Z);

    *this = Qx * Qy * Qz;
}
Ejemplo n.º 4
0
static int
Qs(q_M_gc)(lua_State *L)
{
    Qs(mLatColMat) *b = Qs(qlua_checkLatColMat)(L, 1, NULL, -1);

    Qx(QDP_D,_destroy_M)(b->ptr);
    b->ptr = 0;

    return 0;
}
Ejemplo n.º 5
0
int main() {
  coord 	t(3);
  coord		Q(3);
  coord		R(3);
  coord		pi(3);
  coord		QxtxQ(3);
  coord		txQ(3);
  double 	k;

  t[0] = 1.0;
  t[1] = 2.0;
  t[2] = 3.0;

  pi[0] = -0.5;
  pi[1] = -2.345;
  pi[2] = 1.2345;

  Q = pi;
  R = pi - t;

  transformMatrix tx(cross_prod, t[0], t[1], t[2]);
  transformMatrix Qx(cross_prod, Q[0], Q[1], Q[2]);


  //  txQ = tx*Q;
  QxtxQ = Qx*tx*Q;

  std::cout << "R0 = " << (R*Q).sum() << std::endl;
  std::cout << "R1 = " << (R*QxtxQ).sum() << std::endl;
  //std::cout << "R2 = " << (R*txQ).sum() << std::endl;

  k = ((t*Q).sum() - (t*QxtxQ).sum()*(R*Q).sum()/(R*QxtxQ).sum())/(Q*Q).sum();

  std::cout << "pi = " << k*Q << std::endl;

  return(0);
}