private static void ScalaAdd(Matrix m, int src, int dst, Fraction s) { for (int i = 0; i < m.columns; i++) { m.data[dst, i] = FractionOperators.Add(m.data[dst, i], FractionOperators.Multiply(s, m.data[src, i])); } }
public static Fraction Length(List <TokenType> parameters) { Vector v = parameters[0] as Vector; Vector.CheckNumberic(v); if (v is Vec2 vec2) { return(Fraction.Sqrt(FractionOperators.Add(FractionOperators.Multiply(vec2.X, vec2.X), FractionOperators.Multiply(vec2.Y, vec2.Y)))); } if (v is Vec3 vec3) { return(Fraction.Sqrt(FractionOperators.Add(FractionOperators.Add(FractionOperators.Multiply(vec3.X, vec3.X), FractionOperators.Multiply(vec3.Y, vec3.Y)), FractionOperators.Multiply(vec3.Z, vec3.Z)))); } return(null); }