Ocean
JSLine3.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_LINE_3_H
9 #define META_OCEAN_INTERACTION_JS_LINE_3_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 Line3 object.
25  * @ingroup interactionjs
26  */
27 class OCEAN_INTERACTION_JS_EXPORT JSLine3 : public JSObject<JSLine3, Line3>
28 {
29  friend class JSObject<JSLine3, Line3>;
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 point property, a Vector3 object.
41  /// The accessor for the direction property, a Vector3 object.
42  AI_DIRECTION
43  };
44 
45  /**
46  * Definition of ids for individual functions.
47  */
48  enum FunctionId : unsigned int
49  {
50  /**
51  * Returns whether two line objects are equal up to some epsilon.
52  * <pre>
53  * Boolean = Line3.isEqual(Line3)
54  * </pre>
55  */
57 
58  /**
59  * Returns the distance between the line and another object
60  * <pre>
61  * Number = Line3.distance(Line3)
62  * Number = Line3.distance(Vector3)
63  * </pre>
64  */
66 
67  /**
68  * Returns the point on this line which is nearest to an aribtrary given point.
69  * <pre>
70  * Vector3 = Line3.nearestPoint(Vector3)
71  * </pre>
72  */
74 
75  /**
76  * Returns a string with the values of this line object.
77  * <pre>
78  * String = Line3.string()
79  * </pre>
80  */
81  FI_STRING
82  };
83 
84  public:
85 
86  /**
87  * Returns the JavaScript name of this object.
88  * @return The object's JavaScript name
89  */
90  static inline const char* objectName();
91 
92  protected:
93 
94  /**
95  * Creates the function template and object template for this object.
96  */
97  static void createFunctionTemplate();
98 };
99 
100 inline const char* JSLine3::objectName()
101 {
102  return "Line3";
103 }
104 
105 }
106 
107 }
108 
109 }
110 
111 #endif // META_OCEAN_INTERACTION_JS_LINE_3_H
This class implements the java script interaction library object.
Definition: JSLibrary.h:32
This class implements a wrapper for a JavaScript Line3 object.
Definition: JSLine3.h:28
FunctionId
Definition of ids for individual functions.
Definition: JSLine3.h:49
@ FI_IS_EQUAL
Returns whether two line objects are equal up to some epsilon.
Definition: JSLine3.h:56
@ FI_NEAREST_POINT
Returns the point on this line which is nearest to an aribtrary given point.
Definition: JSLine3.h:73
@ FI_DISTANCE
Returns the distance between the line and another object.
Definition: JSLine3.h:65
static void createFunctionTemplate()
Creates the function template and object template for this object.
AccessorId
Definition of ids for individual accessors.
Definition: JSLine3.h:38
@ AI_POINT
The accessor for the point property, a Vector3 object.
Definition: JSLine3.h:40
static const char * objectName()
Returns the JavaScript name of this object.
Definition: JSLine3.h:100
This class implements the base class for all native wrapper of JavaScript objects.
Definition: JSObject.h:31
This class implements an infinite line in 3D space.
Definition: Line3.h:70
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15