Skip to content

Commit f62777a

Browse files
committed
Ported Luau documentation for vector library to the Roblox documentation.
1 parent cb04623 commit f62777a

File tree

1 file changed

+227
-0
lines changed

1 file changed

+227
-0
lines changed
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: vector
2+
type: library
3+
summary: |
4+
A library of vector functions.
5+
description: |
6+
This library implements functionality for the vector type in addition to the built-in primitive operator support. It uses vectors with 3 components (x, y, and z).
7+
8+
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.
9+
code_samples:
10+
properties:
11+
- name: vector.zero
12+
type: vector
13+
summary: Constant vector with all components set to 0.
14+
description: Constant vector with all components set to 0.
15+
tags:
16+
code_samples:
17+
- name: vector.one
18+
type: vector
19+
summary: Constant vector with all components set to 1.
20+
description: Constant vector with all components set to 1.
21+
tags:
22+
code_samples:
23+
functions:
24+
- name: vector.create
25+
summary: Creates a new vector with the given component values.
26+
description: Creates a new vector with the given component values.
27+
parameters:
28+
- name: x
29+
type: number
30+
default:
31+
summary: ''
32+
- name: y
33+
type: number
34+
default:
35+
summary: ''
36+
- name: z
37+
type: number
38+
default:
39+
summary: ''
40+
returns:
41+
- type: vector
42+
summary: ''
43+
tags:
44+
code_samples:
45+
- name: vector.magnitude
46+
summary: Calculates the magnitude of a given vector.
47+
description: Calculates the magnitude of a given vector.
48+
parameters:
49+
- name: vec
50+
type: vector
51+
default:
52+
summary: ''
53+
returns:
54+
- type: number
55+
summary: ''
56+
tags:
57+
code_samples:
58+
- name: vector.normalize
59+
summary: Computes the normalized version (unit vector) of a given vector.
60+
description: Computes the normalized version (unit vector) of a given vector.
61+
parameters:
62+
- name: vec
63+
type: vector
64+
default:
65+
summary: ''
66+
returns:
67+
- type: vector
68+
summary: ''
69+
tags:
70+
code_samples:
71+
- name: vector.cross
72+
summary: Computes the cross product of two vectors.
73+
description: Computes the cross product of two vectors.
74+
parameters:
75+
- name: vec1
76+
type: vector
77+
default:
78+
summary: ''
79+
- name: vec2
80+
type: vector
81+
default:
82+
summary: ''
83+
returns:
84+
- type: vector
85+
summary: ''
86+
tags:
87+
code_samples:
88+
- name: vector.dot
89+
summary: Computes the dot product of two vectors.
90+
description: Computes the dot product of two vectors.
91+
parameters:
92+
- name: vec1
93+
type: vector
94+
default:
95+
summary: ''
96+
- name: vec2
97+
type: vector
98+
default:
99+
summary: ''
100+
returns:
101+
- type: number
102+
summary: ''
103+
tags:
104+
code_samples:
105+
- name: vector.angle
106+
summary: Computes the angle between two vectors in radians.
107+
description: |
108+
Computes the angle between two vectors in radians. The axis, if specified, is used to determine the sign of the angle.
109+
parameters:
110+
- name: vec1
111+
type: vector
112+
default:
113+
summary: ''
114+
- name: vec2
115+
type: vector
116+
default:
117+
summary: ''
118+
- name: axis
119+
type: vector?
120+
default:
121+
summary: ''
122+
returns:
123+
- type: number
124+
summary: ''
125+
tags:
126+
code_samples:
127+
- name: vector.floor
128+
summary: Applies `math.floor` to every component of the input vector.
129+
description: Applies `math.floor` to every component of the input vector.
130+
parameters:
131+
- name: vec
132+
type: vector
133+
default:
134+
summary: ''
135+
returns:
136+
- type: vector
137+
summary: ''
138+
tags:
139+
code_samples:
140+
- name: vector.ceil
141+
summary: Applies `math.ceil` to every component of the input vector.
142+
description: Applies `math.ceil` to every component of the input vector.
143+
parameters:
144+
- name: vec
145+
type: vector
146+
default:
147+
summary: ''
148+
returns:
149+
- type: vector
150+
summary: ''
151+
tags:
152+
code_samples:
153+
- name: vector.abs
154+
summary: Applies `math.abs` to every component of the input vector.
155+
description: Applies `math.abs` to every component of the input vector.
156+
parameters:
157+
- name: vec
158+
type: vector
159+
default:
160+
summary: ''
161+
returns:
162+
- type: vector
163+
summary: ''
164+
tags:
165+
code_samples:
166+
- name: vector.sign
167+
summary: Applies `math.sign` to every component of the input vector.
168+
description: Applies `math.sign` to every component of the input vector.
169+
parameters:
170+
- name: vec
171+
type: vector
172+
default:
173+
summary: ''
174+
returns:
175+
- type: vector
176+
summary: ''
177+
tags:
178+
code_samples:
179+
- name: vector.clamp
180+
summary: Applies `math.clamp` to every component of the input vector.
181+
description: Applies `math.clamp` to every component of the input vector.
182+
parameters:
183+
- name: vec
184+
type: vector
185+
default:
186+
summary: ''
187+
- name: min
188+
type: vector
189+
default:
190+
summary: ''
191+
- name: max
192+
type: vector
193+
default:
194+
summary: ''
195+
returns:
196+
- type: vector
197+
summary: ''
198+
tags:
199+
code_samples:
200+
- name: vector.max
201+
summary: Applies `math.max` to the corresponding components of the input vectors.
202+
description: |
203+
Applies `math.max` to the corresponding components of the input vectors. Equivalent to `vector.create(math.max((...).x), math.max((...).y), math.max((...).z))`.
204+
parameters:
205+
- name: ...
206+
type: vector
207+
default:
208+
summary: ''
209+
returns:
210+
- type: vector
211+
summary: ''
212+
tags:
213+
code_samples:
214+
- name: vector.min
215+
summary: Applies `math.min` to the corresponding components of the input vectors.
216+
description: |
217+
Applies `math.max` to the corresponding components of the input vectors. Equivalent to `vector.create(math.min((...).x), math.min((...).y), math.min((...).z))`.
218+
parameters:
219+
- name: ...
220+
type: vector
221+
default:
222+
summary: ''
223+
returns:
224+
- type: vector
225+
summary: ''
226+
tags:
227+
code_samples:

0 commit comments

Comments
 (0)