public static System.Drawing.Rectangle ToDrawingRect(this Rg.Rectangle3d input, int transposition = 0) { if (transposition > 0) { return(new System.Drawing.Rectangle((int)input.Corner(0).X, (int)(transposition - input.Corner(3).Y), (int)input.Width, (int)input.Height)); } return(new System.Drawing.Rectangle((int)input.Corner(0).X, (int)input.Corner(0).Y, (int)input.Width, (int)input.Height)); }
public static string ToSVG(this Rg.Rectangle3d input) { return("M " + input.Corner(0).ToSVG() + input.Corner(1).ToSVG() + input.Corner(2).ToSVG() + input.Corner(3).ToSVG() + input.Corner(0).ToSVG() + " "); }
private static void ComputeDeviation(Rectangle3d rec, Rhino.Collections.Point3dList pts, out double dev, out double angdev) { dev = double.MaxValue; for (int i = 0; i < 4; i++) { dev = Math.Min(dev, rec.Corner(i).DistanceTo(pts[i])); } angdev = double.MaxValue; for (int i = 0; i < 4; i++) { int j = (i == 3) ? 0 : i + 1; Vector3d re = rec.Corner(i) - rec.Corner(j); Vector3d pe = pts[i] - pts[j]; double ad = Vector3d.VectorAngle(re, pe); if (RhinoMath.IsValidDouble(ad)) { angdev = Math.Min(angdev, ad); } } }