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

RSAGL.Math.AbstractVector

Description

Provides generic typeclasses for common operations among many types: addition, subtraction, scalar multiplication, magnitude, and zero.

Synopsis

Documentation

class AbstractAdd p v | p -> v whereSource

A data type that supports addition.

Methods

add :: p -> v -> pSource

class AbstractScale v whereSource

A data type that supports scalar multiplication.

  • scalarMultiply 0 a = zero

Methods

scalarMultiply :: RSdouble -> v -> vSource

abstractScaleTo :: (AbstractScale v, AbstractMagnitude v) => RSdouble -> v -> vSource

Force a vector to the specified magnitude.

abstractSum :: (AbstractAdd p v, AbstractZero p) => [v] -> pSource

Sum of a list.

abstractAverage :: (AbstractAdd p v, AbstractSubtract p v, AbstractVector v, AbstractZero p) => [p] -> pSource

Average of a list.

abstractDistance :: (AbstractMagnitude v, AbstractSubtract p v) => p -> p -> RSdoubleSource

Distance between two points, based on the magnitude of the difference.