Esempio n. 1
0
        public void LDiv(ref QPoint q)
        {
            QPoint qc = q;

            qc.Conj();
            this.LMul(ref qc);
        }
Esempio n. 2
0
        //
        // res(L) = CTrans(tr,rt)(this(L))
        public CTrans MakeApplyRt(ref RPoint tr, ref QPoint rt)
        {
            CTrans res = new CTrans(this);

            res.ApplyRt(ref tr, ref rt);
            return(res);
        }
Esempio n. 3
0
        public void RMul(ref QPoint q)
        {
            QPoint qc = q;

            qc.LMul(ref this);
            this = qc;
        }
Esempio n. 4
0
        // l=r*(w)*r^(-1)
        public void LtoW_V(ref RPoint LP, out RPoint WP)
        {
            QPoint Q = new QPoint(LP, 0.0);

            Q.LMul(ref m_R);
            Q.RDiv(ref m_R);
            WP = Q.PT;
        }
Esempio n. 5
0
        // l=r^(-1)*(w)*r
        public void WtoL_V(ref RPoint WP, out RPoint LP)
        {
            QPoint Q = new QPoint(WP, 0.0);

            Q.RMul(ref m_R);
            Q.LDiv(ref m_R);
            LP = Q.PT;
        }
Esempio n. 6
0
        // |b|=1
        public void RDiv(ref QPoint q)
        {
            QPoint qc = q;

            qc.Conj();
            qc.LMul(ref this);
            this = qc;
        }
Esempio n. 7
0
        // a=b*a
        public void LMul(ref QPoint q)
        {
            double r = R * q.R - X * q.X - Y * q.Y - Z * q.Z;
            double x = X * q.R + R * q.X + Z * q.Y - Y * q.Z;
            double y = Y * q.R + R * q.Y + X * q.Z - Z * q.X;
            double z = Z * q.R + R * q.Z + Y * q.X - X * q.Y;

            R = r; PT.X = x; PT.Y = y; PT.Z = z;
        }
Esempio n. 8
0
        //
        // new(L) = par(this(L))
        protected void ApplyRt(ref RPoint tr, ref QPoint rt)
        {
            QPoint QT = new QPoint(m_T, 0);

            QT.LMul(ref rt);
            QT.RDiv(ref rt);
            m_T = QT.PT;
            m_T.Add(ref tr);
            m_R.LMul(ref rt);
        }
Esempio n. 9
0
        // res=this'; L=this(res(L))=res(this(L))
        public CTrans MakeInverse()
        {
            QPoint QT = new QPoint(RPoint.Zero - this.T, 0);

            QT.RMul(ref this.m_R);
            QT.LDiv(ref this.m_R);
            CTrans res = new CTrans(QT.PT, this.m_R);

            res.m_R.Conj();
            return(res);
        }
Esempio n. 10
0
        static public CTrans Matrix2CTrans(SharpDX.Matrix M)
        {
            RPoint T = new RPoint(
                -M.M41,
                M.M42,
                M.M43);

            M.M41 = M.M42 = M.M43 = 0;
            Quaternion qRotation = Quaternion.RotationMatrix(M);
            QPoint     R         = new QPoint(
                -qRotation.X,
                qRotation.Y,
                qRotation.Z,
                -qRotation.W);

            return(new CTrans(T, R));
        }
Esempio n. 11
0
        //
        public static CTrans FromAxis(RPoint pt, RPoint vec, double an)
        {
            an *= Math.PI / 360.0;            // half in radians
            RPoint T = RPoint.Zero;
            RPoint C = pt;

            double lR = vec.Dist();
            double xc = Math.Cos(an), xs = Math.Sin(an);

            vec.Mul(xs / lR);
            QPoint R = new QPoint(vec, xc);

            R.Norm();
            // w=R^(-1)*(l-C)*R+C
            T.Add(ref C);
            QPoint QC = new QPoint(C, 0);

            QC.LMul(ref R);
            QC.RDiv(ref R);
            T.Sub(ref QC.PT);
            return(new CTrans(T, R));
        }
Esempio n. 12
0
 public CTrans(CTrans ct)
 {
     this.m_T = ct.T;
     this.m_R = ct.R;             // no Norm needed here
 }
Esempio n. 13
0
 //
 public CTrans(RPoint shiftV, QPoint rotQ)
 {
     this.T = shiftV;
     this.R = rotQ;             //! Norm
 }
Esempio n. 14
0
 public void Sub(ref QPoint q)
 {
     PT.Sub(ref q.PT);
     R -= q.R;
 }
Esempio n. 15
0
 // destructive ops
 public void Add(ref QPoint q)
 {
     PT.Add(ref q.PT);
     R += q.R;
 }
Esempio n. 16
0
 //
 public bool Equals(QPoint qpt)
 {
     return(this == qpt);
 }