An Arc3d is a section of a circle in 3D, defined by its central axis,
start point and swept angle (the counterclockwise angle around the axis from the
start point to the arc's end point). This module includes functionality for
Construct a 3D arc lying on a sketch plane by providing a 2D arc specified in XY coordinates within the sketch plane.
arc =
Arc3d.on SketchPlane3d.xz
(Point2d.meters 3 1
|> Arc2d.sweptAround (Point2d.meters 1 1)
(Angle.degrees 90)
)
Arc3d.startPoint arc
--> Point3d.meters 3 0 1
Arc3d.endPoint arc
--> Point3d.meters 1 0 3Construct an arc by sweeping the given point around the given axis by the given angle:
exampleArc =
Point3d.meters 1 1 0
|> Arc3d.sweptAround Axis3d.z
(Angle.degrees 90)
Arc3d.endPoint exampleArc
--> Point3d.meters -1 1 0Positive swept angles result in a counterclockwise (right-handed) rotation around the given axis and vice versa for negative swept angles. The center point of the returned arc will lie on the given axis.
Attempt to construct an arc that starts at the first given point, passes
through the second given point and ends at the third given point. If the three
points are collinear, returns Nothing.
Arc3d.throughPoints
(Point3d.meters 0 0 1)
Point3d.origin
(Point3d.meters 0 1 0)
--> Just <|
--> Arc3d.on SketchPlane3d.yz
--> (Point2d.meters 0 1
--> |> Arc2d.sweptAround
--> (Point2d.meters 0.5 0.5)
--> (Angle.degrees 180)
--> )Get the axial direction of an arc.
Arc3d.axialDirection exampleArc
--> Direction3d.zGet the central axis of an arc. The origin point of the axis will be equal to the center point of the arc.
Get the center point of an arc.
Get the radius of an arc.
Get the start point of an arc.
Get the midpoint of an arc.
Get the end point of an arc.
Get the swept angle of an arc. A positive swept angle means that the arc is formed by rotating the given start point counterclockwise around the central axis, and vice versa for a negative angle.
Get the point along an arc at a given parameter value.
Represents a nondegenerate spline (one that has finite, non-zero length).
Attempt to construct a nondegenerate arc from a general Arc3d. If the arc
is in fact degenerate (consists of a single point), returns an Err with that
point.
Convert a nondegenerate arc back to a general Arc3d.
Get the tangent direction to a nondegenerate arc at a given parameter value.
Get both the point and tangent direction of a nondegenerate arc at a given parameter value.
Approximate an arc as a polyline, within a given tolerance:
exampleArc
|> Arc3d.toPolyline
{ maxError = Length.meters 0.1 }
--> Polyline3d.fromVertices
--> [ Point3d.meters 1 1 0
--> , Point3d.meters 0.366 1.366 0
--> , Point3d.meters -0.366 1.366 0
--> , Point3d.meters -1 1 0
--> ]In this example, every point on the returned polyline will be within 0.1 meters of the original arc.
These transformations generally behave just like the ones in the Point3d
module.
Reverse the direction of an arc, so that the start point becomes the end point and vice versa. The resulting arc will have the same axis as the original but a swept angle with the opposite sign.
Scale an arc about the given center point by the given scale.
Rotate an arc around a given axis by a given angle.
Translate an arc by a given displacement.
Translate an arc in a given direction by a given distance.
Mirror an arc across a given plane. This flips the sign of the arc's swept angle.
Project an arc into a sketch plane. Note that the result is an elliptical arc, not a circular one!
Convert an arc from one units type to another, by providing a conversion factor given as a rate of change of destination units with respect to source units.
Convert an arc from one units type to another, by providing an 'inverse' conversion factor given as a rate of change of source units with respect to destination units.
Take an arc defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
Take an arc considered to be defined in local coordinates relative to a given reference frame, and return that arc expressed in global coordinates.
You are unlikely to need to use these functions directly, but they are useful if you are writing low-level geometric algorithms.
Get the first derivative of an arc at a given parameter value.