Difference between revisions of "VectorA:cross"
From ComputerCraft Wiki
(Changing float to number) |
|||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | Returns | + | {{lowercase}} |
− | + | {{Function | |
− | + | |name=vector:cross | |
− | local a = vector.new(1, 2, 3) | + | |args=[[vector (API)|vector]] vect |
+ | |returns={{type|number}} | ||
+ | |api=vector | ||
+ | |addon=ComputerCraft | ||
+ | |desc=Returns the vector which resulted in the cross product of the two vectors. | ||
+ | |examples= | ||
+ | {{Example | ||
+ | |desc=Creates a cross product of two vectors and prints the resulting vector. | ||
+ | |code=local a = vector.new(1, 2, 3) | ||
+ | local b = vector.new(4, 5, 6) | ||
+ | |||
+ | local c = a:cross(b) | ||
+ | |||
+ | print(c.x) | ||
+ | print(c.y) | ||
+ | print(c.z) | ||
+ | --(-3) | ||
+ | --6 | ||
+ | --(-3) | ||
+ | }} | ||
+ | {{Example | ||
+ | |desc=Code to recreate the function. Gives insight into what the function does. | ||
+ | |code=local a = vector.new(1, 2, 3) | ||
local b = vector.new(2, 1, 2) | local b = vector.new(2, 1, 2) | ||
Line 13: | Line 35: | ||
--c.y = 4 | --c.y = 4 | ||
--c.z = -3 | --c.z = -3 | ||
+ | }} | ||
+ | }} | ||
− | + | It is important to note that a:cross(b) will not usually equal b:cross(a). | |
− | + | ||
− | + | More information about cross products can be found at [http://en.wikipedia.org/wiki/Cross_product] | |
− | + | ||
− | + | [[Category:API_Functions]] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 13:20, 18 July 2013
Function vector:cross | |
Returns the vector which resulted in the cross product of the two vectors. | |
Syntax | vector:cross(vector vect) |
Returns | number |
Part of | ComputerCraft |
API | vector |
Examples
It is important to note that a:cross(b) will not usually equal b:cross(a).
More information about cross products can be found at [1]