Liking cljdoc? Tell your friends :D

thi.ng.geom.matrix


frustumclj/s

(frustum l t r b n f)

Sets up a viewing frustum, shaped like a truncated pyramid with the camera where the tip of the pyramid would be. This emulates the OpenGL function glFrustum().

Sets up a viewing frustum, shaped like a truncated pyramid with the
camera where the tip of the pyramid would be.
This emulates the OpenGL function glFrustum().
sourceraw docstring

frustum-boundsclj/s

(frustum-bounds fovy aspect near)

Given vertical FOV in degrees, aspect ratio and near plane distance, computes map of left/right/top/bottom view frustum bounds.

Given vertical FOV in degrees, aspect ratio and near plane
distance, computes map of left/right/top/bottom view frustum
bounds.
sourceraw docstring

frustum-planesclj/s

(frustum-planes view proj)

Given a view matrix & projection matrix, returns vector of the frustum's 6 plane parameters, each a 2-element vector: [normal w] Planes are ordered: left, right, top, bottom, near, far. These coefficients can then (for example) be used for AABB-frustum culling with thi.ng.geom.utils.intersect/intersect-aabb-frustum?

Given a view matrix & projection matrix, returns vector of the
frustum's 6 plane parameters, each a 2-element vector: [normal w]
Planes are ordered: left, right, top, bottom, near, far. These
coefficients can then (for example) be used for AABB-frustum culling
with thi.ng.geom.utils.intersect/intersect-aabb-frustum?
sourceraw docstring

look-atclj/s

(look-at eye target up)

Returns a matrix that puts the camera at the eye position looking toward the target point with the given up direction.

Returns a matrix that puts the camera at the eye position looking
toward the target point with the given up direction.
sourceraw docstring

look-at-vectorsclj/s

(look-at-vectors ex ey ez tx ty tz)

Takes 6 numbers representing eye & target positions, computes up vector and returns vector of all three vec3's.

Takes 6 numbers representing eye & target positions, computes up
vector and returns vector of all three vec3's.
sourceraw docstring

M32clj/s

source

M44clj/s

source

Matrix32cljs

source

matrix32clj/s

(matrix32)
(matrix32 [m00 m01 m02 m10 m11 m12])
(matrix32 m00 m01 m02 m10 m11 m12)
source

matrix44clj/s

(matrix44)
(matrix44 [m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33])
(matrix44 m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33)
source

Matrix44cljs

source

matrix44->matrix33clj/s

(matrix44->matrix33 [m00 m01 m02 _ m10 m11 m12 _ m20 m21 m22])
source

matrix44->matrix33-rotclj/s

(matrix44->matrix33-rot [m00 m01 m02 _ m10 m11 m12 _ m20 m21 m22])
source

orthoclj/s

(ortho)
(ortho view-rect)
(ortho left top right bottom near far)

Returns an orthographic projection matrix, in which objects are the same size no matter how far away or nearby they are. This emulates the OpenGL function glOrtho().

Returns an orthographic projection matrix, in which objects are the
same size no matter how far away or nearby they are. This emulates
the OpenGL function glOrtho().
sourceraw docstring

perspectiveclj/s

(perspective fovy aspect near far)

Returns a perspective transform matrix, which makes far away objects appear smaller than nearby objects. fovy is the vertical angle of the field of view in degrees. The aspect argument should be a rect, a map with a :size key (vec2) or the width divided by the height of your viewport. near and far are the distances of the clipping planes.

Returns a perspective transform matrix, which makes far away
objects appear smaller than nearby objects. `fovy` is the vertical
angle of the field of view in degrees. The `aspect` argument should
be a rect, a map with a `:size` key (vec2) or the width divided by
the height of your viewport. `near` and `far` are the distances of
the clipping planes.
sourceraw docstring

perspective-frustumclj/s

(perspective-frustum fov aspect near far)
source

project-pointclj/s

(project-point p mvp vtx)

Projects 3D point p using MVP matrix into 2D and the applies viewport matrix to produce screen coordinate.

Projects 3D point p using MVP matrix into 2D and the applies
viewport matrix to produce screen coordinate.
sourceraw docstring

project-point-zclj/s

(project-point-z p mvp vtx)

Like project-point, but returns vec3 with z component representing depth value.

Like project-point, but returns vec3 with z component representing
depth value.
sourceraw docstring

unproject-pointclj/s

(unproject-point p inv-mat {[vx vy] :p [w h] :size})
(unproject-point p view proj screen-rect)
(unproject-point [x y z] inv-mat vx vy w h)

Takes a vec3 in screenspace, view matrix, projection matrix and screen rect. A second arity exists accepting an already inverted view-projection matrix instead of having to supply view & proj separately. Returns vector in world space or nil if matrix is not invertible.

Takes a vec3 in screenspace, view matrix, projection matrix and
screen rect. A second arity exists accepting an already inverted
view-projection matrix instead of having to supply view & proj
separately. Returns vector in world space or nil if matrix is not
invertible.
sourceraw docstring

viewport-matrixclj/s

(viewport-matrix width height)
(viewport-matrix width height invert-y?)

Given viewport width/height, computes a 2D transformation matrix mapping normalized coordinates to screen space. If invert-y? is true, the Y axis is flipped.

Given viewport width/height, computes a 2D transformation matrix
mapping normalized coordinates to screen space. If invert-y? is
true, the Y axis is flipped.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close