rsagl-math-0.6.0.1: The RogueStar Animation and Graphics Library: Mathematics

RSAGL.Math.Curve

Synopsis

# Documentation

data Curve a Source

A `Curve` is a parametric function from a one-dimensional space into a space of an arbitrary datatype. The key feature of a `Curve` is that it is aware of it's own sampling interval. Using this information and appropriate arithmetic and scalar multiplication functions provided by RSAGL.AbstractVector, a `Curve` can be differentiated or integrated.

Instances

 Functor Curve Applicative Curve NFData (Curve a) AffineTransformable a => AffineTransformable (Curve a)

zipCurve :: (x -> y -> z) -> Curve x -> Curve y -> Curve zSource

Combine two curves using an arbitrary function.

iterateCurve :: Integer -> Curve x -> [x]Source

Sample a curve at regular intervals in the range 0..1 inclusive.

transposeCurve :: Curve (Curve a) -> Curve (Curve a)Source

Transpose the inner and outer components of a curve.

curve :: (RSdouble -> a) -> Curve aSource

Define a simple curve.

data Surface a Source

A `Surface` is a based on a `Curve` with an output of another `Curve`.

Instances

 Functor Surface Applicative Surface NFData (Surface a) AffineTransformable a => AffineTransformable (Surface a)

surface :: (RSdouble -> RSdouble -> a) -> Surface aSource

Define a simple surface.

Transpose the axes of a `Surface`.

zipSurface :: (x -> y -> z) -> Surface x -> Surface y -> Surface zSource

Combine two surfaces using an arbitrary function.

iterateSurface :: (Integer, Integer) -> Surface a -> [[a]]Source

Sample a surface at regularly spaced lattice points in the range 0..1 inclusive.

halfIterateSurface :: Integer -> Surface a -> [Curve a]Source

Sample the outer `Curve` of a `Surface` at regularly spaced intervals.

Transpose a surface while flipping the inner curve, so that that orientable surfaces retain their original orientation.

Translate a curve along the axis of the input parameter.

scaleCurve :: RSdouble -> Curve a -> Curve aSource

Scale a curve along the axis of the input parameter. Factors greater than one have a zoom in effect, while factors less than one have a zoom out effect.

clampCurve :: (RSdouble, RSdouble) -> Curve a -> Curve aSource

Clamp lower and upper bounds of a curve along the axis of the input parameter.

loopCurve :: (RSdouble, RSdouble) -> Curve a -> Curve aSource

Loop a curve onto itself at the specified bounds.

controlCurve :: (RSdouble, RSdouble) -> (RSdouble, RSdouble) -> Curve a -> Curve aSource

Transform a curve by manipulating control points.

transformCurve2 :: (forall u. Curve u -> Curve u) -> (forall v. Curve v -> Curve v) -> Curve (Curve a) -> Curve (Curve a)Source

Lift two curve transformations onto each axis of a second order curve.

An identity `Surface`.

translateSurface :: (RSdouble, RSdouble) -> Surface a -> Surface aSource

Translate a surface over each of its input parameter axes, as translateCurve.

scaleSurface :: (RSdouble, RSdouble) -> Surface a -> Surface aSource

Scale a surface along each of its input parameter axes, as scaleCurve.

transformSurface :: (Curve (Curve a) -> Curve (Curve a)) -> Surface a -> Surface aSource

Lift a transformation on a second order `Curve` onto a Surface.

transformSurface2 :: (forall u. Curve u -> Curve u) -> (forall v. Curve v -> Curve v) -> Surface a -> Surface aSource

Lift two curve transformations onto each axis of a Surface.

surfaceDerivative :: (AbstractSubtract p v, AbstractScale v) => Surface p -> Surface (v, v)Source

Take the piecewise derivative of a `Surface` along the inner and outer curves.

curveDerivative :: (AbstractSubtract p v, AbstractScale v) => Curve p -> Curve vSource

Take the derivative of a `Curve`.

Determine the orientation of a `Surface` by passing very small circles centered on each sampled point as the parametric input.

A gotchya with this operation is that as much as 3/4ths of the orientation loop may lie outside of the 0..1 range that is normally sampled. Depending on how the surface is constructed, this may produce unexpected results. The solution is to clamp the the problematic parametric inputs at 0 and 1 using `clampSurface`.

As a rule, do clamp longitudinal axes that come to a singularity at each end. Do not clamp latitudinal axes that are connected at each end.

Try to determine the normal vector to a curve.

Try to determine the normal vectors of a surface using multiple techniques.

data IntervalSample a Source

An interval of a curve, including the curve, lower and upper bounds of the interval, and an instantaneous sample value for that interval.

Lower and upper bounds of an `IntervalSample`.

Size of the range of an `IntervalSample`.

Integral of the sample value over the range of the `IntervalSample`.

Sampling algorithm that takes a fixed count of samples.

Sampling algorithm that takes increasing numbers of samples over intervals where the magnitude of the sample is large.

integrateCurve :: (AbstractAdd p v, AbstractScale v, AbstractZero p) => SamplingAlgorithm v -> Curve v -> p -> pSource

Definite integral of a curve.