Ellipse2d Class

The ellipse can represent either a full ellipse or an elliptical arc. The ellipse can be tilted in world space, using the angle of the major axis. Degenerate ellipses (one of the axis is zero length) is not supported and will most likely produce odd results and exceptions. The elliptical arc is always seen as counter clockwise and the major axis is always the longest axis of the ellipse. Constuctors will swap axes and angles so that this conditions are fullfilled. A word about our definition of elliptical parameters: an elliptical parameter is in range 0-2pi, where parameter 0 is the right quadrant point of the ellipse in the ellipses local coordinate system. When the ellipse is an arc, the paramteric range of this arc is a sub part of this parametric range, which means an arc can for example have startparameter=0.3 endparameter=0.8.
Public Class Ellipse2d 
Inherits Geometry2d
This language is not supported or no code example is available.
public class Ellipse2d : Geometry2d
This language is not supported or no code example is available.
public ref class Ellipse2d : public Geometry2d^
This language is not supported or no code example is available.
public class Ellipse2d 
extends Geometry2d
This language is not supported or no code example is available.
Name Description
Public constructor Ellipse2d(Ellipse2d) Copy constructor.
Public constructor Ellipse2d(Point2d, double, double) Constructs a full axis aligned ellipse with the specified radiis. The largest radius will become the major axis.
Public constructor Ellipse2d(Point2d, double, double, double) Constructs a full ellipse given center, two radiis and a tiltangle in the plane. The largest radius will become the major axis.
Public constructor Ellipse2d(Point2d, double, double, double, double, double) Constructs a full ellipse given center, two radiis and a tiltangle in the plane. The largest radius will become the major axis.
Top
Name Description
Public property Area Gets the area of the full ellipse.
Public property Center Gets or sets the center of ellipse. Getting the center will return a reference to the stored center point.
Public property End Gets a new point that is the end point of the elliptical arc. Gets a point at angle/parameter 0.0 if this is a full ellipse.
Public property EndAngle Gets the start angle of the elliptical arc. (That is the angle between the center point and the end point of the arc in the ellipses local coordinate system) If this ellipse is a full ellipse this function returns 2*Calc.PI
Public property EndParam Returns the end parameter of the elliptic arc or 2*PI if this is a full ellipse. Se Eval() function for discussion about parameters.
Public property Extents Gets the bounding box that encloses this ellipse/elliptical arc.
Public property Length Gets the length of the elliptic object whith an max error of Calc.Epsilon.
Public property MajorAxis Gets the major axis of the ellipse as a new vector.
Public property MajorRadius Gets the length of the major axis.
Public property MidPoint Gets the point that is on the middle of the elliptical arc in the means of distance along its circumference. This function does some quite heavy computations and is not very fast. Since it's solved numerically it's not exact.
Public property MinorAxis Gets the minor axis of the ellipse as a new vector.
Public property MinorRadius Gets the length of the minor axis.
Public property OrthoMatrix Gets a new matrix that will transform the ellipse to zero tilt angle at world origo.
Public property Start Gets a new point that is the start point of the elliptical arc. Gets a point at angle/parameter 0.0 if this is a full ellipse.
Public property StartAngle Gets the start angle of the elliptical arc. (That is the angle between the center point and the start point of the arc in the ellipses local coordinate system) If this ellipse is a full ellipse this function returns 0.0
Public property StartParam Returns the start parameter of the ellipse or 0.0 if this is a full ellipse. Se Eval() function for discussion about parameters.
Public property UnitCircleMatrix Gets a new matrix that will transform this ellipse to a unit circle (that is, a circle at world origo with radius=1.0)
Top
Methods
 
