A Circle3d is defined by its center point, axial direction and radius. The
axial direction is the direction of the axis through the center of the circle
that all points on the circle are equidistant from, or equivalently the normal
direction of the plane defined by the circle. Currently you can only do a few
basic things with circles, such as measuring the area or circumference, but this
should increase in the future.
Circles can be constructed by passing a record with centerPoint,
axialDirection and radius fields to the Circle3d constructor, for example
exampleCircle =
Circle3d
{ centerPoint = Point3d ( 2, 0, 1 )
, axialDirection = Direction3d.z
, radius = 3
}You must ensure the provided radius is positive (or zero, but that's not a very useful circle).
Get the axial direction of a circle.
Circle3d.axialDirection exampleCircle
--> Direction3d.zGet the radius of a circle.
Circle3d.radius exampleCircle
--> 3Get the diameter of a circle.
Circl3d.diameter exampleCircle
--> 6Get the area of a circle.
Circle3d.area exampleCircle
--> 28.2743Get the circumference of a circle.
Circle3d.circumference exampleCircle
--> 18.8496Scale a circle around a given point by a given scale.
Circle3d.scaleAbout Point3d.origin 3 exampleCircle
--> Circle3d
--> { centerPoint = Point3d ( 6, 0, 3 )
--> , axialDirection = Direction3d.z
--> , radius = 9
--> }Rotate a circle around a given axis by a given angle (in radians).
Circle3d.rotateAround Axis3d.y (degrees 90) exampleCircle
--> Circle3d
--> { centerPoint = Point3d ( 1, 0, -2 )
--> , axialDirection = Direction3d.x
--> , radius = 3
--> }Translate a circle by a given displacement.
displacement =
Vector3d ( 2, 1, 3 )
Circle3d.translateBy displacement exampleCircle
--> Circle3d
--> { centerPoint = Point3d ( 4, 1, 4 )
--> , axialDirection = Direction3d.z
--> , radius = 3
--> }Mirror a circle across a given plane.
Circle3d.mirrorAcross Plane3d.xy exampleCircle
--> Circle3d
--> { centerPoint = Point3d ( 2, 0, -1 )
--> , axialDirection = Direction3d ( 0, 0, -1 )
--> , radius = 3
--> }Take a circle defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
localFrame =
Frame3d.at (Point3d ( 1, 2, 3 ))
Circle3d.relativeTo localFrame exampleCircle
--> Circle3d
--> { centerPoint = Point3d ( 1, -2, -2 )
--> , axialDirection = Direction3d.z
--> , radius = 3
--> }Take a circle considered to be defined in local coordinates relative to a given reference frame, and return that circle expressed in global coordinates.
localFrame =
Frame3d.at (Point3d ( 1, 2, 3 ))
Circle3d.placeIn localFrame exampleCircle
--> Circle3d
--> { centerPoint = Point3d ( 3, 2, 4 )
--> , axialDirection = Direction3d.z
--> , radius = 3
--> }Get the minimal bounding box containing a given circle.
Circle3d.boundingBox exampleCircle
--> BoundingBox3d
--> { minX = -1
--> , maxX = 5
--> , minY = -3
--> , maxY = 3
--> , minZ = 1
--> , maxZ = 1
--> }
Get the center point of a circle.