예제 #1
0
        /// <summary>
        /// The spatial cross product matrix for 'a', for use with force vectors.
        /// i.e. b = a x* f = CPM(a) * f, where f is a force vector</summary>
        public static m6x8 <Force, Force> CPM(v8 <Force> a)
        {
            var cx_ang = CPM(a.ang);
            var cx_lin = CPM(a.lin);

            return(new m6x8 <Force, Force>(cx_ang, cx_lin, m3x4.Zero, cx_ang));
        }
예제 #2
0
        /// <summary>
        /// The spatial cross product matrix for 'a', for use with motion vectors.
        ///' i.e. b = a x m = CPM(a) * m, where m is a motion vector</summary>
        public static m6x8 <Motion, Motion> CPM(v8 <Motion> a)
        {
            var cx_ang = CPM(a.ang);
            var cx_lin = CPM(a.lin);

            return(new m6x8 <Motion, Motion>(cx_ang, m3x4.Zero, cx_lin, cx_ang));
        }
예제 #3
0
 /// <summary>Return a random vector with components within the intervals given by each component of min and max</summary>
 public static v8 <T> Random(v8 <T> min, v8 <T> max, Random r)
 {
     return(new v8 <T>(
                r.Float(min.ang.x, max.ang.x),
                r.Float(min.ang.y, max.ang.y),
                r.Float(min.ang.z, max.ang.z),
                r.Float(min.lin.w, max.lin.w),
                r.Float(min.lin.w, max.lin.w),
                r.Float(min.lin.w, max.lin.w)));
 }
예제 #4
0
 public static v8 <Force> Cross <T>(v8 <T> lhs, v8 <Force> rhs) where T : IVectorSpace
 {
     return(new v8 <Force>(Cross(lhs.ang, rhs.ang) + Cross(lhs.lin, rhs.lin), Cross(lhs.ang, rhs.lin)));
 }
예제 #5
0
 /// <summary>
 /// Spatial cross product.
 /// There are two cross product operations, one for motion vectors and one for forces</summary>
 public static v8 <Motion> Cross <T>(v8 <T> lhs, v8 <Motion> rhs) where T : IVectorSpace
 {
     return(new v8 <Motion>(Cross(lhs.ang, rhs.ang), Cross(lhs.ang, rhs.lin) + Cross(lhs.lin, rhs.ang)));
 }
예제 #6
0
 public static float Dot(v8 <Force> lhs, v8 <Motion> rhs)
 {
     return(Dot(rhs, lhs));
 }
예제 #7
0
 ///<summary>
 /// Spatial dot product.
 /// The dot product is only defined for Dot(v8m,v8f) and Dot(v8f,v8m)
 /// e.g Dot(force, velocity) == power delivered</summary>
 public static float Dot(v8 <Motion> lhs, v8 <Force> rhs)
 {
     // v8m and v8f are vectors in the dual spaces M and F
     // A property of dual spaces is dot(m,f) = transpose(m)*f
     return(Dot(lhs.ang, rhs.ang) + Dot(lhs.lin, rhs.lin));
 }
예제 #8
0
 public static bool FEql <T>(v8 <T> lhs, v8 <T> rhs) where T : IVectorSpace
 {
     return
         (FEql(lhs.ang, rhs.ang) &&
          FEql(lhs.lin, rhs.lin));
 }
예제 #9
0
 /// <summary>Approximate equal</summary>
 public static bool FEqlRelative <T>(v8 <T> lhs, v8 <T> rhs, float tol) where T : IVectorSpace
 {
     return
         (FEqlRelative(lhs.ang, rhs.ang, tol) &&
          FEqlRelative(lhs.lin, rhs.lin, tol));
 }