Example #1
0
 public F32Vec2(F32 x, F32 y)
 {
     RawX = x.Raw;
     RawY = y.Raw;
 }
Example #2
0
 public static F32Vec2 NormalizeFastest(F32Vec2 a)
 {
     F32 ooLen = F32.FromRaw(Fixed32.RSqrtFastest(Fixed32.Mul(a.RawX, a.RawX) + Fixed32.Mul(a.RawY, a.RawY))); return(ooLen * a);
 }
Example #3
0
 public static F32Vec2 Clamp(F32Vec2 a, F32 min, F32 max)
 {
     return(new F32Vec2(
                Fixed32.Clamp(a.RawX, min.Raw, max.Raw),
                Fixed32.Clamp(a.RawY, min.Raw, max.Raw)));
 }
Example #4
0
 public F64(F32 v)
 {
     Raw = (long)v.Raw << 16;
 }
Example #5
0
 public static F32 LengthSqr(F32Vec2 a)
 {
     return(F32.FromRaw(Fixed32.Mul(a.RawX, a.RawX) + Fixed32.Mul(a.RawY, a.RawY)));
 }
Example #6
0
 public static F32Vec2 PowFastest(F32 a, F32Vec2 b)
 {
     return(new F32Vec2(Fixed32.PowFastest(a.Raw, b.RawX), Fixed32.PowFastest(a.Raw, b.RawY)));
 }
Example #7
0
 public static F32Vec2 NormalizeFastest(F32Vec2 a)
 {
     F32 ooLen = F32.FromRaw((int)(Fixed64.RSqrtFastest((long)a.RawX * (long)a.RawX + (long)a.RawY * (long)a.RawY) >> 16)); return(ooLen * a);
 }
Example #8
0
 public static F32Vec4 Normalize(F32Vec4 a)
 {
     F32 ooLen = F32.FromRaw(Fixed32.RSqrt(Fixed32.Mul(a.RawX, a.RawX) + Fixed32.Mul(a.RawY, a.RawY) + Fixed32.Mul(a.RawZ, a.RawZ) + Fixed32.Mul(a.RawW, a.RawW))); return(ooLen * a);
 }
Example #9
0
 public static F32 Dot(F32Vec4 a, F32Vec4 b)
 {
     return(F32.FromRaw(Fixed32.Mul(a.RawX, b.RawX) + Fixed32.Mul(a.RawY, b.RawY) + Fixed32.Mul(a.RawZ, b.RawZ) + Fixed32.Mul(a.RawW, b.RawW)));
 }
Example #10
0
 public static F32Vec4 PowFastest(F32 a, F32Vec4 b)
 {
     return(new F32Vec4(Fixed32.PowFastest(a.Raw, b.RawX), Fixed32.PowFastest(a.Raw, b.RawY), Fixed32.PowFastest(a.Raw, b.RawZ), Fixed32.PowFastest(a.Raw, b.RawW)));
 }
Example #11
0
 public static F32 LengthFastest(F32Vec4 a)
 {
     return(F32.FromRaw(Fixed32.SqrtFastest(Fixed32.Mul(a.RawX, a.RawX) + Fixed32.Mul(a.RawY, a.RawY) + Fixed32.Mul(a.RawZ, a.RawZ) + Fixed32.Mul(a.RawW, a.RawW))));
 }
Example #12
0
 public static F32Vec4 PowFastest(F32Vec4 a, F32 b)
 {
     return(new F32Vec4(Fixed32.PowFastest(a.RawX, b.Raw), Fixed32.PowFastest(a.RawY, b.Raw), Fixed32.PowFastest(a.RawZ, b.Raw), Fixed32.PowFastest(a.RawW, b.Raw)));
 }
Example #13
0
 public static F32Vec4 DivFast(F32Vec4 a, F32 b)
 {
     int oob = Fixed32.RcpFast(b.Raw); return(new F32Vec4(Fixed32.Mul(a.RawX, oob), Fixed32.Mul(a.RawY, oob), Fixed32.Mul(a.RawZ, oob), Fixed32.Mul(a.RawW, oob)));
 }
Example #14
0
 public static F32Vec4 FromDouble(double x, double y, double z, double w)
 {
     return(new F32Vec4(F32.FromDouble(x), F32.FromDouble(y), F32.FromDouble(z), F32.FromDouble(w)));
 }
Example #15
0
 public static F32Vec2 DivFastest(F32Vec2 a, F32 b)
 {
     int oob = Fixed32.RcpFastest(b.Raw); return(new F32Vec2(Fixed32.Mul(a.RawX, oob), Fixed32.Mul(a.RawY, oob)));
 }
Example #16
0
 public static F32Vec4 FromInt(int x, int y, int z, int w)
 {
     return(new F32Vec4(F32.FromInt(x), F32.FromInt(y), F32.FromInt(z), F32.FromInt(w)));
 }
Example #17
0
 public static F32Vec2 PowFast(F32Vec2 a, F32 b)
 {
     return(new F32Vec2(Fixed32.PowFast(a.RawX, b.Raw), Fixed32.PowFast(a.RawY, b.Raw)));
 }
Example #18
0
 public static F32Vec4 FromFloat(float x, float y, float z, float w)
 {
     return(new F32Vec4(F32.FromFloat(x), F32.FromFloat(y), F32.FromFloat(z), F32.FromFloat(w)));
 }
Example #19
0
 public static F32 LengthFastest(F32Vec2 a)
 {
     return(F32.FromRaw((int)(Fixed64.SqrtFastest((long)a.RawX * (long)a.RawX + (long)a.RawY * (long)a.RawY) >> 16)));
 }
Example #20
0
 [MethodImpl(FixedUtil.AggressiveInlining)] public static F64 FromF32(F32 v)
 {
     return(FromRaw((long)v.Raw << 16));
 }
Example #21
0
 public static F32 Dot(F32Vec2 a, F32Vec2 b)
 {
     return(F32.FromRaw(Fixed32.Mul(a.RawX, b.RawX) + Fixed32.Mul(a.RawY, b.RawY)));
 }
Example #22
0
 public static F64 FromF32(F32 v)
 {
     return(new F64(v));
 }