four.V3
.V3 (x, y, z)
local lib = { type = 'four.V3' } lib.__index = lib four.V3 = lib setmetatable(lib, { __call = function(lib, ...) return lib.V3(...) end })
-- h2. Constructors and accessors
--[[-- @V3(x, y, z)@ is a vector with the corresponding components.
@V3(o)@ is a vector converted from the object @o@. Supported types for @o@: @bt.Vector3@.
.x (v)
@x(v)@ is the @x@ component of @v@.
.y (v)
@y(v)@ is the @y@ component of @v@.
.z (v)
@z(v)@ is the @z@ component of @v@.
.comp (i, v)
@comp(i, v)@ is the @i@th component of @v@.
.ofV2 (v, z)
@ofV2(v, z)@ is @V3(V2.x(v), V2.y(v), z)@.
.ofV4 (v)
@ofV4(v)@ is @V3(V4.x(v), V4.y(v), V4.z(v))@.
.tuple (v)
@tuple(v)@ is @x, y, z@, the components of @v@.
.tostring (v)
@tostring(v)@ is a textual representation of @v@.
.zero ()
@zero()@ is a vector @(0, 0, 0)@.
.ox ()
@ox()@ is a unit vector @(1, 0, 0)@.
.oy ()
@oy()@ is a unit vector @(0, 1, 0)@.
.oz ()
@oz()@ is a unit vector @(0, 0, 1)@.
.huge ()
@huge()@ is a vector whose components are @math.huge@.
.neg_huge ()
@neg_huge()@ is a vector whose components are @-math.huge@.
.neg (v)
@neg(v)@ is the inverse vector @-v@.
.add (u, v)
@add(u, v)@ is the vector addition @u + v@.
.sub (u, v)
@sub(u, v)@ is the vector subtraction @u - v@.
.mul (u, v)
@mul(u, v)@ is the component wise mutiplication @u * v@.
.div (u, v)
@div(u, v)@ is the component wise division @u / v@.
.smul (s, v)
@smul(s, v)@ is the scalar mutiplication @sv@.
.half (v)
@half(v)@ is the half vector @smul(0.5, v)@.
.cross (u, v)
@cross(u, v)@ is the cross product @u x v@.
.dot (u, v)
@dot(u, v)@ is the dot product @u.v@.
.norm (v)
@norm(v)@ is the norm @|v|@.
.norm2 (v)
@norm2(v)@ is the squared norm @|v|^2@.
.unit (v)
@unit(v)@ is the unit vector @v/|v|@.
.homogene (v)
@homogene(v)@ is the vector @v/V3.z(v)@.
.sphereUnit (theta, phi)
@sphereUnit(theta, phi)@ is the unit vector whose azimuth spherical coordinate is @theta@ and zenith is @phi@.
.mix (u, v, t)
@mix(u, v, t)@ is the linear interpolation @u + t * (v - u)@.
.trVec (m, v)
@trVec(m, v)@ is the vector @v@ transformed by the @M4@ matrix @m@ (the translation component of @m@ is ignored).
.trPt (m, pt)
@trPt(m, pt)@ is the point @p@ transformed by the @M4@ matrix @m@.
.map (f, v)
@map(f, v)@ is @V3(f(v1), f(v2), f(v3))@.
.mapi (f, v)
@mapi(f, v)@ is @V3(f(1, v1), f(2, v2), f(3, v3))@.
.fold (f, acc, v)
@fold(f, acc, v)@ is @f(f(f(acc, v1), v2), v3)@.
.foldi (f, acc, v)
@foldi(f, acc, v)@ is @f(f(f(acc, 1, v1), 2, v2), 3, v3)@.
.iter (f, v)
@iter(f, v)@ is @f(v1) f(v2) f(v3)@.
.iteri (f, v)
@iteri(f, v)@ is @f(1, v1) f(2, v2) f(3, v3)@.
.forAll (p, v)
@forAll(p, v)@ is @p(v1) and p(v2) and p(v3)@.
.exists (p, v)
@exists(p, v)@ is @p(v1) or p(v2) or p(v3)@.
.eq (u, v, eq)
@eq(u, v [,eq])@ is @true@ if @u@ is equal to @v@ component wise. If [eq] is provided it used as the equality function.
.lt (u, v, lt)
@lt(u, v [,lt])@ is @true@ if @u@ is lower than @v@ component wise. If [lt] is provided it used as the comparison function.
.le (u, v, le)
@le(u, v [,le])@ is @true@ if @u@ is lower or equal than @v@ component wise. If [le] is provided it used as the comparison function.
.compare (u, v, cmp)
@compare(u, v [, cmp])@ is:
- @-1@ if @u@ is smaller than @v@
- @0@ if @u@ is equal to @v@
- @1@ if @u@ is greater than @v@ where the order is the lexicographic order defined by using @cmp@ on the components (@cmp@ defaults to the standard order on floats).
.__unm = lib.neg
h2. Operators
TODO MISSING DOCUMENTATION
.__add = lib.add
TODO MISSING DOCUMENTATION
.__sub = lib.sub
TODO MISSING DOCUMENTATION
.__mul = lib.smul
TODO MISSING DOCUMENTATION
.__tostring = lib.tostring
TODO MISSING DOCUMENTATION
TODO
V3TODO MISSING DOCUMENTATION
V3TODO MISSING DOCUMENTATION
V3TODO MISSING DOCUMENTATION
V3TODO MISSING DOCUMENTATION
V3TODO MISSING DOCUMENTATION