teaching machines

Everywhere Pointer

October 10, 2013 by . Filed under madeup, public.

My five-year-old son wanted to make an arrow. I one-upped him by making four arrows. He liked the shape and called it an “everywhere pointer.”

My son’s everywhere pointer.

We can make this with the following code:

fracture = 0.1
length = 14
width = 4
pointiness = 15
nsides = 20
shaftToHeadAngle = 110
barbAngle = 135

arrow =
  -- Right upright.
  move length
  -- Start arrowhead.
  yaw shaftToHeadAngle
  move width
  -- Head to point.
  yaw -1 * barbAngle
  move pointiness
  -- We just hit the point. Now return.
  yaw -1 * (180.0 - 2 * (barbAngle - shaftToHeadAngle))
  move pointiness
  -- Finish arrow head.
  yaw -1 * barbAngle
  move width
  -- Left upright.
  yaw shaftToHeadAngle
  move length
end

moveto 0 0 0
repeat 4
  arrow
  yaw 90
end
tube

This code makes me realize I should try to add the unary negation operator. Right now I have to verbosely multiply by -1. Finding a general solution to the angles was another good geometry exercise.