Exemplo n.º 1
0
 public static F64Vec3 Cross(F64Vec3 a, F64Vec3 b)
 {
     return(new F64Vec3(
                Fixed64.Mul(a.RawY, b.RawZ) - Fixed64.Mul(a.RawZ, b.RawY),
                Fixed64.Mul(a.RawZ, b.RawX) - Fixed64.Mul(a.RawX, b.RawZ),
                Fixed64.Mul(a.RawX, b.RawY) - Fixed64.Mul(a.RawY, b.RawX)));
 }
Exemplo n.º 2
0
        public static F64 Lerp(F64 a, F64 b, F64 t)
        {
            long tb = t.Raw;
            long ta = Fixed64.One - tb;

            return(FromRaw(Fixed64.Mul(a.Raw, ta) + Fixed64.Mul(b.Raw, tb)));
        }
Exemplo n.º 3
0
        public static F64Vec2 Lerp(F64Vec2 a, F64Vec2 b, F64 t)
        {
            long tb = t.Raw;
            long ta = Fixed64.One - tb;

            return(new F64Vec2(
                       Fixed64.Mul(a.RawX, ta) + Fixed64.Mul(b.RawX, tb),
                       Fixed64.Mul(a.RawY, ta) + Fixed64.Mul(b.RawY, tb)));
        }
Exemplo n.º 4
0
        public static F64Quat Inverse(F64Quat a)
        {
            long inv_norm = F64.Rcp(LengthSqr(a)).Raw;

            return(new F64Quat(
                       -Fixed64.Mul(a.RawX, inv_norm),
                       -Fixed64.Mul(a.RawY, inv_norm),
                       -Fixed64.Mul(a.RawZ, inv_norm),
                       Fixed64.Mul(a.RawW, inv_norm)));
        }
Exemplo n.º 5
0
        public static F64Quat NormalizeFastest(F64Quat a)
        {
            long inv_norm = F64.RcpFastest(LengthFastest(a)).Raw;

            return(new F64Quat(
                       Fixed64.Mul(a.RawX, inv_norm),
                       Fixed64.Mul(a.RawY, inv_norm),
                       Fixed64.Mul(a.RawZ, inv_norm),
                       Fixed64.Mul(a.RawW, inv_norm)));
        }
Exemplo n.º 6
0
 public static F64Vec3 Normalize(F64Vec3 a)
 {
     F64 ooLen = F64.FromRaw(Fixed64.RSqrt(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY) + Fixed64.Mul(a.RawZ, a.RawZ))); return(ooLen * a);
 }
Exemplo n.º 7
0
 public static F64 LengthFastest(F64Vec3 a)
 {
     return(F64.FromRaw(Fixed64.SqrtFastest(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY) + Fixed64.Mul(a.RawZ, a.RawZ))));
 }
Exemplo n.º 8
0
 public static F64Vec3 Div(F64Vec3 a, F64 b)
 {
     long oob = Fixed64.Rcp(b.Raw); return(new F64Vec3(Fixed64.Mul(a.RawX, oob), Fixed64.Mul(a.RawY, oob), Fixed64.Mul(a.RawZ, oob)));
 }
Exemplo n.º 9
0
 public static F64Vec2 DivFastest(F64Vec2 a, F64 b) { long oob = Fixed64.RcpFastest(b.Raw); return new F64Vec2(Fixed64.Mul(a.RawX, oob), Fixed64.Mul(a.RawY, oob)); }
Exemplo n.º 10
0
 public static F64Vec4 NormalizeFastest(F64Vec4 a)
 {
     F64 ooLen = F64.FromRaw(Fixed64.RSqrtFastest(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY) + Fixed64.Mul(a.RawZ, a.RawZ) + Fixed64.Mul(a.RawW, a.RawW))); return(ooLen * a);
 }
