Skip to content

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 HandFitPlugin for additional details.

Extends

Constructors

new RingFitPlugin()

new RingFitPlugin(node?, finger?): RingFitPlugin

Constructor

Parameters

node?: Object3D<Object3DEventMap>

Scene node to attach

finger?: "index" | "middle" | "ring" | "pinky" = "ring"

Finger to put ring on

Returns

RingFitPlugin

Overrides

HandPlugin.constructor

Properties

finger

protected finger: "index" | "middle" | "ring" | "pinky" = "ring"

Finger to put ring on


loaded

loaded: boolean

Loaded state

Inherited from

HandPlugin.loaded


node?

protected optional node: Object3D<Object3DEventMap>

Scene node to attach


ordinal

ordinal: number

Ordinal number

Inherited from

HandPlugin.ordinal


renderer?

protected optional renderer: Renderer<HandResult>

Renderer loaded the plugin

Inherited from

HandPlugin.renderer


scene?

protected optional scene: Scene

Reference to a scene instance

Inherited from

HandPlugin.scene

Methods

dispose()

dispose(): void

Dispose video plugin

Returns

void

Inherited from

HandPlugin.dispose


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

pose: HandPoint[]

Pose keypoints

handedness: number

Returns

BoneTransform[]

Phalanx transformations


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

renderer: Renderer<HandResult>

Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Inherited from

HandPlugin.load


setNode()

setNode(node?): void

Set/attach a scene node of a ring

Parameters

node?: Object3D<Object3DEventMap>

Scene node to attach

Returns

void


setupCamera()

setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

Parameters

ratio: number

Aspect ration of input video

angle: number

Vertical field of view in radians

Returns

void

Inherited from

HandPlugin.setupCamera


setupVideo()

setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Parameters

size: Size

Resolution of input video

Returns

void

Inherited from

HandPlugin.setupVideo


unload()

unload(): void

Reset plugin

Releases all resources allocated in load(). Deletes cached reference to the scene object.

Returns

void

Inherited from

HandPlugin.unload


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

result: HandResult

Hand estimation results

stream: HTMLCanvasElement

Captured video frame

Returns

Promise<void>

Promise resolving when update is finished

Overrides

HandPlugin.update