wireframes.transform documentation
centroid
(centroid [ax ay az] [bx by bz] [cx cy cz])
Calculate the centroid of a triangle
combine
(combine a b)(combine a b & more)
degrees->radians
(degrees->radians d)
distance
(distance a b)
Distance between two points
dot-product
(dot-product as bs)
magnitude
(magnitude [x y z])
matrix
(matrix & rows)
Matrix builder
mid-point
(mid-point [ax ay az] [bx by bz])
Calculate the midpoint of a line
multiply
(multiply [x y z] n)
normal
(normal [ax ay az] [bx by bz] [cx cy cz])
Calculate the normal of a triangle
normalize
(normalize xyz)(normalize xyz scale)
perspective
(perspective focal-length)
Constructs a perspective function for a given focal-length, which
can be used to project a 3D point into 2D cartesian co-ordinates.
point
(point [x y z])(point x y z)
Constuctor for making points
reduce-polygons
(reduce-polygons polygons)
Alter a sequence of polygons such that the output contains polygons
with no more than 3 sides: hence polygons with 4 or more sides are
split into triangles.
rotate
(rotate axis theta)
Rotate around the given axis by theta radians
scale
(scale s)(scale sx sy sz)
translate
(translate x y z)
A quaternion of sorts
transpose
(transpose matrix)
triangulate
(triangulate polygon)
Attempts to break down the polygon (defined by the points) into an array
of triangles which represent the same surface area. NOTE: If the polygon
is already triangular (or less) in nature, then that polygon is returned
wrapped in an array.
vec
(vec point)
Convert a point back into a clojure vector