public static KVector2 Multiply(KVector2 A, KMatrix3x3Opti B) { double X = A.X * B.A11 + A.Y * B.A21; double Y = A.X * B.A12 + A.Y * B.A22; return(new KVector2(X, Y)); }
public static KVector2 Multiply(KMatrix3x3Opti A, KVector2 B) { double X = A.A11 * B.X + A.A12 * B.Y; double Y = A.A21 * B.X + A.A22 * B.Y; return(new KVector2(X, Y)); }
public static KVector3 Multiply(KMatrix3x3Opti A, KVector3 B) { double X = A.A11 * B.X + A.A12 * B.Y + A.A13 * B.Z; double Y = A.A21 * B.X + A.A22 * B.Y + A.A23 * B.Z; double Z = B.Z; return(new KVector3(X, Y, Z)); }
public static KVector3 Multiply(KVector3 A, KMatrix3x3Opti B) { double X = A.X * B.A11 + A.Y * B.A21; double Y = A.X * B.A12 + A.Y * B.A22; double Z = A.X * B.A13 + A.Y * B.A23 + A.Z; return(new KVector3(X, Y, Z)); }
public static KMatrix3x3Opti Add(KMatrix3x3Opti A, KMatrix3x3Opti B) { return(new KMatrix3x3Opti( A.A11 + B.A11, A.A12 + B.A12, A.A21 + B.A21, A.A22 + B.A22, A.A13 + B.A13, A.A23 + B.A23)); }
public static KMatrix3x3Opti Multiply(KMatrix3x3Opti A, double k) { return(new KMatrix3x3Opti( k * A.A11, k * A.A12, k * A.A21, k * A.A22, k * A.A13, k * A.A23)); }
public static KMatrix3x3Opti Substract(KMatrix3x3Opti A, KMatrix3x3Opti B) { return(new KMatrix3x3Opti( A.A11 - B.A11, A.A12 - B.A12, A.A21 - B.A21, A.A22 - B.A22, A.A13 - B.A13, A.A23 - B.A23)); }
public static KVector2 TransformVector(KVector2 v, KMatrix3x3Opti mat) { KVector2 result = new KVector2 { X = mat.A11 * v.X + mat.A12 * v.Y, Y = mat.A21 * v.X + mat.A22 * v.Y }; return(result); }
public static KMatrix3x3Opti Multiply(KMatrix3x3Opti A, KMatrix3x3Opti B) { double c11 = A.A11 * B.A11 + A.A12 * B.A21; double c12 = A.A11 * B.A12 + A.A12 * B.A22; double c13 = A.A11 * B.A13 + A.A12 * B.A23 + A.A13; double c21 = A.A21 * B.A11 + A.A22 * B.A21; double c22 = A.A21 * B.A12 + A.A22 * B.A22; double c23 = A.A21 * B.A13 + A.A22 * B.A23 + A.A23; return(new KMatrix3x3Opti(c11, c12, c21, c22, c13, c23)); }
public static void ComputeScRotTr(KVector2 scale, double rotation, KVector2 translation, out KMatrix3x3Opti mat) { mat = KMatrix3x3Opti.CreateScale(scale) * KMatrix3x3Opti.CreateRotation(rotation) * KMatrix3x3Opti.CreateTranslation(translation); }
public static void ComputeWorldToLocal(KTransform t, out KMatrix3x3Opti mat) { ComputeScRotTr(new KVector2(1 / t.Scale.X, 1 / t.Scale.Y), t.Rotation, -t.Position, out mat); }
public static void ComputeLocalToWorld(KTransform t, out KMatrix3x3Opti mat) { ComputeTrRotSc(t.Position, -t.Rotation, t.Scale, out mat); }
public static KVector2 TransformNormal(KVector2 v, KMatrix3x3Opti mat) { return(Normalize(TransformDir(v, mat))); }