Exemplo n.º 11
0
 public static F64Vec4 DivFastest(F64Vec4 a, F64 b)
 {
     long oob = Fixed64.RcpFastest(b.Raw); return(new F64Vec4(Fixed64.Mul(a.RawX, oob), Fixed64.Mul(a.RawY, oob), Fixed64.Mul(a.RawZ, oob), Fixed64.Mul(a.RawW, oob)));
 }
Exemplo n.º 12
0
 public static F64 RadToDeg(F64 a)
 {
     return(FromRaw(Fixed64.Mul(a.Raw, 246083499198)));
 }                                                                                       // 180 / F64.Pi
Exemplo n.º 13
0
 public static F64 operator *(F64 v1, F64 v2)
 {
     return(FromRaw(Fixed64.Mul(v1.Raw, v2.Raw)));
 }
Exemplo n.º 14
0
 public static F64 Dot(F64Vec2 a, F64Vec2 b)
 {
     return(F64.FromRaw(Fixed64.Mul(a.RawX, b.RawX) + Fixed64.Mul(a.RawY, b.RawY)));
 }
Exemplo n.º 15
0
 public static F64 Length(F64Vec2 a)
 {
     return(F64.FromRaw(Fixed64.Sqrt(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY))));
 }
Exemplo n.º 16
0
 public static F64Vec2 operator *(F64Vec2 a, F64 b)
 {
     return(new F64Vec2(Fixed64.Mul(a.RawX, b.Raw), Fixed64.Mul(a.RawY, b.Raw)));
 }
Exemplo n.º 17
0
 public static F64Vec2 operator *(F64 a, F64Vec2 b)
 {
     return(new F64Vec2(Fixed64.Mul(a.Raw, b.RawX), Fixed64.Mul(a.Raw, b.RawY)));
 }
Exemplo n.º 18
0
 public static F64Vec4 operator *(F64 a, F64Vec4 b)
 {
     return(new F64Vec4(Fixed64.Mul(a.Raw, b.RawX), Fixed64.Mul(a.Raw, b.RawY), Fixed64.Mul(a.Raw, b.RawZ), Fixed64.Mul(a.Raw, b.RawW)));
 }
Exemplo n.º 19
0
 public static F64Vec4 operator *(F64Vec4 a, F64 b)
 {
     return(new F64Vec4(Fixed64.Mul(a.RawX, b.Raw), Fixed64.Mul(a.RawY, b.Raw), Fixed64.Mul(a.RawZ, b.Raw), Fixed64.Mul(a.RawW, b.Raw)));
 }
Exemplo n.º 20
0
        }                                                                                       // 180 / F64.Pi

        public static F64 DegToRad(F64 a)
        {
            return(FromRaw(Fixed64.Mul(a.Raw, 74961320)));
        }                                                                                       // F64.Pi / 180
Exemplo n.º 21
0
 public static F64 LengthSqr(F64Vec4 a)
 {
     return(F64.FromRaw(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY) + Fixed64.Mul(a.RawZ, a.RawZ) + Fixed64.Mul(a.RawW, a.RawW)));
 }
Exemplo n.º 22
0
 public static F64Vec3 operator *(F64Vec3 a, F64Vec3 b)
 {
     return(new F64Vec3(Fixed64.Mul(a.RawX, b.RawX), Fixed64.Mul(a.RawY, b.RawY), Fixed64.Mul(a.RawZ, b.RawZ)));
 }
Exemplo n.º 23
0
 public static F64 Dot(F64Vec4 a, F64Vec4 b)
 {
     return(F64.FromRaw(Fixed64.Mul(a.RawX, b.RawX) + Fixed64.Mul(a.RawY, b.RawY) + Fixed64.Mul(a.RawZ, b.RawZ) + Fixed64.Mul(a.RawW, b.RawW)));
 }
Exemplo n.º 24
0
 public static F64Vec2 NormalizeFastest(F64Vec2 a) { F64 ooLen = F64.FromRaw(Fixed64.RSqrtFastest(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY))); return ooLen * a; }