RingFitPlugin
Hand plugin fitting a ring
Plugin fitting a ring object on a pose estimated by @geenee/bodyprocessors!HandProcessor. Using tracking data RingFitPlugin estimates the transformation of a ring 3d object fitting it on the selected finger. Plugin supports rings having unit inner diameter and lying in xz plane, with y axis being a center of the ring’s inner circle and x axis pointing in the ring’s head direction. Offset of a ring from world’s origin along y axis defines how far it will be from the phalanx start. See FingersFitPlugin for additional details.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RingFitPlugin():
RingFitPlugin
Constructor
Returns
Section titled “Returns”RingFitPlugin
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”finger
Section titled “finger”
protected
finger:"index"
|"middle"
|"ring"
|"pinky"
="ring"
Finger to put ring on
loaded
Section titled “loaded”loaded:
boolean
Loaded state
Inherited from
Section titled “Inherited from”
protected
optional
node:Object3D
<Object3DEventMap
>
Attached scene node
ordinal
Section titled “ordinal”ordinal:
number
Ordinal number
Inherited from
Section titled “Inherited from”renderer?
Section titled “renderer?”
protected
optional
renderer:Renderer
<HandResult
>
Renderer loaded the plugin
Inherited from
Section titled “Inherited from”scene?
Section titled “scene?”
protected
optional
scene:Scene
Reference to a scene instance
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Dispose video plugin
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”estimateBones()
Section titled “estimateBones()”
protected
estimateBones(pose
,handedness
):BoneTransform
[]
Estimate phalanxes positions and orientations
Using detected keypoints approximates transformations of phalanxes. Position of a phalanx is defined by 3D point of the corresponding joint. Its length is the distance between keypoints defining the phalanx. Rotation is defined by its axes that are evaluated using kinematic rules and relative positions of adjacent joint keypoints. Method returns phalanx position & orientation in global world frame.
Parameters
Section titled “Parameters”Pose keypoints
handedness
Section titled “handedness”number
Returns
Section titled “Returns”Phalanx transformations
load()
Section titled “load()”load(
renderer
):Promise
<void
>
Initialize plugin
Prepares or modifies the attached node if required. Reference to the scene object is cached and used by plugin on update() and unload(). You need to reload plugin if you want to change scene it’s attached to.
Parameters
Section titled “Parameters”renderer
Section titled “renderer”Renderer this plugin is attached to
Returns
Section titled “Returns”Promise
<void
>
Promise resolving when initialization is finished
Inherited from
Section titled “Inherited from”setNode()
Section titled “setNode()”setNode(
node?
,finger?
):void
Set/attach a scene node of a ring
Parameters
Section titled “Parameters”Object3D
<Object3DEventMap
>
Scene node to attach
finger?
Section titled “finger?”"index"
| "middle"
| "ring"
| "pinky"
Returns
Section titled “Returns”void
setupCamera()
Section titled “setupCamera()”setupCamera(
ratio
,angle
):void
Set camera parameters
Could be overridden to adjust plugin’s pipeline.
Parameters
Section titled “Parameters”number
Aspect ration of input video
number
Vertical field of view in radians
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setupVideo()
Section titled “setupVideo()”setupVideo(
size
):void
Set video size
Could be overridden to adjust plugin’s pipeline.
Parameters
Section titled “Parameters”Resolution of input video
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”unload()
Section titled “unload()”unload():
void
Reset plugin
Releases all resources allocated in load(). Deletes cached reference to the scene object.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”update()
Section titled “update()”update(
result
,stream
):Promise
<void
>
Update pose of the ring’s scene node
Evaluates positions, rotations and scales of selected phalanx based on 3D keypoints and tracking data, then applies these transformations to the attached scene node.
Parameters
Section titled “Parameters”result
Section titled “result”Hand estimation results
stream
Section titled “stream”HTMLCanvasElement
Captured video frame
Returns
Section titled “Returns”Promise
<void
>
Promise resolving when update is finished