[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 136)] [Serializable] public struct Circle : IEpsilonComparable<Circle>, ICloneable
Represents a circle in 3D.

The values used are a radius and an orthonormal frame of the plane containing the circle, with origin at the center.

The circle is parameterized by radians from 0 to 2 Pi given by

t -> center + cos(t)*radius*xaxis + sin(t)*radius*yaxis

where center, xaxis and yaxis define the orthonormal frame of the circle plane.

Remarks: >An IsValid circle has positive radius and an IsValid plane defining the frame.

Constructors

Circle

#Since v5.0
public Circle(Arc arc)
Initializes a circle from an arc.
arc (Arc)Arc that defines the plane and radius.

Circle

#Since v5.0
public Circle(double radius)
Initializes a circle with center (0,0,0) in the world XY plane.
radius (double)Radius of circle, should be a positive number.

Circle

#ExampleSince v5.0
public Circle(Plane plane, double radius)
Initializes a circle on a plane with a given radius.
plane (Plane)Plane of circle. Plane origin defines the center of the circle.
radius (double)Radius of circle (should be a positive value).

Circle

#Since v5.0
public Circle(Plane plane, Point3d center, double radius)
Initializes a circle parallel to a given plane with given center and radius.
plane (Plane)Plane for circle.
center (Point3d)Center point override.
radius (double)Radius of circle (should be a positive value).

Circle

#ExampleSince v5.0
public Circle(Point3d center, double radius)
Initializes a circle parallel to the world XY plane with given center and radius.
center (Point3d)Center of circle.
radius (double)Radius of circle (should be a positive value).

Circle

#Since v5.0
public Circle(Point3d point1, Point3d point2, Point3d point3)
Initializes a circle through three 3d points.
point1 (Point3d)The start/end of the circle is at point1.
point2 (Point3d)Second point on the circle.
point3 (Point3d)Third point on the circle.

Circle

#Since v5.0
public Circle(Point3d startPoint, Vector3d tangentAtP, Point3d pointOnCircle)
Initializes a circle from two 3d points and a tangent at the first point. The start/end of the circle is at point "startPoint".
Remarks: May create an Invalid circle
startPoint (Point3d)Start point of circle.
tangentAtP (Vector3d)Tangent vector at start.
pointOnCircle (Point3d)Point coincident with desired circle.

Properties

BoundingBox

#Since v5.0
public BoundingBox BoundingBox { get; }
Gets the circle's 3d axis aligned bounding box.
3d bounding box.

Center

#Since v5.0
public Point3d Center { get; set; }
Gets or sets the center point of this circle.

Circumference

#Since v5.0
public double Circumference { get; set; }
Gets or sets the circumference of this circle.

Diameter

#Since v5.0
public double Diameter { get; set; }
Gets or sets the diameter (radius * 2.0) of this circle. Diameters should be positive values.

IsValid

#Since v5.0
public bool IsValid { get; }
A valid circle has radius larger than 0.0 and a base plane which is must also be valid.

Normal

#Since v5.0
public Vector3d Normal { get; }
Gets the normal vector for this circle.

Plane

#Since v5.0
public Plane Plane { get; set; }
Gets or sets the plane of the circle.

Radius

#Since v5.0
public double Radius { get; set; }
Gets or sets the radius of this circle. Radii should be positive values.

Unset

#Since v5.0
public static Circle Unset { get; }
Gets a circle with Unset components.

Methods

ClosestParameter

#Since v5.0
[ConstOperation] public bool ClosestParameter(Point3d testPoint, out double t)
Gets the parameter on the circle which is closest to a test point.
testPoint (Point3d)Point to project onto the circle.
t (out double)Parameter on circle closes to testPoint.
true on success, false on failure.

ClosestPoint

#Since v5.0
[ConstOperation] public Point3d ClosestPoint(Point3d testPoint)
Gets the point on the circle which is closest to a test point.
testPoint (Point3d)Point to project onto the circle.
The point on the circle that is closest to testPoint or Point3d.Unset on failure.

DerivativeAt

#Since v5.0
[ConstOperation] public Vector3d DerivativeAt(int derivative, double t)
Determines the value of the Nth derivative at a parameter.
derivative (int)Which order of derivative is wanted.
t (double)Parameter to evaluate derivative. Valid values are 0, 1, 2 and 3.
The derivative of the circle at the given parameter.

EpsilonEquals

#Since v5.4
[ConstOperation] public bool EpsilonEquals(Circle other, double epsilon)
Check that all values in other are within epsilon of the values in this
other (Circle)
epsilon (double)
EpsilonEquals

IsInPlane

#Since v5.0
[ConstOperation] public bool IsInPlane(Plane plane, double tolerance)
Evaluates whether or not this circle is co-planar with a given plane.
plane (Plane)Plane.
tolerance (double)Tolerance to use.
true if the circle plane is co-planar with the given plane within tolerance.

PointAt

