Ocean
JSRotation.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_ROTATION_H
9 #define META_OCEAN_INTERACTION_JS_ROTATION_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 Rotation object.
25  * @ingroup interactionjs
26  */
27 class OCEAN_INTERACTION_JS_EXPORT JSRotation : public JSObject<JSRotation, Rotation>
28 {
29  friend class JSObject<JSRotation, Rotation>;
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 axis property, a Vector3 object.
47  /// The accessor for the a property, a number value.
49  /// The accessor for the angle property, a number value.
50  AI_ANGLE
51  };
52 
53  /**
54  * Definition of ids for individual functions.
55  */
56  enum FunctionId : unsigned int
57  {
58  /**
59  * Inverts this rotation.
60  * <pre>
61  * Rotation.invert()
62  * </pre>
63  */
65 
66  /**
67  * Returns the inverted rotation of this rotation.
68  * <pre>
69  * Rotation = Rotation.inverted()
70  * </pre>
71  */
73 
74  /**
75  * Returns whether two rotation are equal up to some epsilon.
76  * <pre>
77  * Boolean = Rotation.isEqual(Rotation)
78  * </pre>
79  */
81 
82  /**
83  * Multiplies two rotations, mutiplies this rotation with a vector, or multiplies this rotation with a quaternion.
84  * <pre>
85  * Rotation = Rotation.multiply(Rotation)
86  * Vector3 = Rotation.multiply(Vector3)
87  * Rotation = Rotation.multiply(Quaternion)
88  * </pre>
89  */
91 
92  /**
93  * Returns a string with the values of this rotation.
94  * <pre>
95  * String = Rotation.string()
96  * </pre>
97  */
98  FI_STRING
99  };
100 
101  public:
102 
103  /**
104  * Returns the JavaScript name of this object.
105  * @return The object's JavaScript name
106  */
107  static inline const char* objectName();
108 
109  protected:
110 
111  /**
112  * Creates the function template and object template for this object.
113  */
114  static void createFunctionTemplate();
115 };
116 
117 inline const char* JSRotation::objectName()
118 {
119  return "Rotation";
120 }
121 
122 }
123 
124 }
125 
126 }
127 
128 #endif // META_OCEAN_INTERACTION_JS_ROTATION_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 Rotation object.
Definition: JSRotation.h:28
static void createFunctionTemplate()
Creates the function template and object template for this object.
AccessorId
Definition of ids for individual accessors.
Definition: JSRotation.h:38
@ AI_X
The accessor for the x property, a number value.
Definition: JSRotation.h:40
@ AI_AXIS
The accessor for the axis property, a Vector3 object.
Definition: JSRotation.h:46
@ AI_Y
The accessor for the y property, a number value.
Definition: JSRotation.h:42
@ AI_A
The accessor for the a property, a number value.
Definition: JSRotation.h:48
@ AI_Z
The accessor for the z property, a number value.
Definition: JSRotation.h:44
FunctionId
Definition of ids for individual functions.
Definition: JSRotation.h:57
@ FI_INVERT
Inverts this rotation.
Definition: JSRotation.h:64
@ FI_IS_EQUAL
Returns whether two rotation are equal up to some epsilon.
Definition: JSRotation.h:80
@ FI_INVERTED
Returns the inverted rotation of this rotation.
Definition: JSRotation.h:72
@ FI_MULTIPLY
Multiplies two rotations, mutiplies this rotation with a vector, or multiplies this rotation with a q...
Definition: JSRotation.h:90
static const char * objectName()
Returns the JavaScript name of this object.
Definition: JSRotation.h:117
This class implements a axis-angle rotation using floating point values.
Definition: Rotation.h:79
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15