public void RotateScaleYTo(Vec2 v) { Affine2D rs = CalcRotateScale(YAxis, v); XAxis = rs.TransformNormal(XAxis); YAxis = rs.TransformNormal(YAxis); }
public static Affine2D operator *(Affine2D l, Affine2D r) { Affine2D result = new Affine2D(); result.XAxis = l.TransformNormal(r.XAxis); result.YAxis = l.TransformNormal(r.YAxis); result.Translation = l.TransformVector(r.Translation); return(result); }
//returns true if all values differ from a by less than or equal to epsilon public bool Equals(Affine2D a, float epsilon) { return(Math.Abs(XAxis.X - a.XAxis.X) <= epsilon && Math.Abs(XAxis.Y - a.XAxis.Y) <= epsilon && Math.Abs(YAxis.X - a.YAxis.X) <= epsilon && Math.Abs(YAxis.Y - a.YAxis.Y) <= epsilon && Math.Abs(Translation.X - a.Translation.X) <= epsilon && Math.Abs(Translation.Y - a.Translation.Y) <= epsilon); }
public void RotateScaleXTo(Vec2 v) { //float a,c; ///calcRSAC(out a, out c, X, v); //Gaaaaccch!! //Work you stupid math!!!!!!!!!!!! //X.X = a*X.X - c*X.Y; //X.Y = c*X.X + a*X.Y; //Y.X = a*Y.X - c*Y.Y; //Y.Y = c*Y.X + a*Y.Y; //oh well, using the slow way instead.... Affine2D rs = CalcRotateScale(XAxis, v); XAxis = rs.TransformNormal(XAxis); YAxis = rs.TransformNormal(YAxis); }