Name Description
Public method AngleToParam(double) Computes an elliptical parameter given an angle in radians.
Public method ArcFit(double)
Public method ArcFit(int)
Public method ClosestPoint(Point2d) Computes a point on the ellipse/elliptical arc that is as close as possible to another point.
Public method CommonTangents(Ellipse2d)
Public method ComputeLength(double) Usually, the Length property of the ellipse should be used. This function can be used in case a custom accuracy is wanted.
Public method Contains(Point2d)
Public method Static CreateFrom5Points(Point2d, Point2d, Point2d, Point2d, Point2d) Creates an ellipse through five points
Public method Static CreateFromEquation(double, double, double, double, double, double) Creates an ellipse from the general conic equation Ax^2+Bxy+Cy^2+Dx+Ey+F=0
Public method Static CreateFromLength(Point2d, double, double, double, double, double) Approximates a new elliptical arc given a startangle and a length. If the length is larger than a full ellipse of the specified parameters, an exception will be thrown (numerical computations will never converge).
Public method Distance(Point2d) Computes a distance from any point to the ellipse/elliptical arc.
Public method DualConic(Ellipse2d)
Public method Eval(double) Evaluates a point on the ellipse given a parameter. The parametric range for an ellipse is 0-2*PI. For an elliptical arc the start an end of the range corresponds to where it resides on the full ellipses circumference.
Public method Flatten(double)
Public method Foci(bool) Computes one of the two focii of the ellipse.
Public method GetEquation()
Public method GetEquation(out double, out double, out double, out double, out double, out double) Gets the conic equation of the ellipse on the form Ax^2+Bxy+Cy^2+Dx+Ey+F=0
Public method IsArc() Returns true if this is an elliptical arc, or false if this is a complete ellipse.
Public method IsEllipsePointOnArc(Point2d) Checks if a point included in the full ellipse is on the elliptical arc by checking it's side of the startpoint-endpoint line. If this ellipse is a full ellipse this function always returns true.
Public method IsParamIncluded(double) Checks if an elliptical parameter is included on the arc. If this is a full ellipse this function always returns true.
Public method Mirror(Point2d, Point2d) Mirrors the ellipse in-place over a line specified by two points.
Public method Normalize() Makes sure the ellipse major axis is longer than the minor axis, and fixes the parameters as needed
Public method Param(Point2d) Calculates the parameter of the point pt in the range 0-2PI.
Public method Param01(double) Converts a parameter in the range 0-2PI to a parameter in the range 0-1 where 0=startparam and 1=endparam on arc
Public method ParamToAngle(double) Computes an angle in radians given an elliptical parameter for this ellipse.
Public method Perpendicular(Point2d) Computes new points on the ellipses periferi, which are perpendicular to the ellipse with respect to a given point. The points are on the full ellipse, even if it is an arc.
Public method Quadrant(int) Returns a new point on the ellipse that is a point on one of the ellipses extremes in the ellipse local coordinate system. The point is always computed as if the ellipse is a full ellipse and not an arc.
Public method Rotate(double) Rotates the ellipse in-place around world origo.
Public method Rotate(double, Point2d) Rotates the ellipse in-place around a given point.
Public method Scale(double) Scales the ellipse in-place using world origo as scaling center.
Public method Scale(double, Point2d) Scales the ellipse in-place using a specified scaling center.
Public method Split(IEnumerable<Double>) Splits the arc in sub-arcs given a list of elliptical parameters. The list of parameters do _not_ need to be sorted.
Public method Split(params double[]) Splits the arc in sub-arcs given a list of elliptical parameters. The list of parameters do _not_ need to be sorted.
Public method Split(double, out Ellipse2d, out Ellipse2d) Splits the arc at a specified elliptical parameter. If the parmeter is out of arcs range, a copy of this object and a zero length arc will be created.
Public method Tangent(Point2d) Computes the tangent angle at a given point on the ellipse.
Public method TangentPoint(Point2d, Side) Computes a point on the ellipses circumference that is the enpoint of a line that tangents the ellipse.
Public method ToConic()
Public method ToRegion(double) Approximates the ellipse in a region representation. Since an ellipse cannot be exactly represented by a region, a tolerance is used to approximate the ellipse into a polygon with linear segments only.
Public method ToString() Creates a new string suitable for debugging purposes.
Public method Transform(Matrix2d) Transforms the ellipse in-place with a matrix. Note that the result is undefined for matrices with non uniform scale.
Public method Translate(double, double) Translates the ellipse in-place using a given delta x and delta y.
Public method WriteAutoCADScript(StreamWriter, int) Writes text data to a stream that is suitable to load into AutoCAD using the script command.
Top

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

In this article

Definition