Package-level declarations

Types

Link copied to clipboard
@Serializable(with = AngleSerializer::class)
interface Angle : Comparable<Angle>
Link copied to clipboard
object AngleSerializer : KSerializer<Angle>
Link copied to clipboard
@Serializable
data class Circle2D(val center: DoubleVector2D, val radius: Double)

A circle in 2D space

Link copied to clipboard
value class Degrees(val value: Double) : Angle

Type safe degrees

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface Line<out V : Vector>

A line formed by start vector of start and a direction vector. Direction vector is not necessarily normalized, but its length does not affect line properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface LineSegment<out V : Vector>

A directed line segment between begin and end

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface Polygon<T>

A closed polygon in 2D space

Link copied to clipboard
@Serializable
value class Radians(val value: Double) : Angle

Type safe radians

Link copied to clipboard
interface ReferenceFrame
Link copied to clipboard
Link copied to clipboard
interface Vector
Link copied to clipboard
interface Vector2D<T> : Buffer<T> , Vector
Link copied to clipboard
interface Vector3D<T> : Buffer<T> , Vector

Functions

Link copied to clipboard
fun abs(angle: Angle): Angle
Link copied to clipboard
Link copied to clipboard
operator fun <T> Vector2D<T>.component1(): T
operator fun <T> Vector3D<T>.component1(): T
Link copied to clipboard
operator fun <T> Vector2D<T>.component2(): T
operator fun <T> Vector3D<T>.component2(): T
Link copied to clipboard
operator fun <T> Vector3D<T>.component3(): T
Link copied to clipboard
fun cos(angle: Angle): Double
Link copied to clipboard
fun Double.equalsFloat(other: Double, precision: Double = DEFAULT_PRECISION): Boolean
fun Double.equalsFloat(other: Float, precision: Double = DEFAULT_PRECISION): Boolean

Float equality within given precision

Link copied to clipboard
fun <V : Vector> LineSegment<V>.equalsLine(space: GeometrySpace<V>, other: LineSegment<V>, precision: Double = DEFAULT_PRECISION): Boolean

Line equality using GeometrySpace.norm provided by the space and given precision

Link copied to clipboard
fun Float64Vector2D.equalsVector(other: Float64Vector2D, precision: Double = DEFAULT_PRECISION): Boolean
fun Float64Vector3D.equalsVector(other: Float64Vector3D, precision: Double = DEFAULT_PRECISION): Boolean

Vector equality using Euclidian L2 norm and given precision

fun <V : Vector> V.equalsVector(space: GeometrySpace<V>, other: V, precision: Double = DEFAULT_PRECISION): Boolean

Vector equality within given precision (using GeometrySpace.norm provided by the space

Link copied to clipboard

Based on https://github.com/mrdoob/three.js/blob/master/src/math/Quaternion.js

Link copied to clipboard

Create a normalized Quaternion from rotation angle and rotation vector

Link copied to clipboard

taken from https://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/

Link copied to clipboard
fun <V : Vector> Line(base: V, direction: V): Line<V>
Link copied to clipboard
fun <V : Vector> LineSegment<V>.line(algebra: GeometrySpace<V>): Line<V>
Link copied to clipboard
fun <V : Vector> LineSegment(begin: V, end: V): LineSegment<V>
Link copied to clipboard
fun Angle.normalized(center: Angle = Angle.pi): Angle

Normalized angle 2 PI range symmetric around center. By default, uses (0, 2PI) range.

Link copied to clipboard
fun <V : Vector> GeometrySpace<V>.projectAlong(vector: V, normal: V, base: V): V

Project vector onto a hyperplane, which is defined by a normal and base. In 2D case it is the projection to a line, in 3d case it is the one to a plane.

Link copied to clipboard
fun <V : Vector> GeometrySpace<V>.projectToLine(vector: V, line: Line<V>): V

Project vector onto a line.

Link copied to clipboard

Use a composition of quaternions to create a rotation

Rotate a vector in a Euclidean3DSpace

Link copied to clipboard
fun sin(angle: Angle): Double
Link copied to clipboard
fun tan(angle: Angle): Double
Link copied to clipboard
fun Quaternion.toRotationMatrix(linearSpace: LinearSpace<Double, *> = DoubleField.linearSpace): Matrix<Double>

Convert a Quaternion to a rotation matrix

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Angle in radians denoted by this quaternion rotation

Link copied to clipboard

An axis of quaternion rotation