license export type Tuple < T > = [ T , T ] ; export type StringTuple = Tuple < string > ; export type NumberTuple = Tuple < number > ; export const partNames = [ 'nose' , 'leftEye' , 'rightEye' , 'leftEar' , 'rightEar' , 'leftShoulder' , 'rightShoulder' , 'leftElbow' , 'rightElbow' , 'leftWrist' , 'rightWrist' , 'leftHip' , 'rightHip' , 'leftKnee' , 'rightKnee' , 'leftAnkle' , 'rightAnkle' ] ; export const NUM_KEYPOINTS = partNames . length ; export interface NumberDict { [ jointName ] : number ; } export const partIds = partNames . reduce ( ( result , jointName , i ) : NumberDict => { result [ jointName ] = i ; return result ; } , { } ) as NumberDict ; const connectedPartNames = [ [ 'leftHip' , 'leftShoulder' ] , [ 'leftElbow' , 'leftShoulder' ] , [ 'leftElbow' , 'leftWrist' ] , [ 'leftHip' , 'leftKnee' ] , [ 'leftKnee' , 'leftAnkle' ] , [ 'rightHip' , 'rightShoulder' ] , [ 'rightElbow' , 'rightShoulder' ] , [ 'rightElbow' , 'rightWrist' ] , [ 'rightHip' , 'rightKnee' ] , [ 'rightKnee' , 'rightAnkle' ] , [ 'leftShoulder' , 'rightShoulder' ] , [ 'leftHip' , 'rightHip' ] ] ; export const connectedPartIndeces = connectedPartNames . map ( ( [ jointNameA , jointNameB ] ) => ( [ partIds [ jointNameA ] , partIds [ jointNameB ] ] ) ) ;