Package graphics.glimpse.types

Types

Angle
Link copied to clipboard
common
class Angle : Comparable<Angle>
Combined angle measure in degrees and radians.
AngleRange
Link copied to clipboard
common
data class AngleRange(start: Angle, endInclusive: Angle) : ClosedRange<Angle>
A range of values of type Angle.
BaseMat
Link copied to clipboard
common
abstract class BaseMat<M : Mat<M, V>, V : Vec>(dimension: Int) : Mat<M, V>
Base implementation of a square matrix with a given dimension.
Mat
Link copied to clipboard
common
interface Mat<M : Mat<M, V>, V : Vec>
A common interface for square matrix implementations.
Mat2
Link copied to clipboard
common
data class Mat2(elements: List<Float>) : BaseMat<Mat2, Vec2>
A 2×2 matrix.
Mat3
Link copied to clipboard
common
data class Mat3(elements: List<Float>) : BaseMat<Mat3, Vec3>
A 3×3 matrix.
Mat4
Link copied to clipboard
common
data class Mat4(elements: List<Float>) : BaseMat<Mat4, Vec4>
A 4×4 matrix.
Vec
Link copied to clipboard
common
interface Vec
A common interface for vector implementations.
Vec2
Link copied to clipboard
common
data class Vec2(x: Float, y: Float) : Vec
2D vector with coordinates (x, y).
Vec3
Link copied to clipboard
common
data class Vec3(x: Float, y: Float, z: Float) : Vec
3D vector with coordinates (x, y, z).
Vec4
Link copied to clipboard
common
data class Vec4(x: Float, y: Float, z: Float, w: Float) : Vec
4D vector with coordinates (x, y, z, w).

Functions

cos
Link copied to clipboard
common
fun cos(angle: Angle): Float
Computes the cosine of the specified angle.
frustum
Link copied to clipboard
common
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.
lookAt
Link copied to clipboard
common
fun lookAt(eye: Vec3, target: Vec3, upVector: Vec3): Mat4
Creates a view matrix defined by an eye position, a target point, and an upVector.
magnitude
Link copied to clipboard
common
fun magnitude(vector: Vec2): Float
Returns the magnitude of the given vector.
fun magnitude(vector: Vec3): Float
Returns the magnitude of the given vector.
mirror
Link copied to clipboard
common
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.
normalize
Link copied to clipboard
common
fun normalize(vector: Vec2): Vec2
Returns a unit vector in the direction of the given vector.
fun normalize(vector: Vec3): Vec3
Returns a unit vector in the direction of the given vector.
orthographic
Link copied to clipboard
common
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.
perspective
Link copied to clipboard
common
fun perspective(fovY: Angle, aspect: Float, near: Float, far: Float): Mat4
Creates a projection matrix for a perspective projection defined by a given frustum.
rotation
Link copied to clipboard
common
fun rotation(axis: Vec3, angle: Angle): Mat4
Creates a transformation matrix for a rotation by a given angle around a given axis.
rotationX
Link copied to clipboard
common
fun rotationX(angle: Angle): Mat4
Creates a transformation matrix for a rotation by a given angle around X axis.
rotationY
Link copied to clipboard
common
fun rotationY(angle: Angle): Mat4
Creates a transformation matrix for a rotation by a given angle around Y axis.
rotationZ
Link copied to clipboard
common
fun rotationZ(angle: Angle): Mat4
Creates a transformation matrix for a rotation by a given angle around Z axis.
scale
Link copied to clipboard
common
fun scale(scale: Float): Mat4
Creates a transformation matrix for scaling by a given scale.
fun scale(x: Float = 1f, y: Float = 1f, z: Float = 1f): Mat4
Creates a transformation matrix for scaling by a given scale in x, y and z directions.
sin
Link copied to clipboard
common
fun sin(angle: Angle): Float
Computes the sine of the specified angle.
tan
Link copied to clipboard
common
fun tan(angle: Angle): Float
Computes the tangent of the specified angle.
translation
Link copied to clipboard
common
fun translation(vector: Vec3): Mat4
Creates a transformation matrix for a translation by a given vector.
Vec3
Link copied to clipboard
fun Vec3(color: Color): Vec3
Returns a Vec3 representation of a given color.
fun Vec3(color: Int): Vec3
Returns a Vec3 representation of a given color.
Vec4
Link copied to clipboard
fun Vec4(color: Color): Vec4
Returns a Vec4 representation of a given color.
fun Vec4(color: Int): Vec4
Returns a Vec4 representation of a given color.