Debian Codegraph @

google/type/quaternion.proto

raw
1 // Copyright 2026 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 syntax = "proto3";
16
17 package google.type;
18
19 option go_package = "google.golang.org/genproto/googleapis/type/quaternion;quaternion";
20 option java_multiple_files = true;
21 option java_outer_classname = "QuaternionProto";
22 option java_package = "com.google.type";
23 option objc_class_prefix = "GTP";
24
25 // A quaternion, represented by four 64-bit floating point values.
26 //
27 // A quaternion is defined as the quotient of two directed lines in a
28 // three-dimensional space or equivalently as the quotient of two Euclidean
29 // vectors (https://en.wikipedia.org/wiki/Quaternion).
30 //
31 // Quaternions are often used in calculations involving three-dimensional
32 // rotations (https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation),
33 // as they provide greater mathematical robustness by avoiding the gimbal lock
34 // problems that can be encountered when using Euler angles
35 // (https://en.wikipedia.org/wiki/Gimbal_lock).
36 //
37 // Quaternions are generally represented in this form:
38 //
39 // w + xi + yj + zk
40 //
41 // where x, y, z, and w are real numbers, and i, j, and k are three imaginary
42 // numbers.
43 //
44 // The naming choice `(x, y, z, w)` comes from the desire to avoid confusion for
45 // those interested in the geometric properties of the quaternion in the 3D
46 // Cartesian space. Other texts often use alternative names or subscripts, such
47 // as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps
48 // better suited for mathematical interpretations.
49 //
50 // To avoid any confusion, as well as to maintain compatibility with a large
51 // number of software libraries, the quaternions represented using the protocol
52 // buffer below *must* follow the Hamilton convention, which defines `ij = k`
53 // (i.e. a right-handed algebra), and therefore:
54 //
55 // i^2 = j^2 = k^2 = ijk = −1
56 // ij = −ji = k
57 // jk = −kj = i
58 // ki = −ik = j
59 //
60 // Please DO NOT use this to represent quaternions that follow the JPL
61 // convention, or any of the other quaternion flavors out there.
62 //
63 // Definitions:
64 //
65 // - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`.
66 // - Unit (or normalized) quaternion: a quaternion whose norm is 1.
67 // - Pure quaternion: a quaternion whose scalar component (`w`) is 0.
68 // - Rotation quaternion: a unit quaternion used to represent rotation.
69 // - Orientation quaternion: a unit quaternion used to represent orientation.
70 //
71 // A quaternion can be normalized by dividing it by its norm. The resulting
72 // quaternion maintains the same direction, but has a norm of 1, i.e. it moves
73 // on the unit sphere. This is generally necessary for rotation and orientation
74 // quaternions, to avoid rounding errors:
75 // https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions
76 //
77 // Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation,
78 // but normalization would be even more useful, e.g. for comparison purposes, if
79 // it would produce a unique representation. It is thus recommended that `w` be
80 // kept positive, which can be achieved by changing all the signs when `w` is
81 // negative.
82 message Quaternion {
83 // The x component.
84 double x = 1;
85
86 // The y component.
87 double y = 2;
88
89 // The z component.
90 double z = 3;
91
92 // The scalar component.
93 double w = 4;
94 }