Unofficial LSL Reference

[[types:vector]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

types:vector [2015-09-22 11:22 SLT]
sei style
types:vector [2015-09-29 08:15 SLT] (current)
sei Fix cross product expression
Line 26: Line 26:
 Another type of multiplication is the so called [[http://​en.wikipedia.org/​wiki/​Dot_product|dot product or scalar product]]. It takes two vectors, and the result is a //float//. The symbol is the same as for multiplication of floats and integers, i.e. the asterisk $op[*]. The resulting operation is the sum of the products of the components; for example, if **v** and **w** are vector variables, then ''​v * w''​ gives the same result as ''​v.x * w.x + v.y * w.y + v.z * w.z''​. It is useful in several geometric applications. Another type of multiplication is the so called [[http://​en.wikipedia.org/​wiki/​Dot_product|dot product or scalar product]]. It takes two vectors, and the result is a //float//. The symbol is the same as for multiplication of floats and integers, i.e. the asterisk $op[*]. The resulting operation is the sum of the products of the components; for example, if **v** and **w** are vector variables, then ''​v * w''​ gives the same result as ''​v.x * w.x + v.y * w.y + v.z * w.z''​. It is useful in several geometric applications.
  
-A third type of multiplication is called [[http://​en.wikipedia.org/​wiki/​Cross_product|cross product or vector product]]. It takes two vectors, and the result is a //vector//. The symbol is the same as for integer modulo, i.e. the percent sign $op[%]. The operation is a bit complex: if **v** and **w** are vector variables, then ''​v % w''​ gives the same result as ''<​v.y*w.z - v.z*w.y, v.z*w.x - v.x*w.z, v.x*w.- v.z*w.x>''​. This kind of multiplication returns a vector that is perpendicular to both input vectors, and has several uses in geometry applications too.+A third type of multiplication is called [[http://​en.wikipedia.org/​wiki/​Cross_product|cross product or vector product]]. It takes two vectors, and the result is a //vector//. The symbol is the same as for integer modulo, i.e. the percent sign $op[%]. The operation is a bit complex: if **v** and **w** are vector variables, then ''​v % w''​ gives the same result as ''<​v.y*w.z - v.z*w.y, v.z*w.x - v.x*w.z, v.x*w.- v.y*w.x>''​. This kind of multiplication returns a vector that is perpendicular to both input vectors, and has several uses in geometry applications too.
  
 And finally, there is a fourth type of multiplication:​ a vector multiplied by a $lty[rotation] returns the vector rotated by the given rotation. For example, if **r** is a rotation that turns 90° counter-clockwise over the positive Z axis, then ''<​0,​ 3, 1> * r''​ will result in ''<​-3,​ 0, 1>'',​ that is, the vector will be rotated over that axis by that angle. And finally, there is a fourth type of multiplication:​ a vector multiplied by a $lty[rotation] returns the vector rotated by the given rotation. For example, if **r** is a rotation that turns 90° counter-clockwise over the positive Z axis, then ''<​0,​ 3, 1> * r''​ will result in ''<​-3,​ 0, 1>'',​ that is, the vector will be rotated over that axis by that angle.