const color = 'aqua' ; export const drawPoint = ( ctx , y , x , r , color ) => { ctx . beginPath ( ) ; ctx . arc ( x , y , r , 0 , 2 * Math . PI ) ; ctx . fillStyle = color ; ctx . fill ( ) ; } ; /**
 * Draw pose keypoints onto a canvas
 */ export const drawKeypoints = ( keypoints , ctx , scale = 1 ) => { for ( let i = 0 ; i < keypoints . length ; i ++ ) { const keypoint = keypoints [ i ] ; const [ x , y , _ ] = keypoint ; drawPoint ( ctx , y * scale , x * scale , 1 , color ) ; } } ; export const drawKeyAreaByPoints = ( keypoints , ctx , color = 'red' ) => { ctx . moveTo ( keypoints [ 0 ] [ 0 ] , keypoints [ 0 ] [ 1 ] ) ; for ( let i = 1 ; i < keypoints . length ; i ++ ) { const keypoint = keypoints [ i ] ; const [ x , y , _ ] = keypoint ; ctx . lineTo ( x , y ) ; } ctx . setFillStyle ( color ) ; ctx . fill ( ) ; } ;