# How to define a function to produce a Chernoff face?

How would I define a function to generate a Chernoff face in Mathematica without using the built in ChernoffFace[x]?

• Do you mean ChernoffFace from this package? Apr 19, 2017 at 18:17

Here's a manipulate that implements a display of a face controllable with the sliders on the left. Move/shift the eyes with the mouse.

Manipulate[eyeMat = {{1/(eyeRadius - pupilRadius/2), 0}, {0,
If[Norm[eyeMat.(pup - eyeCenter[[left]])] < 1,
pupNow = pup - eyeCenter[[left]];];
If[Norm[eyeMat.(pup - eyeCenter[[right]])] < 1,
pupNow = pup - eyeCenter[[right]];];
Graphics[{face, eye[left, eyes], eye[right, eyes], Blue,
pupil[left, pupNow, eyes], pupil[right, pupNow, eyes], Black,
browDraw[left, brows, eyes], browDraw[right, brows, eyes],
Inset[mouthDraw[mouth], {0, -0.5}]}, ImageSize -> {400, 450}],
{{brows, {-Pi/20, 0}}, {-0.6, 0}, {0.6, 0.15},
ControlPlacement -> Left},
{{eyes, 0}, -0.07, 0.07, ControlPlacement -> Left,
ControlType -> VerticalSlider},
{{mouth, 0.15}, -0.401, 0.4, 0.01, ControlPlacement -> Left,
ControlType -> VerticalSlider},
{{pup, {0, 0}}, Locator, Appearance -> None},
Initialization :> (face = Circle[{0, 0}, {1, 1.2}]; pupNow = {0, 0};
left = 1; right = 2;
eyeRadius = 0.18; eyeCenter = {{-0.4, 0.15}, {0.4, 0.15}};
browUp = 0.25; browW = 0.2; browAng = Pi/20;
eye[side_, eccen_] := {Black,