Cardiod via perpendiculars to tangent lines

Study what's going on in this construction:
  • Point A is the center of a circle of fixed radius.
  • Point B is a point revolving along the circle
  • A line is drawn perpendicular to the circle at point B.
  • A perpendicular segment is drawn from fixed point C on the circle to the tangent line, meeting the tangent line at point D.
Let your eye follow point D, observing what shape it traces. The "step" slider walks through the steps of this process. With a little playing around, it should become evident what any other sliders/toggles do.
Slider "n" determines the number of points evenly distributed around a circle. Slider "m" cycles through those points, drawing a cord originating from the nth point, labeled "A." As point A increments one position at a time, slider "coeff" determines the number of positions that endpoint "B" jumps. With a little playing around, it should become evident what any other sliders/toggles do.