opensolid/geometry/3.0.0

NOTE: this package is not compatible with Elm 0.19.1

CubicSpline3d

CubicSpline3d

A CubicSpline3d is a cubic Bézier curve in 3D defined by a start point, end point and two control points. This module contains functionality for

  • Constructing splines
  • Evaluating points and derivatives along a spline
  • Scaling, rotating, translating or mirroring a spline
  • Converting a spline between local and global coordinates in different reference frames
type alias CubicSpline3d =
CubicSpline3d

Constructors

{ startPoint : Point3d
, startControlPoint : Point3d
, endControlPoint : Point3d
, endPoint : Point3d
}
-> CubicSpline3d
{ startPoint : Point3d
, startDerivative : Vector3d
, endPoint : Point3d
, endDerivative : Vector3d
}
-> CubicSpline3d
on : SketchPlane3d -> CubicSpline2d -> CubicSpline3d
fromQuadraticSpline : QuadraticSpline3d -> CubicSpline3d

Properties

startPoint : CubicSpline3d -> Point3d
endPoint : CubicSpline3d -> Point3d
startControlPoint : CubicSpline3d -> Point3d
endControlPoint : CubicSpline3d -> Point3d
startDerivative : CubicSpline3d -> Vector3d
endDerivative : CubicSpline3d -> Vector3d
boundingBox : CubicSpline3d -> BoundingBox3d

Evaluation

pointOn : CubicSpline3d -> ParameterValue -> Point3d
pointsAt : List ParameterValue -> CubicSpline3d -> List Point3d
nondegenerate : CubicSpline3d -> Result Point3d Nondegenerate
fromNondegenerate : Nondegenerate -> CubicSpline3d
tangentDirection : Nondegenerate -> ParameterValue -> Direction3d
tangentDirectionsAt : List ParameterValue -> Nondegenerate -> List Direction3d
sample : Nondegenerate -> ParameterValue -> ( Point3d, Direction3d )
List ParameterValue
-> Nondegenerate
-> List ( Point3d, Direction3d )

Transformations

reverse : CubicSpline3d -> CubicSpline3d
scaleAbout : Point3d -> Float -> CubicSpline3d -> CubicSpline3d
rotateAround : Axis3d -> Float -> CubicSpline3d -> CubicSpline3d
translateBy : Vector3d -> CubicSpline3d -> CubicSpline3d
translateIn : Direction3d -> Float -> CubicSpline3d -> CubicSpline3d
mirrorAcross : Plane3d -> CubicSpline3d -> CubicSpline3d
projectOnto : Plane3d -> CubicSpline3d -> CubicSpline3d

Coordinate conversions

relativeTo : Frame3d -> CubicSpline3d -> CubicSpline3d
placeIn : Frame3d -> CubicSpline3d -> CubicSpline3d
projectInto : SketchPlane3d -> CubicSpline3d -> CubicSpline2d

Subdivision

bisect : CubicSpline3d -> ( CubicSpline3d, CubicSpline3d )
splitAt : ParameterValue -> CubicSpline3d -> ( CubicSpline3d, CubicSpline3d )

Arc length parameterization

arcLengthParameterized : { maxError : Float } -> CubicSpline3d -> ArcLengthParameterized
arcLength : ArcLengthParameterized -> Float
pointAlong : ArcLengthParameterized -> Float -> Maybe Point3d
tangentDirectionAlong : ArcLengthParameterized -> Float -> Maybe Direction3d
sampleAlong : ArcLengthParameterized -> Float -> Maybe ( Point3d, Direction3d )

Low level

An ArcLengthParameterized value is a combination of an ArcLengthParameterization and an underlying CubicSpline3d. If you need to do something fancy, you can extract these two values separately.

arcLengthParameterization : ArcLengthParameterized -> ArcLengthParameterization
fromArcLengthParameterized : ArcLengthParameterized -> CubicSpline3d

Differentiation

You are unlikely to need to use these functions directly, but they are useful if you are writing low-level geometric algorithms. As with the other curve evaluation functions, passing a parameter value outside the range 0 to 1 will result in Nothing.

firstDerivative : CubicSpline3d -> ParameterValue -> Vector3d
firstDerivativesAt : List ParameterValue -> CubicSpline3d -> List Vector3d
secondDerivative : CubicSpline3d -> ParameterValue -> Vector3d
secondDerivativesAt : List ParameterValue -> CubicSpline3d -> List Vector3d
thirdDerivative : CubicSpline3d -> Vector3d
maxSecondDerivativeMagnitude : CubicSpline3d -> Float