A Sphere3d is defined by its center point and radius. This module contains
functionality for:
Construct a sphere from its radius and center point:
exampleSphere =
Sphere3d.withRadius (Length.meters 3)
(Point3d.meters 1 2 1)If you pass a negative radius, the absolute value will be used.
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.
Sphere3d.centerPoint exampleSphere
--> Point3d.meters 1 2 1Get the radius of a sphere.
Sphere3d.radius exampleSphere
--> Length.meters 3Get the diameter of a sphere.
Sphere3d.diameter exampleSphere
--> Length.meters 6Get the volume of a sphere.
Sphere3d.volume exampleSphere
--> Volume.cubicMeters 113.0973Get the surface area of a sphere.
Sphere3d.surfaceArea exampleSphere
--> Area.squareMeters 113.0973Get the circumference of a sphere (the circumference of a great circle of the sphere).
Sphere3d.circumference exampleSphere
--> Length.meters 18.8496Get the minimal bounding box containing a given sphere.
Sphere3d.boundingBox exampleSphere
--> BoundingBox3d.fromExtrema
--> { minX = Length.meters -2
--> , maxX = Length.meters 4
--> , minY = Length.meters -1
--> , maxY = Length.meters 5
--> , minZ = Length.meters -2
--> , maxZ = Length.meters 4
--> }Check if a sphere contains a given point.
exampleSphere
|> Sphere3d.contains (Point3d.meters 4 2 1)
--> True
exampleSphere
|> Sphere3d.contains (Point3d.meters 4.00001 2 1)
--> FalseConvert 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.
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)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.