#Since v5.0
[ConstOperation] public Point3d PointAt(double t)
Circles use trigonometric parameterization: t -> center + cos(t)*radius*xaxis + sin(t)*radius*yaxis.
t (double)Parameter of point to evaluate.
The point on the circle at the given parameter.

Reverse

#Since v5.0
public void Reverse()
Reverse the orientation of the circle. Changes the domain from [a,b] to [-b,-a].

Rotate

#Since v5.0
public bool Rotate(double angle, Vector3d axis, Point3d point)
Rotates the circle through a given angle.
angle (double)Angle (in radians) of the rotation.
axis (Vector3d)Rotation axis.
point (Point3d)Rotation anchor point.
true on success, false on failure.

Rotate

#Since v5.0
public bool Rotate(double angle, Vector3d axis)
Rotates the circle through a given angle.
angle (double)Angle (in radians) of the rotation.
axis (Vector3d)Rotation axis.
true on success, false on failure.

Rotate

#Since v5.0
public bool Rotate(double sinAngle, double cosAngle, Vector3d axis, Point3d point)
Rotates the circle around an axis that starts at the provided point.
sinAngle (double)The value returned by Math.Sin(angle) to compose the rotation.
cosAngle (double)The value returned by Math.Cos(angle) to compose the rotation.
axis (Vector3d)A rotation direction.
point (Point3d)A rotation base point.
true on success, false on failure.

Rotate

#Since v5.0
public bool Rotate(double sinAngle, double cosAngle, Vector3d axis)
Rotates the circle around an axis that starts at the base plane origin.
sinAngle (double)The value returned by Math.Sin(angle) to compose the rotation.
cosAngle (double)The value returned by Math.Cos(angle) to compose the rotation.
axis (Vector3d)A rotation axis.
true on success, false on failure.
Explicit

ICloneable.Clone

#

TangentAt

#Since v5.0
[ConstOperation] public Vector3d TangentAt(double t)
Circles use trigonometric parameterization: t -> center + cos(t)*radius*xaxis + sin(t)*radius*yaxis.
t (double)Parameter of tangent to evaluate.
The tangent at the circle at the given parameter.

ToNurbsCurve

#Since v5.0
[ConstOperation] public NurbsCurve ToNurbsCurve()
Constructs a nurbs curve representation of this circle. This amounts to the same as calling NurbsCurve.CreateFromCircle().
A nurbs curve representation of this circle or null if no such representation could be made.

ToNurbsCurve

#Since v6.0
[ConstOperation] public NurbsCurve ToNurbsCurve(int degree, int cvCount)
Create a uniform non-rational cubic NURBS approximation of a circle.
degree (int)>=1
cvCount (int)cv count >=5
NURBS curve approximation of a circle on success

Transform

#Since v5.0
public bool Transform(Transform xform)
Transforms this circle using an transformation matrix.
Remarks: Circles may not be transformed accurately if the transformation defines a non-euclidean transformation.
xform (Transform)Transformation to apply.
true on success, false on failure.

Translate

#Since v5.0
public bool Translate(Vector3d delta)
Moves the circle.
delta (Vector3d)Translation vector.
true on success, false on failure.

TryFitCircleToPoints

#Since v6.2
public static bool TryFitCircleToPoints(IEnumerable<Point3d> points, out Circle circle)
Attempt to fit a circle through a set of points.
points (IEnumerable<Point3d>)The points through which to fit.
circle (out Circle)The resulting circle on success.
true on success, false on failure.

TryFitCircleTT

#Since v5.0
public static Circle TryFitCircleTT(Curve c1, Curve c2, double t1, double t2)
Try to fit a circle to two curves using tangent relationships.
c1 (Curve)First curve to touch.
c2 (Curve)Second curve to touch.
t1 (double)Parameter on first curve close to desired solution.
t2 (double)Parameter on second curve closet to desired solution.
Valid circle on success, Circle.Unset on failure.

TryFitCircleTTT

#Since v5.0
public static Circle TryFitCircleTTT(Curve c1, Curve c2, Curve c3, double t1, double t2, double t3)
Try to fit a circle to three curves using tangent relationships.
c1 (Curve)First curve to touch.
c2 (Curve)Second curve to touch.
c3 (Curve)Third curve to touch.
t1 (double)Parameter on first curve close to desired solution.
t2 (double)Parameter on second curve closet to desired solution.
t3 (double)Parameter on third curve close to desired solution.
Valid circle on success, Circle.Unset on failure.

TrySmallestEnclosingCircle

#Since v8.4
public static bool TrySmallestEnclosingCircle(IEnumerable<Point2d> points, double tolerance, out Circle circle, out int[] indicesOnCircle)
Attempt to create the smallest circle enclosing a set of planar points.
points (IEnumerable<Point2d>)The points to enclose.
tolerance (double)The tolerance to use
circle (out Circle)The resulting circle on success.
indicesOnCircle (out int[])If possible, indices of two or three points that define the circle
true on success, false on failure.