Package graphics.glimpse.types

Core data types.

Core data types.

Core data types.

Types

Link copied to clipboard
class Angle : Comparable<Angle>

Combined angle measure in degrees and radians.

Link copied to clipboard
data class AngleRange(val start: Angle, val endInclusive: Angle) : ClosedRange<Angle>

A range of values of type Angle.

Link copied to clipboard
abstract class BaseMat<M : Mat<M, V>, V : Vec>(dimension: Int) : Mat<M, V>

Base implementation of a square matrix with a given dimension.

Link copied to clipboard
interface Mat<M : Mat<M, V>, V : Vec>

A common interface for square matrix implementations.

Link copied to clipboard
data class Mat2(elements: List<Float>) : BaseMat<Mat2, Vec2>

A 2×2 matrix.

Link copied to clipboard
data class Mat3(elements: List<Float>) : BaseMat<Mat3, Vec3>

A 3×3 matrix.

Link copied to clipboard
data class Mat4(elements: List<Float>) : BaseMat<Mat4, Vec4>

A 4×4 matrix.

Link copied to clipboard
interface Vec

A common interface for vector implementations.

Link copied to clipboard
data class Vec2(val x: Float, val y: Float) : Vec

2D vector with coordinates (x, y).

Link copied to clipboard
data class Vec3(    val x: Float,     val y: Float,     val z: Float) : Vec

3D vector with coordinates (x, y, z).

Link copied to clipboard
data class Vec4(    val x: Float,     val y: Float,     val z: Float,     val w: Float) : Vec

4D vector with coordinates (x, y, z, w).

Functions

Link copied to clipboard
fun cos(angle: Angle): Float

Computes the cosine of the specified angle.

Link copied to clipboard
fun frustum(    left: Float,     right: Float,     bottom: Float,     top: Float,     near: Float,     far: Float): Mat4

Creates a projection matrix for a perspective projection defined by a given frustum.

Link copied to clipboard
fun lookAt(    eye: Vec3,     target: Vec3,     upVector: Vec3): Mat4

Creates a view matrix defined by an eye position, a target point, and an upVector.

Link copied to clipboard
fun magnitude(vector: Vec2): Float
fun magnitude(vector: Vec3): Float

Returns the magnitude of the given vector.

Link copied to clipboard
fun mirror(normal: Vec3, origin: Vec3): Mat4

Creates a transformation matrix for mirroring through a plane passing through the origin point, and perpendicular a given normal vector.

Link copied to clipboard
fun normalize(vector: Vec2): Vec2
fun normalize(vector: Vec3): Vec3

Returns a unit vector in the direction of the given vector.

Link copied to clipboard
fun orthographic(    left: Float,     right: Float,     bottom: Float,     top: Float,     near: Float,     far: Float): Mat4

Creates a projection matrix for an orthographic (parallel) projection defined by a given set of clipping planes: left, right, bottom, top, near and far.

Link copied to clipboard
fun perspective(    fovY: Angle,     aspect: Float,     near: Float,     far: Float): Mat4

Creates a projection matrix for a perspective projection defined by a given frustum.

Link copied to clipboard
fun rotation(axis: Vec3, angle: Angle): Mat4

Creates a transformation matrix for a rotation by a given angle around a given axis.

Link copied to clipboard
fun rotationX(angle: Angle): Mat4

Creates a transformation matrix for a rotation by a given angle around X axis.

Link copied to clipboard
fun rotationY(angle: Angle): Mat4

Creates a transformation matrix for a rotation by a given angle around Y axis.

Link copied to clipboard
fun rotationZ(angle: Angle): Mat4

Creates a transformation matrix for a rotation by a given angle around Z axis.

Link copied to clipboard
fun scale(scale: Float): Mat4

Creates a transformation matrix for scaling by a given scale.

fun scale(    x: Float = 1.0f,     y: Float = 1.0f,     z: Float = 1.0f): Mat4

Creates a transformation matrix for scaling by a given scale in x, y and z directions.

Link copied to clipboard
fun sin(angle: Angle): Float

Computes the sine of the specified angle.

Link copied to clipboard
fun tan(angle: Angle): Float

Computes the tangent of the specified angle.

Link copied to clipboard
fun translation(vector: Vec3): Mat4

Creates a transformation matrix for a translation by a given vector.

Link copied to clipboard
fun Vec3(@ColorInt color: Int): Vec3

Returns a Vec3 representation of a given color.

fun Vec3(color: Color): Vec3

Returns a Vec3 representation of a given color.

Link copied to clipboard
fun Vec4(@ColorInt color: Int): Vec4

Returns a Vec4 representation of a given color.

fun Vec4(color: Color): Vec4

Returns a Vec4 representation of a given color.