Ocean
JSQuaternion.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_INTERACTION_JS_QUATERNION_H
9 #define META_OCEAN_INTERACTION_JS_QUATERNION_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Interaction
18 {
19 
20 namespace JavaScript
21 {
22 
23 /**
24  * This class implements a wrapper for a JavaScript Quaternion object.
25  * @ingroup interactionjs
26  */
27 class OCEAN_INTERACTION_JS_EXPORT JSQuaternion : public JSObject<JSQuaternion, Quaternion>
28 {
29  friend class JSObject<JSQuaternion, Quaternion>;
30  friend class JSLibrary;
31 
32  public:
33 
34  /**
35  * Definition of ids for individual accessors.
36  */
37  enum AccessorId : unsigned int
38  {
39  /// The accessor for the x property, a number value.
41  /// The accessor for the y property, a number value.
43  /// The accessor for the z property, a number value.
45  /// The accessor for the w property, a number value.
46  AI_W
47  };
48 
49  /**
50  * Definition of ids for individual functions.
51  */
52  enum FunctionId : unsigned int
53  {
54  /**
55  * Inverts this quaternion.
56  * <pre>
57  * Quaternion.invert()
58  * </pre>
59  */
61 
62  /**
63  * Returns the inverted quaternion of this quaternion.
64  * <pre>
65  * Quaternion = Quaternion.inverted()
66  * </pre>
67  */
69 
70  /**
71  * Returns whether two quaternion are equal up to some epsilon.
72  * <pre>
73  * Boolean = Quaternion.isEqual(Quaternion)
74  * </pre>
75  */
77 
78  /**
79  * Multiplies two quaternions, mutiplies this quaternion with a vector, or multiplies this quaternion with a quaternion.
80  * <pre>
81  * Quaternion = Quaternion.multiply(Quaternion)
82  * Vector3 = Quaternion.multiply(Vector3)
83  * Quaternion = Quaternion.multiply(Rotation)
84  * </pre>
85  */
87 
88  /**
89  * Returns an interpolated quaternion.
90  * <pre>
91  * Quaternion = Quaternion.slerp(Quaternion, Number)
92  * </pre>
93  */
95 
96  /**
97  * Returns a string with the values of this matrix.
98  * <pre>
99  * String = Quaternion.string()
100  * </pre>
101  */
102  FI_STRING
103  };
104 
105  public:
106 
107  /**
108  * Returns the JavaScript name of this object.
109  * @return The object's JavaScript name
110  */
111  static inline const char* objectName();
112 
113  protected:
114 
115  /**
116  * Creates the function template and object template for this object.
117  */
118  static void createFunctionTemplate();
119 };
120 
121 inline const char* JSQuaternion::objectName()
122 {
123  return "Quaternion";
124 }
125 
126 }
127 
128 }
129 
130 }
131 
132 #endif // META_OCEAN_INTERACTION_JS_QUATERNION_H
This class implements the java script interaction library object.
Definition: JSLibrary.h:32
This class implements the base class for all native wrapper of JavaScript objects.
Definition: JSObject.h:31
This class implements a wrapper for a JavaScript Quaternion object.
Definition: JSQuaternion.h:28
AccessorId
Definition of ids for individual accessors.
Definition: JSQuaternion.h:38
@ AI_X
The accessor for the x property, a number value.
Definition: JSQuaternion.h:40
@ AI_Y
The accessor for the y property, a number value.
Definition: JSQuaternion.h:42
@ AI_Z
The accessor for the z property, a number value.
Definition: JSQuaternion.h:44
static const char * objectName()
Returns the JavaScript name of this object.
Definition: JSQuaternion.h:121
static void createFunctionTemplate()
Creates the function template and object template for this object.
FunctionId
Definition of ids for individual functions.
Definition: JSQuaternion.h:53
@ FI_MULTIPLY
Multiplies two quaternions, mutiplies this quaternion with a vector, or multiplies this quaternion wi...
Definition: JSQuaternion.h:86
@ FI_INVERTED
Returns the inverted quaternion of this quaternion.
Definition: JSQuaternion.h:68
@ FI_IS_EQUAL
Returns whether two quaternion are equal up to some epsilon.
Definition: JSQuaternion.h:76
@ FI_SLERP
Returns an interpolated quaternion.
Definition: JSQuaternion.h:94
@ FI_INVERT
Inverts this quaternion.
Definition: JSQuaternion.h:60
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15