Selaa lähdekoodia

Document TrackablePointer, PointerTracker, PointerSource and PointerTrackerResult

customisations
alemart 10 kuukautta sitten
vanhempi
commit
a494b86136

+ 23
- 0
docs/api/pointer-source.md Näytä tiedosto

@@ -0,0 +1,23 @@
1
+# PointerSource
2
+
3
+A [source](source.md) of [pointer](trackable-pointer.md)-based input. It feeds a [PointerTracker](pointer-tracker.md).
4
+
5
+*Since:* 0.4.0
6
+
7
+## Instantiation
8
+
9
+### AR.Source.Pointer
10
+
11
+`AR.Source.Pointer(): PointerSource`
12
+
13
+Create a new `PointerSource`.
14
+
15
+**Returns**
16
+
17
+A new `PointerSource`.
18
+
19
+**Example**
20
+
21
+```js
22
+const pointerSource = AR.Source.Pointer();
23
+```

+ 19
- 0
docs/api/pointer-tracker-result.md Näytä tiedosto

@@ -0,0 +1,19 @@
1
+# PointerTrackerResult
2
+
3
+A [result](tracker-result.md) generated by a [PointerTracker](pointer-tracker.md).
4
+
5
+*Since:* 0.4.0
6
+
7
+## Properties
8
+
9
+### tracker
10
+
11
+`result.tracker: PointerTracker, read-only`
12
+
13
+A reference to the [PointerTracker](pointer-tracker.md) that generated this result.
14
+
15
+### trackables
16
+
17
+`result.trackables: TrackablePointer[], read-only`
18
+
19
+An array of [TrackablePointers](trackable-pointer.md).

+ 31
- 0
docs/api/pointer-tracker.md Näytä tiedosto

@@ -0,0 +1,31 @@
1
+# PointerTracker
2
+
3
+A [tracker](tracker.md) of [pointers](trackable-pointer.md). It consumes data from a [PointerSource](pointer-source.md) and produces [PointerTrackerResults](pointer-tracker-result.md).
4
+
5
+*Since:* 0.4.0
6
+
7
+## Instantiation
8
+
9
+### AR.Tracker.Pointer
10
+
11
+`AR.Tracker.Pointer(): PointerTracker`
12
+
13
+Create a new `PointerTracker`.
14
+
15
+**Returns**
16
+
17
+A new `PointerTracker`.
18
+
19
+**Example**
20
+
21
+```js
22
+const pointerTracker = AR.Tracker.Pointer();
23
+```
24
+
25
+## Properties
26
+
27
+### type
28
+
29
+`tracker.type: string, read-only`
30
+
31
+The string `"pointer-tracker"`.

+ 65
- 0
docs/api/trackable-pointer.md Näytä tiedosto

@@ -0,0 +1,65 @@
1
+# TrackablePointer
2
+
3
+A [trackable](trackable.md) that represents a pointer tracked by a [PointerTracker](pointer-tracker.md).
4
+
5
+A pointer is an abstraction that represents an instance of user input that targets one or more coordinates on a screen. For example, each point of contact between fingers and a multitouch screen generate a pointer. Devices such as a mouse and a pen/stylus also generate pointers.
6
+
7
+Pointers are positioned in the [viewport](viewport.md), and their positions are given in normalized coordinates. Normalized coordinates range from -1 to +1. The center of the viewport is at (0,0). The top-right corner is at (1,1). The bottom-left corner is at (-1,-1).
8
+
9
+*Since:* 0.4.0
10
+
11
+## Properties
12
+
13
+### id
14
+
15
+`pointer.id: number, read-only`
16
+
17
+A unique identifier assigned to this pointer.
18
+
19
+### phase
20
+
21
+`pointer.phase: string, read-only`
22
+
23
+The phase of the pointer. It's one of the following strings:
24
+
25
+* `"began"`: the tracking began in this frame (e.g., a finger has just touched the screen)
26
+* `"stationary"`: the user did not move the pointer in this frame
27
+* `"moved"`: the user moved the pointer in this frame
28
+* `"ended"`: the tracking ended in this frame (e.g., a finger has just been lifted from the screen)
29
+* `"canceled"`: the tracking was canceled in this frame (e.g., the screen orientation of the device has just been changed)
30
+
31
+### position
32
+
33
+`pointer.position: Vector2, read-only`
34
+
35
+The current position of the pointer, given in normalized coordinates.
36
+
37
+### initialPosition
38
+
39
+`pointer.initialPosition: Vector2, read-only`
40
+
41
+The position of the pointer when its tracking began.
42
+
43
+### deltaPosition
44
+
45
+`pointer.deltaPosition: Vector2, read-only`
46
+
47
+The difference between the position of the pointer in this and in the previous frame.
48
+
49
+### velocity
50
+
51
+`pointer.velocity: Vector2, read-only`
52
+
53
+The current velocity of the pointer, given in normalized coordinates per second. You can get the speed of motion by calculating the [magnitude](vector2.md#length) of this vector.
54
+
55
+### isPrimary
56
+
57
+`pointer.isPrimary: boolean, read-only`
58
+
59
+Whether or not this is the primary pointer among all pointers of this [type](#type). A typical primary pointer is that of a finger that touches the screen when no other fingers are touching it.
60
+
61
+### type
62
+
63
+`pointer.type: string, read-only`
64
+
65
+The type of device that originated this pointer. Typically `"touch"`, `"mouse"` or `"pen"`.

+ 7
- 2
mkdocs.yml Näytä tiedosto

@@ -80,6 +80,10 @@ nav:
80 80
         - 'ReferenceImageDatabase': 'api/reference-image-database.md'
81 81
         - 'ImageTrackerResult': 'api/image-tracker-result.md'
82 82
         - 'TrackableImage': 'api/trackable-image.md'
83
+      - 'Pointer tracker':
84
+        - 'PointerTracker': 'api/pointer-tracker.md'
85
+        - 'PointerTrackerResult': 'api/pointer-tracker-result.md'
86
+        - 'TrackablePointer': 'api/trackable-pointer.md'
83 87
       - 'Tracker': 'api/tracker.md'
84 88
       - 'TrackerResult': 'api/tracker-result.md'
85 89
       - 'Trackable': 'api/trackable.md'
@@ -87,6 +91,7 @@ nav:
87 91
       - 'CameraSource': 'api/camera-source.md'
88 92
       - 'CanvasSource': 'api/canvas-source.md'
89 93
       - 'VideoSource': 'api/video-source.md'
94
+      - 'PointerSource': 'api/pointer-source.md'
90 95
       - 'Source': 'api/source.md'
91 96
     - 'Geometry':
92 97
       - 'Pose': 'api/pose.md'
@@ -95,9 +100,9 @@ nav:
95 100
       - 'View': 'api/view.md'
96 101
       - 'PerspectiveView': 'api/perspective-view.md'
97 102
       - 'Transform': 'api/transform.md'
98
-      - 'Quaternion': 'api/quaternion.md'
99
-      - 'Vector3': 'api/vector3.md'
100 103
       - 'Vector2': 'api/vector2.md'
104
+      - 'Vector3': 'api/vector3.md'
105
+      - 'Quaternion': 'api/quaternion.md'
101 106
     - 'Visualization':
102 107
       - 'Viewport': 'api/viewport.md'
103 108
       - 'HUD': 'api/hud.md'

Loading…
Peruuta
Tallenna