private void rect(Point2d pt1, Point2d pt2, Point2d pt3) { Vector2d vec = pt1.VectorTo(pt3); Vector2d vec2 = pt2.VectorTo(pt3); if (vec.Length < vec2.Length) { vec = vec2; } Point2d pt; vec.Normalize(); Vector2d normal = vec.Copy(); Matrix2d mtx = invApp.TransientGeometry.CreateMatrix2d(); mtx.SetToRotation(3.1415926 / 2, invApp.TransientGeometry.CreatePoint2d(0, 0)); normal.TransformBy(mtx); vec.ScaleBy(b / 2); normal.ScaleBy(a / 2); pt = mid(pt1, pt2); pt.TranslateBy(vec); pt3 = pt.Copy(); pt3.TranslateBy(normal); ps.SketchLines.AddAsThreePointCenteredRectangle(mid(pt1, pt2), pt, pt3); }