import { reuseLandmarkForImageType } from 'analyses/helpers' ; import { G , Sn , softMe } from 'analyses/landmarks/points/soft' ; import { createVectorFromPoints , composeGeoObject , createHorizontalLine , } from 'utils/math' ; export const frontalG = reuseLandmarkForImageType ( 'photo_frontal' ) ( G ) ; export const frontalSn = reuseLandmarkForImageType ( 'photo_frontal' ) ( Sn ) ; export const frontalSoftMe = reuseLandmarkForImageType ( 'photo_frontal' ) ( softMe ) ; export const upperFaceHeight = { symbol : 'upperFaceHeight' , name : 'Upper face height' , unit : 'mm' , components : [ frontalG , frontalSn ] , imageType : 'photo_frontal' , type : 'distance' , map ( G , Sn ) { return createVectorFromPoints ( G , Sn ) ; } , calculate : ( ) => ( G , Sn ) => ( ) => { return G . y - Sn . y ; } , } ; export const lowerFaceHeight = { symbol : 'lowerFaceHeight' , name : 'Lower face height' , unit : 'mm' , components : [ frontalSn , softMe ] , imageType : 'photo_frontal' , type : 'distance' , map ( Sn , softMe ) { return createVectorFromPoints ( Sn , softMe ) ; } , calculate : ( ) => ( Sn , softMe ) => ( ) => { return Sn . y - softMe . y ; } , } ; export const verticalFaceProprtions = { symbol : 'verticalFaceProprtions' , name : 'Vertical Face Proportions' , components : [ upperFaceHeight , lowerFaceHeight , frontalG , frontalSn , frontalSoftMe ] , imageType : 'photo_frontal' , type : 'ratio' , map ( _ , __ , G , Sn , softMe ) { return composeGeoObject ( createHorizontalLine ( G , 0 ) , createHorizontalLine ( Sn , 0 ) , createHorizontalLine ( softMe , 0 ) ) ; } , calculate : ( upper , lower ) => ( ) => ( ) => { return upper / lower ; } , } ;