示例#1
0
        public void LDiv(ref QPoint q)
        {
            QPoint qc = q;

            qc.Conj();
            this.LMul(ref qc);
        }
示例#2
0
文件: CTrans.cs 项目: nanma80/MPUlt
        //
        // 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);
        }
示例#3
0
        public void RMul(ref QPoint q)
        {
            QPoint qc = q;

            qc.LMul(ref this);
            this = qc;
        }
示例#4
0
文件: CTrans.cs 项目: nanma80/MPUlt
        // 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;
        }
示例#5
0
文件: CTrans.cs 项目: nanma80/MPUlt
        // 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;
        }
示例#6
0
        // |b|=1
        public void RDiv(ref QPoint q)
        {
            QPoint qc = q;

            qc.Conj();
            qc.LMul(ref this);
            this = qc;
        }
示例#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;
        }
示例#8
0
文件: CTrans.cs 项目: nanma80/MPUlt
        //
        // 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);
        }
示例#9
0
文件: CTrans.cs 项目: nanma80/MPUlt
        // 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);
        }
示例#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));
        }
示例#11
0
文件: CTrans.cs 项目: nanma80/MPUlt
        //
        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));
        }
示例#12
0
文件: CTrans.cs 项目: nanma80/MPUlt
 public CTrans(CTrans ct)
 {
     this.m_T = ct.T;
     this.m_R = ct.R;             // no Norm needed here
 }
示例#13
0
文件: CTrans.cs 项目: nanma80/MPUlt
 //
 public CTrans(RPoint shiftV, QPoint rotQ)
 {
     this.T = shiftV;
     this.R = rotQ;             //! Norm
 }
示例#14
0
 public void Sub(ref QPoint q)
 {
     PT.Sub(ref q.PT);
     R -= q.R;
 }
示例#15
0
 // destructive ops
 public void Add(ref QPoint q)
 {
     PT.Add(ref q.PT);
     R += q.R;
 }
示例#16
0
 //
 public bool Equals(QPoint qpt)
 {
     return(this == qpt);
 }