//Ellipse public Ellipse EllipseToSpeckle(RH.Ellipse e) { var el = new Ellipse(PlaneToSpeckle(e.Plane), e.Radius1, e.Radius2, ModelUnits); el.domain = new Interval(0, 1); return(el); }
//Ellipse // TODO: handle conversions that define Radius1/Radius2 as major/minor instead of xaxis/yaxis public Ellipse EllipseToSpeckle(RH.Ellipse e, string units = null) { var u = units ?? ModelUnits; var el = new Ellipse(PlaneToSpeckle(e.Plane, u), e.Radius1, e.Radius2, u); el.domain = new Interval(0, 1); el.length = e.ToNurbsCurve().GetLength(); el.bbox = BoxToSpeckle(new RH.Box(e.ToNurbsCurve().GetBoundingBox(true)), u); el.area = Math.PI * e.Radius1 * e.Radius2; // Manual area computing, could not find the Rhino way... return(el); }
public RH.Curve EllipseToNative(Ellipse e) { RH.Ellipse elp = new RH.Ellipse(PlaneToNative(e.plane), ScaleToNative((double)e.firstRadius, e.units), ScaleToNative((double)e.secondRadius, e.units)); var myEllp = elp.ToNurbsCurve(); if (e.domain != null) { myEllp.Domain = IntervalToNative(e.domain); } if (e.trimDomain != null) { myEllp = myEllp.Trim(IntervalToNative(e.trimDomain)).ToNurbsCurve(); } return(myEllp); }