Table of Contents

Class Ellipse

Namespace
CADability.GeoObject
Assembly
CADability.dll

A circle, circular arc, ellipse or elliptical arc as a IGeoObject implementing ICurve. It is defined by a Plane, whose location is the centre and whose x and y directions are the directions of the axes, by the major and the minor radius (equal for a circle), and by a start parameter and a sweep parameter (angles in radians; a full circle or ellipse has a sweep of 2π, a negative sweep means clockwise). Create one with the static Construct() method and define it with one of the Set... methods, e.g. SetCirclePlaneCenterRadius(Plane, GeoPoint, double) or SetArc3Points(GeoPoint, GeoPoint, GeoPoint, Plane).

public class Ellipse : IGeoObjectImpl, IFeedBack, ICloneable, IColorDef, ILineWidth, ILinePattern, ICurve, IGeoObject, ILayer, IStyle, IOctTreeInsertable, IComparable, ISerializable, IExtentedableCurve, IExplicitPCurve3D, IExportStep, IJsonSerialize
Inheritance
Ellipse
Implements
Inherited Members

Constructors

Ellipse()

Creates an undefined ellipse in the xy-plane and raises Constructed. Protected: use Construct() to create an ellipse.

protected Ellipse()

Ellipse(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected Ellipse(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Fields

Constructor

Optional hook for polymorphic construction. When set, Construct() calls this delegate instead of creating a plain Ellipse, so that an application can have its own derived class instantiated wherever CADability creates an ellipse (construction actions, file import, splitting of curves etc.).

public static Ellipse.ConstructionDelegate Constructor

Field Value

Ellipse.ConstructionDelegate

OnPaintTo3D

Static hook called at the beginning of PaintTo3D(IPaintTo3D) for every ellipse. Set it to replace or extend the way ellipses are displayed; when the handler returns true, the default painting is skipped.

public static Ellipse.PaintTo3DDelegate OnPaintTo3D

Field Value

Ellipse.PaintTo3DDelegate

Properties

Center

gets or sets the center of this circle or ellipse

public virtual GeoPoint Center { get; set; }

Property Value

GeoPoint

ColorDef

The color of this ellipse, null if it has none of its own. Setting it is an undoable attribute change that raises the change events; a "color from parent" value is resolved against the Block that owns this object.

public ColorDef ColorDef { get; set; }

Property Value

ColorDef

CounterClockWise

true if the sweep is positive, i.e. the curve runs counterclockwise when seen from the side the Normal points to. Setting it reverses the sign of the sweep when necessary, keeping the start point: an arc then becomes its complementary arc. The change is undoable and raises the change events.

public bool CounterClockWise { get; set; }

Property Value

bool

Description

Returns a textual description of the GeoObject. Mainly used for debugging purposes

public override string Description { get; }

Property Value

string

EndDirection

The tangent at the end point, pointing in the direction of the curve (the same as DirectionAt(double) with 1).

public GeoVector EndDirection { get; }

Property Value

GeoVector

EndPoint

The end point of the arc, i.e. the point at StartParameter + SweepParameter. Setting it changes the sweep so that the arc ends at the parameter of the given point (which is projected onto the ellipse), keeping the start point and the sweep direction; for a full circle or ellipse it is the same as setting StartPoint, since start and end point coincide. The change is undoable and raises the change events.

public GeoPoint EndPoint { get; set; }

Property Value

GeoPoint

IsArc

Returns true if it is not a full circle or a full ellipse.

public bool IsArc { get; }

Property Value

bool

IsCircle

Returns true if both axis of the ellipse have the same length. It may be a circle or a circular arc.

public bool IsCircle { get; }

Property Value

bool

IsClosed

true for a full circle or ellipse (the sweep is ±2π), false for an arc; the opposite of IsArc.

public bool IsClosed { get; }

Property Value

bool

IsSingular

true if the sweep is 0, i.e. the arc degenerates to a single point.

public bool IsSingular { get; }

Property Value

bool

Length

The arc length of this circle, ellipse or arc. For an ellipse it is computed from the incomplete elliptic integral of the second kind.

public double Length { get; }

Property Value

double

LinePattern

The line pattern (dashes) used to display this ellipse, null for a solid line. Setting it is an undoable attribute change that raises the change events.

public LinePattern LinePattern { get; set; }

Property Value

LinePattern

LineWidth

The line width used to display this ellipse, null for the default. Setting it is an undoable attribute change that raises the change events.

public LineWidth LineWidth { get; set; }

Property Value

LineWidth

MajorAxis

The major axis as a vector from the centre: its direction is the x-direction of Plane, its length is MajorRadius. Setting it changes both direction and radius of the major axis. When the new vector lies in the plane of the ellipse, the ellipse is rotated in its plane (the minor axis is made perpendicular to the new major axis, keeping its length); otherwise a new plane is spanned by the new major axis and the old minor axis. The change is undoable and raises the change events.

public GeoVector MajorAxis { get; set; }

Property Value

GeoVector

MajorRadius

The radius in the direction of the major axis, which is the x-direction of Plane. It is not necessarily the larger of the two radii. Setting it keeps the direction of the axis; the change is undoable and raises the change events.

public virtual double MajorRadius { get; set; }

Property Value

double

MinorAxis

The minor axis as a vector from the centre: its direction is the y-direction of Plane, its length is MinorRadius. Setting it changes both direction and radius of the minor axis. When the new vector lies in the plane of the ellipse, the plane is rotated about the normal (the x-direction is made perpendicular to the new minor axis, the major radius is kept); otherwise a new plane is spanned by the old major axis and the new minor axis. The change is undoable and raises the change events.

public GeoVector MinorAxis { get; set; }

Property Value

GeoVector

MinorRadius

The radius in the direction of the minor axis, which is the y-direction of Plane. It is not necessarily the smaller of the two radii. Setting it keeps the direction of the axis; the change is undoable and raises the change events.

public virtual double MinorRadius { get; set; }

Property Value

double

Normal

The normal of the plane of the ellipse (Normal): a positive sweep runs counterclockwise when seen from the side the normal points to. Setting it tilts the plane about the centre, the axis directions are recalculated as described at Normal. The change is undoable and raises the change events.

public GeoVector Normal { get; set; }

Property Value

GeoVector

Plane

The plane that defines this ellipse: its location is the centre, its x-direction the direction of the major axis and its y-direction the direction of the minor axis. Setting it moves and rotates the ellipse; radii, start and sweep parameter are kept. The change is undoable and raises the change events.

public Plane Plane { get; set; }

Property Value

Plane

PreferredStyle

Returns the preferred style for this objects, see Style.EDefaultFor.

public override Style.EDefaultFor PreferredStyle { get; }

Property Value

Style.EDefaultFor

Radius

The radius of this circle or circular arc. Reading it throws an EllipseException when the major and the minor radius differ, so check IsCircle first. Setting it sets both radii to the absolute value, i.e. it turns an ellipse into a circle. The change is undoable and raises the change events.

public double Radius { get; set; }

Property Value

double

Exceptions

EllipseException

with EllipseIsNotACircle on reading, when this ellipse is not a circle

StartDirection

The tangent at the start point, pointing in the direction of the curve (the same as DirectionAt(double) with 0).

public GeoVector StartDirection { get; }

Property Value

GeoVector

StartParameter

Gets or sets the startparameter of this circular or elliptical arc. The startparameter determins the startpoint of this curve according to the formula: Center + cos(StartParameter)*MajorAxis + sin(StartParameter)*MinorAxis For elliptical arcs the startparameter is not identical to the angle of the startpoint.

public double StartParameter { get; set; }

Property Value

double

StartPoint

The start point of the arc, i.e. the point at StartParameter. Setting it moves the start parameter to the parameter of the given point (which is projected onto the ellipse, plane and radii do not change): for an arc the end point stays where it is and the sweep is adapted; a full circle or ellipse stays closed and only its start point moves. Note that the explicit StartPoint implementation behaves differently: it keeps end point and sweep and may change the plane. The change is undoable and raises the change events.

public GeoPoint StartPoint { get; set; }

Property Value

GeoPoint

SweepParameter

Gets or sets the sweep amount of this arc. A full circle or ellipse must have a sweepparameter of either 2.0Math.PI or -2.0Math.PI, The sweep parameter of circular or elliptical arcs are in the range of -2.0Math.PI < SweepParameter < 2.0Math.PI. SweepParameter is often used in connection with startParameter

public double SweepParameter { get; set; }

Property Value

double

ToUnitCircle

The modification that maps world coordinates into the local coordinate system of Plane: the centre goes to the origin, the major axis onto the x-axis and the minor axis onto the y-axis. The radii are not scaled, so a circle of radius r is mapped onto the circle of radius r around the origin; scale the result by 1/Radius to get the unit circle.

public ModOp ToUnitCircle { get; }

Property Value

ModOp

Methods

AttributeChanged(INamedAttribute)

Overrides AttributeChanged(INamedAttribute). Checks all CADability attributes. Checking your own attributes is left to your code.

public override bool AttributeChanged(INamedAttribute attribute)

Parameters

attribute INamedAttribute

Returns

bool

Clone()

Clones this GeoObject.

public override IGeoObject Clone()

Returns

IGeoObject

the cloned GeoObject

Complement()

Replaces the arc by the complementary arc of the same ellipse: same start point, but going the other way round, so that both arcs together make the full ellipse. A closed ellipse has no complement and stays as it is.

public void Complement()

Construct()

Creates a new ellipse. This is the only way to create one, the constructor is protected. The returned object has no usable geometry yet (the plane is the xy-plane, the radii are 0); define it with one of the Set... methods such as SetCirclePlaneCenterRadius(Plane, GeoPoint, double), SetEllipseCenterAxis(GeoPoint, GeoVector, GeoVector) or SetArc3Points(GeoPoint, GeoPoint, GeoPoint, Plane), or by setting Center, MajorAxis and the other properties.

public static Ellipse Construct()

Returns

Ellipse

A new Ellipse, or an object of the derived class provided by Constructor

CopyGeometry(IGeoObject)

Copies the geometrical aspects of the given GeoObject to this GeoObject. Both objects must be of the same type. The attributes are not copied.

public override void CopyGeometry(IGeoObject ToCopyFrom)

Parameters

ToCopyFrom IGeoObject

GeoObject to copy from

DirectionAt(double)

Returns the direction of the curve at a specified point. The parameter position of the start-point is 0.0, the parameter position of the endpoint is 1.0. Directions of a position outside this interval may be undefined.

public GeoVector DirectionAt(double Position)

Parameters

Position double

Position on the curve

Returns

GeoVector

The requested direction

FindSnapPoint(SnapPointFinder)

Asks the object to add its snap points (end points, centres, intersections...) of the kinds that spf asks for. The default implementation adds none; objects with geometry override it.

public override void FindSnapPoint(SnapPointFinder spf)

Parameters

spf SnapPointFinder

definition and collection of the snap points

GetBoundingCube()

Returns a bounding cube of the object. The object must fir into this cube. There may be a smaller cube that contains the object if it is to expensive to calculate the exact cube.

public override BoundingCube GetBoundingCube()

Returns

BoundingCube

the bounding cube

GetExtent(Projection, ExtentPrecision)

Returns the 2d extent of the object as it appears in the given projection, in the coordinates of the projection's plane (not in pixels).

public override BoundingRect GetExtent(Projection projection, ExtentPrecision extentPrecision)

Parameters

projection Projection

the projection

extentPrecision ExtentPrecision

Exact for the exact extent, Raw for a quick estimate that may be larger

Returns

BoundingRect

the extent in the projection's 2d coordinates

GetExtent(double)

Gets the 3-dimensional extent of an object

public override BoundingCube GetExtent(double precision)

Parameters

precision double

Precision of the test

Returns

BoundingCube

The minmax cube

GetObjectData(IJsonWriteData)

Writes the data of this base class (user data, layer, style, user attributes and actuator) for the JSON serialization (IJsonSerialize). Derived classes override it, call the base implementation and add their own properties.

public override void GetObjectData(IJsonWriteData data)

Parameters

data IJsonWriteData

receives the data

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public override void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

GetPlanarState()

Determins the state of the curve in space. A curve may be either Planar (e.g. a cicle), NonPlanar (e.g. a polyline with vertices that dont shear a common plane) or UnderDetermined (e.g. a line defines a sheaf of planes (Ebenenbüschel))

public PlanarState GetPlanarState()

Returns

PlanarState

GetPlane()

Determins the plane in which the curve resides. Throws CurveException if the curve's PlanarState is NonPlanar or UnderDetermined.

public Plane GetPlane()

Returns

Plane

The plane

GetProjectedCurve(Plane)

Orthogonally projects this curve into the given plane. Returns the 2D curve in the coordinate system of the given plane.

public ICurve2D GetProjectedCurve(Plane p)

Parameters

p Plane

The plane this curve will be projected on

Returns

ICurve2D

The 2D curve in the given plane

GetQuadTreeItem(Projection, ExtentPrecision)

Returns an item for a 2d quad tree of the projected objects, used for hit tests in a projection: it knows the 2d extent of the object, whether a 2d rectangle hits it, and the depth (z position) of the object at a 2d point. Composite objects (blocks, solids, paths) return a collection of the items of their parts.

public override IQuadTreeInsertableZ GetQuadTreeItem(Projection projection, ExtentPrecision extentPrecision)

Parameters

projection Projection

the projection

extentPrecision ExtentPrecision

precision of the extent, see GetExtent(Projection, ExtentPrecision)

Returns

IQuadTreeInsertableZ

the item for the quad tree

GetShowProperties(IFrame)

Should be overridden and return a IPropertyEntry derived object that handles the display and modification of the properties of the IGeoObject derived object. Default implementation return null.

public override IPropertyEntry GetShowProperties(IFrame Frame)

Parameters

Frame IFrame

Returns

IPropertyEntry

HasValidData()

Default implementation of IGeoObject.HasValidData. Returns true. Override if the derived object can decide itself.

public override bool HasValidData()

Returns

bool

true

HitTest(ref BoundingCube, double)

Tests whether an object is touched by the provided cube

public override bool HitTest(ref BoundingCube cube, double precision)

Parameters

cube BoundingCube

To test with

precision double

Required precision

Returns

bool

true if the object strikes the cube

HitTest(Projection, BoundingRect, bool)

Tests whether an object is inside or touched by the rectangle when projected with the provided projection

public override bool HitTest(Projection projection, BoundingRect rect, bool onlyInside)

Parameters

projection Projection

The projection for the test

rect BoundingRect

The rectangle to test the position

onlyInside bool

true: the object must be totaly inside the rectangle, false: the object must be totaly or partially inside the rectangle

Returns

bool

true when the test succeedes, false otherwise

HitTest(PickArea, bool)

Tests whether an object is inside or touched by the provided area

public override bool HitTest(Projection.PickArea area, bool onlyInside)

Parameters

area Projection.PickArea

The area to check for

onlyInside bool

true: the object must be totaly inside the area, false: the object must be totaly or partially inside the area

Returns

bool

true when the test succeedes, false otherwise

IsInPlane(Plane)

Determines whether the curve resides in the given plane.

public bool IsInPlane(Plane p)

Parameters

p Plane

The plane for the test

Returns

bool

true, when the curve resides in the plane

Modify(ModOp)

Modifies this GeoObject with the given modification operation (includes moving, rotating, reflecting, scaling etc.).

public override void Modify(ModOp m)

Parameters

m ModOp

Operation to be applied

PaintTo3D(IPaintTo3D)

Paints the object with the methods of paintTo3D: lines, triangles, text... The views implement IPaintTo3D (with OpenGL or GDI) and collect what the object paints in a display list, so this is called rarely, after PrepareDisplayList(double) has done the expensive work (triangulation, approximation).

public override void PaintTo3D(IPaintTo3D paintTo3D)

Parameters

paintTo3D IPaintTo3D

where to paint

ParameterOf(GeoPoint)

Returns the Parameter of the given point projected into the plane of this ellipse (pp). For a circle or arc this is the radian of the angle of the point. For an ellipse this is the value (a), where e.x = center.x+majorradiuscos(a), e.y = center.y+minorradiuscos(a) yields a point (e) on the ellipse so that (pp) coincides with the line (center,e).

public double ParameterOf(GeoPoint p)

Parameters

p GeoPoint

The point to check

Returns

double

The parameter value

PlaneIntersection(Plane)

Returns the intersectionpoints of this ellipse with the provided plane toIntersectWith. The result is an array with 0 to 2 GeoPoints.

public GeoPoint[] PlaneIntersection(Plane toIntersectWith)

Parameters

toIntersectWith Plane

Plane to intersect with

Returns

GeoPoint[]

The intersectionpoints

Point(double)

Returns the point of the ellipse at the parameter u, i.e. Center + cos(u)·MajorAxis + sin(u)·MinorAxis. The parameter is an angle in radians as used by StartParameter and returned by ParameterOf(GeoPoint). Start and sweep of an arc are ignored, any value gives a point on the full ellipse.

public GeoPoint Point(double u)

Parameters

u double

Parameter (angle in radians)

Returns

GeoPoint

The point at that parameter

PointAndDerivativesAt(double, int)

Implements PointAndDerivativesAt(double, int) analytically.

public IReadOnlyList<GeoVector> PointAndDerivativesAt(double position, int grad)

Parameters

position double
grad int

Returns

IReadOnlyList<GeoVector>

PointAt(double)

Returns the point of the given position. The parameter position of the start-point is 0.0, the parameter position of the endpoint is 1.0. Points of a position outside this interval may be undefined. The correlation between the parameter Position and the resulting point may be not linear.

public GeoPoint PointAt(double Position)

Parameters

Position double

Position on the curve

Returns

GeoPoint

The requested point

PointAtParam(double)

Returns the point at the provided parameter. 2*pi is the full circle, it starts at the startParameter

public GeoPoint PointAtParam(double param)

Parameters

param double

Returns

GeoPoint

Position(GeoPoint, GeoVector, double)

Returns the smallest parameter value (l) where the provided line hits the object so that the point fromHere + l * direction is on or close to the object. The result may be negative. Return double.MaxValue if there is no such point.

public override double Position(GeoPoint fromHere, GeoVector direction, double precision)

Parameters

fromHere GeoPoint

Startpoint of the line

direction GeoVector

Direction of the line

precision double

Precision for the test

Returns

double

Position on the line

PositionOf(GeoPoint)

Returns the parametric position of the point on the curve. This function is inverse to DirectionAt(double). If the given point is not on the curve, the result is the position of a point on the curve, that is close to the given point, but not necessary of the closest point.

public double PositionOf(GeoPoint p)

Parameters

p GeoPoint

Point, for which the position is requested

Returns

double

the requested position

PositionOf(GeoPoint, Plane)

Similar to the PointAt(double) method. Returns the same result, if the point is on the curve. If the point is not on the curve the problem is looked at in the given plane. i.e. the closest point on the projected 2d curve from the projected 2d point is used.

public double PositionOf(GeoPoint p, Plane pl)

Parameters

p GeoPoint

Point, whos position is requested

pl Plane

Plane for the computation of the closest point

Returns

double

the requested position

PositionOf(GeoPoint, double)

Similar to PositionOf(GeoPoint). If the point is not on the curve and there are several solutions then the solution closest to the parameter prefer will be returned.

public double PositionOf(GeoPoint p, double prefer)

Parameters

p GeoPoint

Point, for which the position is requested

prefer double

preferable solution close to this value

Returns

double

the requested position

PrepareDisplayList(double)

Called before PaintTo3D(IPaintTo3D) is called, should implement the time consuming work for the display (like calculationg the triangulation of Faces or Polylines of Curves). Not normally used by user code.

public override void PrepareDisplayList(double precision)

Parameters

precision double

Required precision

SetArc3Points(GeoPoint, GeoPoint, GeoPoint, Plane)

Makes this object the circular arc that starts at circlePoint1, passes through circlePoint2 and ends at circlePoint3. The plane of the arc is aligned to alignTo so that both normals point to the same side; the sweep direction follows from the position of the middle point.

public void SetArc3Points(GeoPoint circlePoint1, GeoPoint circlePoint2, GeoPoint circlePoint3, Plane alignTo)

Parameters

circlePoint1 GeoPoint

Start point of the arc

circlePoint2 GeoPoint

A point on the arc between start and end point

circlePoint3 GeoPoint

End point of the arc

alignTo Plane

Plane to align the orientation to, typically the drawing plane

Exceptions

EllipseException

with SetCircle3PointsFailed when the points are collinear or coincide

SetArcPlane2Points(Plane, GeoPoint, GeoPoint)

Makes this object a half circle: the centre is the midpoint of the two points, the radius is half their distance, the arc starts at circlePoint1 and sweeps counterclockwise (with respect to the normal of p) by π to circlePoint2.

public void SetArcPlane2Points(Plane p, GeoPoint circlePoint1, GeoPoint circlePoint2)

Parameters

p Plane

The plane of the arc (only its orientation is used, the location is replaced by the centre)

circlePoint1 GeoPoint

Start point of the arc

circlePoint2 GeoPoint

End point of the arc, diametrically opposite to the start point

SetArcPlane2PointsRadiusLocation(Plane, GeoPoint, GeoPoint, double, GeoPoint, int)

Defines a circular arc in plane p from arcPoint1 to arcPoint2 with the given radius. In general there are two circles with that radius through the two points and two arcs on each of them, i.e. four solutions. locationP selects the natural one, as a user picking that point in a construction action would expect: the arc bulges to the side of the chord on which locationP lies, and it is the larger of the two arcs when locationP is farther away from the chord than half of its length, the smaller one otherwise. selSol switches to one of the other solutions. If the radius is smaller than half the distance of the points, it is enlarged to that value and the result is a half circle.

public void SetArcPlane2PointsRadiusLocation(Plane p, GeoPoint arcPoint1, GeoPoint arcPoint2, double radius, GeoPoint locationP, int selSol)

Parameters

p Plane

Plane of the arc, only its orientation is used

arcPoint1 GeoPoint

Start point of the arc

arcPoint2 GeoPoint

End point of the arc

radius double

Radius of the arc

locationP GeoPoint

A point that selects the solution, see above

selSol int

0 for the solution selected by locationP; bit 0 set takes the other centre, bit 1 set the opposite sweep direction

SetArcPlaneCenterRadius(Plane, GeoPoint, double)

Defines plane, centre and radius of a circular arc. Start and sweep parameter are left as they are, so set them afterwards with StartParameter and SweepParameter, or use SetArcPlaneCenterRadiusAngles(Plane, GeoPoint, double, double, double) to set everything at once.

public void SetArcPlaneCenterRadius(Plane plane, GeoPoint center, double majorRadius)

Parameters

plane Plane

Orientation of the arc; the location of the plane is replaced by center

center GeoPoint

Centre of the arc

majorRadius double

Radius of the arc (used for both axes)

SetArcPlaneCenterRadiusAngles(Plane, GeoPoint, double, double, double)

Defines a circular arc by plane, centre, radius, start angle and sweep angle.

public void SetArcPlaneCenterRadiusAngles(Plane plane, GeoPoint center, double majorRadius, double startParameter, double sweepParameter)

Parameters

plane Plane

Orientation of the arc; the location of the plane is replaced by center

center GeoPoint

Centre of the arc

majorRadius double

Radius of the arc (used for both axes)

startParameter double

Angle of the start point in radians, measured from the x-direction of the plane

sweepParameter double

Angle swept by the arc in radians: positive for counterclockwise (with respect to the normal of the plane), negative for clockwise, ±2π for a full circle

SetArcPlaneCenterStartEndPoint(Plane, GeoPoint2D, GeoPoint2D, GeoPoint2D, Plane, bool)

Defines a circular arc by its centre, start point and end point, all given as 2d points in pointsPlane. The plane of the arc is pointsPlane moved to the centre and aligned to alignTo so that both normals point to the same side (see Align(Plane, bool, bool)). The radius is the distance from the centre to the start point; the end point only determines the end angle. Coinciding start and end point give a full circle.

public void SetArcPlaneCenterStartEndPoint(Plane alignTo, GeoPoint2D center, GeoPoint2D startPoint, GeoPoint2D endPoint, Plane pointsPlane, bool direction)

Parameters

alignTo Plane

Plane to align the orientation to, typically the drawing plane

center GeoPoint2D

Centre of the arc, in pointsPlane

startPoint GeoPoint2D

Start point of the arc, in pointsPlane

endPoint GeoPoint2D

A point on the ray from the centre through the end point, in pointsPlane

pointsPlane Plane

Plane in which the three 2d points are given

direction bool

true for a counterclockwise arc, false for a clockwise arc (with respect to the normal of alignTo)

SetCircle3Points(GeoPoint, GeoPoint, GeoPoint, Plane)

Makes this object the full circle through three points. The plane of the circle is aligned to alignTo so that both normals point to the same side, and the circle is oriented so that the three points follow each other in the direction of the curve.

public void SetCircle3Points(GeoPoint circlePoint1, GeoPoint circlePoint2, GeoPoint circlePoint3, Plane alignTo)

Parameters

circlePoint1 GeoPoint

First point on the circle

circlePoint2 GeoPoint

Second point on the circle

circlePoint3 GeoPoint

Third point on the circle

alignTo Plane

Plane to align the orientation to, typically the drawing plane

Exceptions

EllipseException

with SetCircle3PointsFailed when the points are collinear or coincide

SetCirclePlane2Points(Plane, GeoPoint, GeoPoint)

Defines the circle by a plane and two diametrically opposite points on the circle: the centre is the midpoint of the two points, the radius is half their distance. Start and sweep parameter are not changed.

public void SetCirclePlane2Points(Plane p, GeoPoint circlePoint1, GeoPoint circlePoint2)

Parameters

p Plane

The plane of the circle (only its orientation is used, the location is replaced by the centre)

circlePoint1 GeoPoint

First point on the circle

circlePoint2 GeoPoint

Second point on the circle, opposite to the first one

SetCirclePlaneCenterRadius(Plane, GeoPoint, double)

Makes this object a full circle: the orientation is taken from plane, the centre is center, both radii are set to majorRadius, the start parameter to 0 and the sweep to 2π (counterclockwise with respect to the normal of the plane).

public void SetCirclePlaneCenterRadius(Plane plane, GeoPoint center, double majorRadius)

Parameters

plane Plane

Orientation of the circle; the location of the plane is replaced by center

center GeoPoint

Centre of the circle

majorRadius double

Radius of the circle

SetEllipse2PointsDirections(GeoPoint, GeoVector, GeoPoint, GeoVector)

Tries to make this object the full ellipse that passes through point1 with the tangent direction direction1 and through point2 with the tangent direction direction2. The points and directions must lie in a common plane; among the many ellipses that satisfy the condition one is chosen whose axes are determined by the two points and tangents. Note that the method also requires point2 to lie in the plane this ellipse currently has (e.g. the xy-plane of a freshly constructed ellipse) and fails otherwise.

public bool SetEllipse2PointsDirections(GeoPoint point1, GeoVector direction1, GeoPoint point2, GeoVector direction2)

Parameters

point1 GeoPoint

First point on the ellipse

direction1 GeoVector

Tangent direction at point1

point2 GeoPoint

Second point on the ellipse

direction2 GeoVector

Tangent direction at point2

Returns

bool

true on success; false when no ellipse could be found, the object is then unchanged

SetEllipseArc2PointsDirections(GeoPoint, GeoVector, GeoPoint, GeoVector, bool, Plane)

Tries to make this object an elliptical arc from point1 to point2 with the given tangent directions at both points, see SetEllipse2PointsDirections(GeoPoint, GeoVector, GeoPoint, GeoVector). The plane of the ellipse is aligned to alignTo so that both normals point to the same side, and the arc runs counterclockwise or clockwise with respect to that normal as arcDir says. As with SetEllipse2PointsDirections(GeoPoint, GeoVector, GeoPoint, GeoVector), point2 must lie in the plane this ellipse currently has.

public bool SetEllipseArc2PointsDirections(GeoPoint point1, GeoVector direction1, GeoPoint point2, GeoVector direction2, bool arcDir, Plane alignTo)

Parameters

point1 GeoPoint

Start point of the arc

direction1 GeoVector

Tangent direction at point1

point2 GeoPoint

End point of the arc

direction2 GeoVector

Tangent direction at point2

arcDir bool

true for a counterclockwise arc, false for a clockwise arc

alignTo Plane

Plane to align the orientation to, typically the drawing plane

Returns

bool

true on success; false when no ellipse could be found, the object is then unchanged

SetEllipseArcCenterAxis(GeoPoint, GeoVector, GeoVector, double, double)

Defines an elliptical arc by centre, axes, start and sweep parameter. The lengths of the axis vectors are the radii, their directions the directions of the axes (see SetEllipseCenterAxis(GeoPoint, GeoVector, GeoVector)).

public void SetEllipseArcCenterAxis(GeoPoint center, GeoVector majorAxis, GeoVector minorAxis, double startParameter, double sweepParameter)

Parameters

center GeoPoint

Centre of the ellipse

majorAxis GeoVector

Major axis as a vector from the centre

minorAxis GeoVector

Minor axis as a vector from the centre

startParameter double

Parameter of the start point in radians, see StartParameter

sweepParameter double

Parameter range swept by the arc in radians, positive for counterclockwise, see SweepParameter

SetEllipseCenterAxis(GeoPoint, GeoVector, GeoVector)

Makes this object a full ellipse with the given centre and axes: the lengths of the axis vectors are the radii, their directions the directions of the axes. The two vectors should be perpendicular; if they are not, the direction of the minor axis is made perpendicular to the major axis in the plane of both vectors, its length is kept. The major axis need not be the longer one. The start parameter is set to 0, the sweep to 2π.

public void SetEllipseCenterAxis(GeoPoint Center, GeoVector MajorAxis, GeoVector MinorAxis)

Parameters

Center GeoPoint

Centre of the ellipse

MajorAxis GeoVector

Major axis as a vector from the centre

MinorAxis GeoVector

Minor axis as a vector from the centre

SetEllipseCenterAxis(GeoPoint, GeoVector, GeoVector, Plane)

Makes this object a full ellipse with the given centre and axes, like SetEllipseCenterAxis(GeoPoint, GeoVector, GeoVector), but additionally aligns the plane of the ellipse to alignTo so that both normals point to the same side. This fixes the orientation (the sense of the positive sweep) e.g. when importing from a file.

public void SetEllipseCenterAxis(GeoPoint Center, GeoVector MajorAxis, GeoVector MinorAxis, Plane alignTo)

Parameters

Center GeoPoint

Centre of the ellipse

MajorAxis GeoVector

Major axis as a vector from the centre

MinorAxis GeoVector

Minor axis as a vector from the centre

alignTo Plane

Plane to align the orientation to, typically the drawing plane

SetEllipseCenterPlane(GeoPoint, Plane)

Sets the plane (i.e. the directions of the axes) and the centre of this ellipse, keeping the radii, the start and the sweep parameter.

public void SetEllipseCenterPlane(GeoPoint center, Plane plane)

Parameters

center GeoPoint

New centre

plane Plane

New plane; its x- and y-direction become the directions of the major and minor axis, its location is replaced by center

SetObjectData(IJsonReadData)

Reads the data written by GetObjectData(IJsonWriteData) back from the JSON serialization. Derived classes override it, call the base implementation and read their own properties. Objects referenced by the data may still be incomplete at this time, see IJsonSerializeDone.

public override void SetObjectData(IJsonReadData data)

Parameters

data IJsonReadData

provides the data

SetPlaneRadius(Plane, double, double)

Defines the plane and the two radii of this ellipse: the centre is the location of the plane, the major axis points in its x-direction, the minor axis in its y-direction. Start and sweep parameter are not changed. Like all Set... methods this is an undoable change that raises the change events.

public void SetPlaneRadius(Plane plane, double majorRadius, double minorRadius)

Parameters

plane Plane

Plane of the ellipse, its location is the centre

majorRadius double

Radius in the x-direction of the plane

minorRadius double

Radius in the y-direction of the plane

Split(double)

Splits the curve at the given position. The position must be in the interval 0..1 and the curve must not be closed. For closed curves Split(double, double).

public ICurve[] Split(double Position)

Parameters

Position double

Where to split

Returns

ICurve[]

the splitted curve(s)

Split(double, double)

Splits the closed curve into two open curves at the given positions.

public ICurve[] Split(double Position1, double Position2)

Parameters

Position1 double

first Position

Position2 double

second Position

Returns

ICurve[]

the splitted curve(s)

TangentParameter(GeoVector)

Returns the parameter of the point where the tangent of the ellipse is parallel to the given direction. The second point with a tangent in that direction has the parameter u + π. The direction is projected into the plane of the ellipse first.

public double TangentParameter(GeoVector Direction)

Parameters

Direction GeoVector

Direction of the tangent

Returns

double

The parameter, an angle in radians as used by Point(double)

Trim(double, double)

Modifies start and endpoint of this curve. StartPos must be less than EndPos. if StartPos is less than 0.0 or EndPos greater than 1.0 this only works for lines and (circular or elliptical) arcs.

public void Trim(double StartPos, double EndPos)

Parameters

StartPos double

New start position

EndPos double

New end position

TryPointDeriv2At(double, out GeoPoint, out GeoVector, out GeoVector)

public virtual bool TryPointDeriv2At(double position, out GeoPoint point, out GeoVector deriv, out GeoVector deriv2)

Parameters

position double
point GeoPoint
deriv GeoVector
deriv2 GeoVector

Returns

bool

Events

Constructed

Raised from the constructor whenever a new ellipse is created, i.e. for every Construct() call, every clone and every ellipse read from a file. The handler gets the new object; when it comes from Construct(), it has no geometry yet.

public static event Ellipse.ConstructedDelegate Constructed

Event Type

Ellipse.ConstructedDelegate