A Sphere3d is defined by its center point and radius. This module contains
functionality for:
Construct a sphere from its center point and radius:
exampleSphere =
Sphere3d.atPoint (Point3d.meters 1 2 1)
(Length.meters 3)If you pass a negative radius, the absolute value will be used.
Construct a sphere from its radius and center point. Flipped version of
atPoint that may be more useful in some situations like constructing a bunch
of spheres of the same radius at different points:
spheres =
List.map (Sphere3d.withRadius radius) listOfPointsConstruct a sphere at the origin with the given radius.
Attempt to construct a sphere that passes through the four given points.
Returns Nothing if four given points are coplanar.
Sphere3d.throughPoints
(Point3d.meters 1 0 0)
(Point3d.meters -1 0 0)
(Point3d.meters 0 1 0)
(Point3d.meters 0 0 0.5)
--> Just <|
--> Sphere3d.withRadius (Length.meters 1.25)
--> (Point3d.meters 0 0 -0.75)
-- Four coplanar points (in the XY plane)
Sphere3d.throughPoints
(Point3d.meters 1 0 0)
(Point3d.meters -1 0 0)
(Point3d.meters 0 1 0)
(Point3d.meters 0 -1 0)
--> NothingGet the center point of a sphere.
Get the radius of a sphere.
Get the diameter of a sphere (twice the radius).
Get the volume of a sphere.
Get the surface area of a sphere.
Get the circumference of a sphere (the circumference of a great circle of the sphere).
Get the minimal bounding box containing a given sphere.
Sphere3d.boundingBox exampleSphere
--> BoundingBox3d.from
--> (Point3d.meters -2 -1 -2)
--> (Point3d.meters 4 5 4)Check if a sphere contains a given point.
These transformations generally behave just like the ones in the Point3d
module.
Scale a sphere around a given point by a given scale.
Rotate a sphere around a given axis by a given angle.
Translate a sphere by a given displacement.
Translate a sphere in a given direction by a given distance.
Mirror a sphere across a given plane.
Find the orthographic projection of a sphere onto a plane.
Sphere3d.projectOnto Plane3d.xy exampleSphere
--> Circle3d.withRadius (Length.meters 3)
--> Direction3d.z
--> (Point3d.meters 1 2 0)Find the orthographic projection of a sphere into a sketch plane.
Sphere3d.projectInto SketchPlane3d.xy exampleSphere
--> Circle2d.withRadius (Length.meters 3)
--> (Point2d.meters 1 2)Convert a sphere 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 a sphere 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 a sphere defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
Take a sphere considered to be defined in local coordinates relative to a given reference frame, and return that sphere expressed in global coordinates.