public static void Vec2DRotateAroundOrigin(this Vector2 v, double ang) { //create a transformation matrix C2DMatrix mat = new C2DMatrix(); //rotate mat.Rotate(ang); //now transform the object's vertices mat.TransformVector2Ds(v); }
private Vector2 PointToWorldSpace(Vector2 point, Vector2 heading, Vector2 side, Vector2 position) { //make a copy of the point Vector2 TransPoint = point; //create a transformation matrix C2DMatrix matrix = new C2DMatrix(); //rotate matrix.Rotate(heading, side); //and translate matrix.Translate(position.X, position.Y); //now transform the vertices matrix.TransformVector2Ds(TransPoint); return TransPoint; }