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
Arcs can be constructed explicitly by passing a record with axis, startPoint
and sweptAngle fields to the Arc3d constructor, for example
exampleArc =
Arc3d
{ axis = Axis3d.z
, startPoint = Point3d ( 2, 0, 1 )
, sweptAngle = degrees 90
}Note that the origin point of the axis is not required to be the same as the
arc's center point - here the origin point of the given axis is
Point3d.origin, while the center point of the arc is Point3d ( 0, 0, 1 )
(the start point of the arc projected onto the axis).
Get the central axis of an arc.
Arc3d.axis exampleArc
--> Axis3d.zGet the center point of an arc.
Arc3d.centerPoint exampleArc
--> Point3d ( 0, 0, 1 )The center point of an arc is equal to its start point projected onto its central axis, which may not be equal to the origin point of that axis.
Get direction of an arc's axis;
Arc3d.axialDirection arcis equivalent to
Axis3d.direction (Arc3d.axis arc)Get the radius of an arc.
Arc3d.radius exampleArc
--> 2Get the start point of an arc.
Arc3d.startPoint exampleArc
--> Point3d ( 2, 0, 1 )Get the end point of an arc.
Arc3d.endPoint exampleArc
--> Point3d ( 0, 2, 1 )Get the point along an arc at a given parameter value. A parameter value of 0 corresponds to the start point of the arc and a value of 1 corresponds to the end point.
Arc3d.point exampleArc 0.5
--> Point3d ( 1.4142, 1.4142, 1 )Get the swept angle of an arc in radians.
Arc2d.sweptAngle exampleArc
--> 1.5708A 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.
Scale an arc about the given center point by the given scale.
point =
Point3d ( 1, 0, 1 )
Arc3d.scaleAbout point 2 exampleArc
--> Arc3d
--> { axis =
--> Axis3d
--> { originPoint = Point3d ( -1, 0, -1 )
--> , direction = Direction3d.z
--> }
--> , startPoint = Point3d ( 3, 0, 1 )
--> , sweptAngle = degrees 90
--> }Rotate an arc around a given axis by a given angle (in radians).
Arc3d.rotateAround Axis3d.x (degrees 90) exampleArc
--> Arc3d
--> { axis = Axis3d.flip Axis3d.y
--> , startPoint = Point3d ( 2, -1, 0 )
--> , sweptAngle = degrees 90
--> }Translate an arc by a given displacement.
displacement =
Vector3d ( 2, 1, 3 )
Arc3d.translateBy displacement exampleArc
--> Arc3d
--> { axis =
--> Axis3d
--> { originPoint = Point3d ( 2, 1, 3 )
--> , direction = Direction3d.z
--> }
--> , startPoint = Point3d ( 4, 1, 4 )
--> , sweptAngle = degrees 90
--> }Mirror an arc across a given plane.
Arc3d.mirrorAcross Plane3d.xy exampleArc
Arc3d
{ axis = Axis3d.flip Axis3d.z
, startPoint = Point3d ( 2, 0, -1 )
, sweptAngle = degrees -90
}Note that this flips the sign of the arc's swept angle.
Take an arc defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
localFrame =
Frame3d.at (Point3d ( 1, 2, 3 ))
Arc3d.relativeTo localFrame exampleArc
--> Arc3d
--> { axis =
--> Axis3d
--> { originPoint = Point3d ( -1, -2, -3 )
--> , direction = Direction3d.z
--> }
--> , startPoint = Point3d ( 1, -2, -2 )
--> , sweptAngle = degrees 90
--> }Take an arc considered to be defined in local coordinates relative to a given reference frame, and return that arc expressed in global coordinates.
localFrame =
Frame3d.at (Point3d ( 1, 2, 3 ))
Arc3d.placeIn localFrame exampleArc
--> Arc3d
--> { axis =
--> Axis3d
--> { originPoint = Point3d ( 1, 2, 3 )
--> , direction = Direction3d.z
--> }
--> , startPoint = Point3d ( 3, 2, 4 )
--> , sweptAngle = degrees 90
--> }
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.