Difference between revisions of "Vector library"
| (3 intermediate revisions by the same user not shown) | |||
| Line 15: | Line 15: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
| − | [[vector.abs]] ''applies math.abs to every | + | [[vector.abs]] ''applies math.abs to every components of the input vector''<br/><!--GIDEROSMTD:vector.abs(vec) applies math.abs to every components of the input vector--> |
[[vector.angle]] ''computes the angle between two vectors in radians''<br/><!--GIDEROSMTD:vector.angle(vec1,vec2[,axis]) computes the angle between two vectors in radians--> | [[vector.angle]] ''computes the angle between two vectors in radians''<br/><!--GIDEROSMTD:vector.angle(vec1,vec2[,axis]) computes the angle between two vectors in radians--> | ||
| − | [[vector.ceil]] ''applies math.ceil to every | + | [[vector.ceil]] ''applies math.ceil to every components of the input vector''<br/><!--GIDEROSMTD:vector.ceil(vec) applies math.ceil to every components of the input vector--> |
| + | [[vector.clamp]] ''applies math.clamp to every components of the input vector''<br/><!--GIDEROSMTD:vector.clamp(vec) applies math.clamp to every components of the input vector--> | ||
[[vector.create]] ''creates a new vector with the given component values''<br/><!--GIDEROSMTD:vector.create(x,y,z) creates a new vector with the given component values--> | [[vector.create]] ''creates a new vector with the given component values''<br/><!--GIDEROSMTD:vector.create(x,y,z) creates a new vector with the given component values--> | ||
[[vector.cross]] ''computes the cross product of two vectors''<br/><!--GIDEROSMTD:vector.cross(vec1,vec2) computes the cross product of two vectors--> | [[vector.cross]] ''computes the cross product of two vectors''<br/><!--GIDEROSMTD:vector.cross(vec1,vec2) computes the cross product of two vectors--> | ||
[[vector.dot]] ''computes the dot product of two vectors''<br/><!--GIDEROSMTD:vector.dot(vec1,vec2) computes the dot product of two vectors--> | [[vector.dot]] ''computes the dot product of two vectors''<br/><!--GIDEROSMTD:vector.dot(vec1,vec2) computes the dot product of two vectors--> | ||
| − | [[vector.floor]] ''applies math.floor to every | + | [[vector.floor]] ''applies math.floor to every components of the input vector''<br/><!--GIDEROSMTD:vector.floor(vec) applies math.floor to every components of the input vector--> |
[[vector.magnitude]] ''calculates the magnitude of a given vector''<br/><!--GIDEROSMTD:vector.magnitude(vec) calculates the magnitude of a given vector--> | [[vector.magnitude]] ''calculates the magnitude of a given vector''<br/><!--GIDEROSMTD:vector.magnitude(vec) calculates the magnitude of a given vector--> | ||
| + | [[vector.max]] ''applies math.max to the corresponding components of the input vectors''<br/><!--GIDEROSMTD:vector.max(vecs) applies math.max to the corresponding components of the input vectors--> | ||
| + | [[vector.min]] ''applies math.min to the corresponding components of the input vectors''<br/><!--GIDEROSMTD:vector.min(vecs) applies math.min to the corresponding components of the input vectors--> | ||
[[vector.normalize]] ''computes the normalized version of a given vector''<br/><!--GIDEROSMTD:vector.normalize(vec) computes the normalized version of a given vector--> | [[vector.normalize]] ''computes the normalized version of a given vector''<br/><!--GIDEROSMTD:vector.normalize(vec) computes the normalized version of a given vector--> | ||
[[vector.one]] ''constant vector with all components set to 1''<br/><!--GIDEROSMTD:vector.one constant vector with all components set to 1--> | [[vector.one]] ''constant vector with all components set to 1''<br/><!--GIDEROSMTD:vector.one constant vector with all components set to 1--> | ||
| + | [[vector.sign]] ''applies math.sign to every components of the input vector''<br/><!--GIDEROSMTD:vector.sign(vec) applies math.sign to every components of the input vector--> | ||
[[vector.zero]] ''constant vector with all components set to 0''<br/><!--GIDEROSMTD:vector.zero constant vector with all components set to 0--> | [[vector.zero]] ''constant vector with all components set to 0''<br/><!--GIDEROSMTD:vector.zero constant vector with all components set to 0--> | ||
Latest revision as of 12:53, 3 February 2026
Supported platforms: ![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Available since: Gideros 2026.1
Description
This library implements functionality for the vector type in addition to the built-in primitive operator support. Default Gideros configuration uses vectors with 3 components (x, y, and z).
Individual vector components can be accessed using the fields x or X, y or Y, z or Z. Since vector values are immutable, writes to individual components are not supported.
Reference
https://luau.org/library/#vector-library
Methodsvector.abs applies math.abs to every components of the input vector |
EventsConstants |