A Sphere3d
is defined by its center point and radius. This module contains
functionality for:
Geometry.Types.Sphere3d units coordinates
atPoint : Point3d units coordinates -> Quantity Basics.Float units -> Sphere3d units coordinates
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.
withRadius : Quantity Basics.Float units -> Point3d units coordinates -> Sphere3d units coordinates
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) listOfPoints
atOrigin : Quantity Basics.Float units -> Sphere3d units coordinates
Construct a sphere at the origin with the given radius.
throughPoints : Point3d units coordinates -> Point3d units coordinates -> Point3d units coordinates -> Point3d units coordinates -> Maybe (Sphere3d units coordinates)
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)
--> Nothing
centerPoint : Sphere3d units coordinates -> Point3d units coordinates
Get the center point of a sphere.
radius : Sphere3d units coordinates -> Quantity Basics.Float units
Get the radius of a sphere.
diameter : Sphere3d units coordinates -> Quantity Basics.Float units
Get the diameter of a sphere (twice the radius).
volume : Sphere3d units coordinates -> Quantity Basics.Float (Quantity.Cubed units)
Get the volume of a sphere.
surfaceArea : Sphere3d units coordinates -> Quantity Basics.Float (Quantity.Squared units)
Get the surface area of a sphere.
circumference : Sphere3d units coordinates -> Quantity Basics.Float units
Get the circumference of a sphere (the circumference of a great circle of the sphere).
boundingBox : Sphere3d units coordinates -> BoundingBox3d units coordinates
Get the minimal bounding box containing a given sphere.
Sphere3d.boundingBox exampleSphere
--> BoundingBox3d.from
--> (Point3d.meters -2 -1 -2)
--> (Point3d.meters 4 5 4)
contains : Point3d units coordinates -> Sphere3d units coordinates -> Basics.Bool
Check if a sphere contains a given point.
These transformations generally behave just like the ones in the Point3d
module.
scaleAbout : Point3d units coordinates -> Basics.Float -> Sphere3d units coordinates -> Sphere3d units coordinates
Scale a sphere around a given point by a given scale.
rotateAround : Axis3d units coordinates -> Angle -> Sphere3d units coordinates -> Sphere3d units coordinates
Rotate a sphere around a given axis by a given angle.
translateBy : Vector3d units coordinates -> Sphere3d units coordinates -> Sphere3d units coordinates
Translate a sphere by a given displacement.
translateIn : Direction3d coordinates -> Quantity Basics.Float units -> Sphere3d units coordinates -> Sphere3d units coordinates
Translate a sphere in a given direction by a given distance.
mirrorAcross : Plane3d units coordinates -> Sphere3d units coordinates -> Sphere3d units coordinates
Mirror a sphere across a given plane.
projectOnto : Plane3d units coordinates -> Sphere3d units coordinates -> Circle3d units coordinates
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)
projectInto : SketchPlane3d units coordinates3d { defines : coordinates2d } -> Sphere3d units coordinates3d -> Circle2d units coordinates2d
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)
at : Quantity Basics.Float (Quantity.Rate units2 units1) -> Sphere3d units1 coordinates -> Sphere3d units2 coordinates
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.
at_ : Quantity Basics.Float (Quantity.Rate units1 units2) -> Sphere3d units1 coordinates -> Sphere3d units2 coordinates
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.
relativeTo : Frame3d units globalCoordinates { defines : localCoordinates } -> Sphere3d units globalCoordinates -> Sphere3d units localCoordinates
Take a sphere defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
placeIn : Frame3d units globalCoordinates { defines : localCoordinates } -> Sphere3d units localCoordinates -> Sphere3d units globalCoordinates
Take a sphere considered to be defined in local coordinates relative to a given reference frame, and return that sphere expressed in global coordinates.