Difference between revisions of "Math.normalize"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2020.9<br/>
'''<translate>Available since</translate>:''' Gideros 2020.9<br/>
+
'''Class:''' [[math]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/math|math]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate>Normalize a vector.</translate>
+
Normalizes a vector.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number),(number),(number) = math.normalize(x,y,z)
 
(number),(number),(number) = math.normalize(x,y,z)
 
(table) = math.normalize({x,y,z})
 
(table) = math.normalize({x,y,z})
 
(table) = math.normalize({x=x,y=y,z=z})
 
(table) = math.normalize({x=x,y=y,z=z})
</source>
+
</syntaxhighlight>
  
=== <translate>Parameters</translate> ===
+
=== Parameters ===
'''x''': (number) <translate>X component of the vector</translate> <br/>
+
'''x''': (number) X component of the vector<br/>
'''y''': (number) <translate>Y component of the vector</translate> <br/>
+
'''y''': (number) Y component of the vector<br/>
'''z''': (number) <translate>Z component of the vector</translate> '''optional''' <br/>
+
'''z''': (number) Z component of the vector '''optional'''<br/>
  
=== <translate>Return values</translate> ===
+
=== Return values ===
'''<translate>Returns</translate>''' (number) <translate>the normalized vector</translate><br/>
+
'''Returns''' (number) the normalized vector<br/>
  
 
{{Math}}
 
{{Math}}

Latest revision as of 14:31, 13 July 2023

Available since: Gideros 2020.9
Class: math

Description

Normalizes a vector.

(number),(number),(number) = math.normalize(x,y,z)
(table) = math.normalize({x,y,z})
(table) = math.normalize({x=x,y=y,z=z})

Parameters

x: (number) X component of the vector
y: (number) Y component of the vector
z: (number) Z component of the vector optional

Return values

Returns (number) the normalized vector