summaryrefslogtreecommitdiff
path: root/doc/classes/Quat.xml
blob: 589f7d00c6124b6aee807f6d610354277e071ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Quat" category="Built-In Types" version="3.1">
	<brief_description>
		Quaternion.
	</brief_description>
	<description>
		A unit quaternion used for representing 3D rotations.
		It is similar to [Basis], which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. But due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating point errors.

		Quaternions need to be (re)normalized.
	</description>
	<tutorials>
		http://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions
		http://docs.godotengine.org/en/latest/tutorials/math/rotations.html
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="Quat">
			<return type="Quat">
			</return>
			<argument index="0" name="from" type="Basis">
			</argument>
			<description>
				Returns the rotation matrix corresponding to the given quaternion.
			</description>
		</method>
		<method name="Quat">
			<return type="Quat">
			</return>
			<argument index="0" name="euler" type="Vector3">
			</argument>
			<description>
				Returns a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X-angle, Y-angle, Z-angle).
			</description>
		</method>
		<method name="Quat">
			<return type="Quat">
			</return>
			<argument index="0" name="axis" type="Vector3">
			</argument>
			<argument index="1" name="angle" type="float">
			</argument>
			<description>
				Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
			</description>
		</method>
		<method name="Quat">
			<return type="Quat">
			</return>
			<argument index="0" name="x" type="float">
			</argument>
			<argument index="1" name="y" type="float">
			</argument>
			<argument index="2" name="z" type="float">
			</argument>
			<argument index="3" name="w" type="float">
			</argument>
			<description>
				Returns a quaternion defined by these values.
			</description>
		</method>
		<method name="cubic_slerp">
			<return type="Quat">
			</return>
			<argument index="0" name="b" type="Quat">
			</argument>
			<argument index="1" name="pre_a" type="Quat">
			</argument>
			<argument index="2" name="post_b" type="Quat">
			</argument>
			<argument index="3" name="t" type="float">
			</argument>
			<description>
				Performs a cubic spherical-linear interpolation with another quaternion.
			</description>
		</method>
		<method name="dot">
			<return type="float">
			</return>
			<argument index="0" name="b" type="Quat">
			</argument>
			<description>
				Returns the dot product of two quaternions.
			</description>
		</method>
		<method name="get_euler">
			<return type="Vector3">
			</return>
			<description>
				Return Euler angles (in the YXZ convention: first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X-angle, Y-angle, Z-angle).
			</description>
		</method>
		<method name="inverse">
			<return type="Quat">
			</return>
			<description>
				Returns the inverse of the quaternion.
			</description>
		</method>
		<method name="is_normalized">
			<return type="bool">
			</return>
			<description>
				Returns whether the quaternion is normalized or not.
			</description>
		</method>
		<method name="length">
			<return type="float">
			</return>
			<description>
				Returns the length of the quaternion.
			</description>
		</method>
		<method name="length_squared">
			<return type="float">
			</return>
			<description>
				Returns the length of the quaternion, squared.
			</description>
		</method>
		<method name="normalized">
			<return type="Quat">
			</return>
			<description>
				Returns a copy of the quaternion, normalized to unit length.
			</description>
		</method>
		<method name="set_axis_angle">
			<argument index="0" name="axis" type="Vector3">
			</argument>
			<argument index="1" name="angle" type="float">
			</argument>
			<description>
				Set the quaternion to a rotation which rotates around axis by the specified angle, in radians. The axis must be a normalized vector.
			</description>
		</method>
		<method name="set_euler">
			<argument index="0" name="euler" type="Vector3">
			</argument>
			<description>
				Set the quaternion to a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X-angle, Y-angle, Z-angle).
			</description>
		</method>
		<method name="slerp">
			<return type="Quat">
			</return>
			<argument index="0" name="b" type="Quat">
			</argument>
			<argument index="1" name="t" type="float">
			</argument>
			<description>
				Performs a spherical-linear interpolation with another quaternion.
			</description>
		</method>
		<method name="slerpni">
			<return type="Quat">
			</return>
			<argument index="0" name="b" type="Quat">
			</argument>
			<argument index="1" name="t" type="float">
			</argument>
			<description>
				Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
			</description>
		</method>
		<method name="xform">
			<return type="Vector3">
			</return>
			<argument index="0" name="v" type="Vector3">
			</argument>
			<description>
				Transforms the vector [code]v[/code] by this quaternion.
			</description>
		</method>
	</methods>
	<members>
		<member name="w" type="float" setter="" getter="">
			W component of the quaternion. Default value: [code]1[/code]
		</member>
		<member name="x" type="float" setter="" getter="">
			X component of the quaternion. Default value: [code]0[/code]
		</member>
		<member name="y" type="float" setter="" getter="">
			Y component of the quaternion. Default value: [code]0[/code]
		</member>
		<member name="z" type="float" setter="" getter="">
			Z component of the quaternion. Default value: [code]0[/code]
		</member>
	</members>
	<constants>
	</constants>
</class>