LOOK AND TYPE / STUDY / LEVEL 2 OF 5

Picking
by angle.

Level 1 gave a ray. Which thing on the desk is it aimed at? The usual answer is to test whether the ray hits each thing's box. That works for a controller beam, which a hand can hold still. It works badly for a head: nobody holds their head exactly on the middle of a small house. So this scene does not ask "does the ray hit the box". It asks how far off each thing is from the middle of the view, as an angle, and takes the nearest one if it is near enough. The thing already in focus gets a small head start, so the focus does not flicker between two neighbours. And when I look down at the keyboard to type, the focus stays where it was.

gazeMiss(ray, target)angle to its centre, minus the angle it covers
→
pickGaze(ray, targets, current)smallest miss under the cone; the current one gets sticky off its miss
⇒
a thing, a place, or keepno thing: the desk top; looking down: the focus stays

Look around the desk

drag either picture

What the head sees

From behind my shoulder

Round each thing: the solid circle is the angle the thing covers; the dashed circle is that plus the cone (0.10 rad). The cross has to be inside a dashed circle for the thing to be picked. The thing in focus has a third, wider circle: the head start (0.06 rad more).

Every thing's miss

in degrees; the cone is 5.7°

The miss angle and the pick

js/scenes/hw9/gazeType.js

off is the angle between the gaze and the direction to the thing's centre. The thing itself covers an angle of about atan(its largest half size ÷ its distance). A big or close thing covers a wide angle and is easy to look at. A miss of zero or less means the gaze is on it.


      

A thing, a place, or keep the focus

js/scenes/hw9/deskTyping.js

The scene tries three things in order, every frame. A thing first. If none, the place on the desk top the ray meets: that is "an empty place", where typing builds something new. If neither, it asks lookingDown. A steep look down (more than about 25° below level) keeps the last focus. Any other direction also means "something new", at the nearest place on the desk, or in a free place if I look up.


      

      
Full files: gazeType.js ↗ · deskTyping.js ↗ · tests: js/scenes/hw9/gazeType.test.mjs

What you should be able to explain

  1. Why an angle and not a hit. Look just beside the house. A ray test would say "missed". The miss angle is small, well under the cone, so the house is still picked. The test file checks exactly this case: 4 cm past the side of the house.
  2. Why subtract what the thing covers. Without it, only the distance to the centre would count, and the lamp, which is tall, could only be picked by looking at its middle. With it, the miss is zero at the edge of the thing and negative inside it.
  3. What sticky does. Use "Look between the tower and the tree" and tick the wobble. With the head start the focus stays on one of them. Untick the head start: the focus jumps each time the wobble crosses the middle. The count on the right shows it.
  4. Why looking down is special. People look at their hands to type. If that counted as "looking at nothing", the words would lose their target the moment I glanced at the keyboard. So a steep look down that meets neither a thing nor the desk top changes nothing.
  5. What the box is. A target is a centre and a half size. They come from the same functions the Giant & Mini scene uses for grabbing: houseBounds, propBounds and thingBounds. The pick uses only the largest half size, so the box is treated as a ball.

Exercises: ① Look at the lamp, then turn slowly toward the house. At what miss does the focus leave the lamp, and why is that not 5.7°? ② With the wobble on and the head start off, look between the tower and the tree. How many times does the focus change in ten seconds? Tick the head start again. ③ Look down at the keyboard, then up at the wall. What is the target after each, and which line decided it?