A generalization of the right triangle altitude theorem

The right triangle altitude theorem describes a relation between the altitude on the hypotenuse in a right triangle and the two line segments it creates on the hypotenuse by orthogonal projection. It states that the geometric mean of the two segments equals the altitude, or in other words, The initial setting in this diagram that the triangle ABC is right, hence the equation is valid. By dragging the point C and keeping the triangle right it can be visually checked that the equation is correct in those cases. By dragging C to make a non-right triangle, its color will be slowly changed to red. This means that the formula is no longer valid, the difference of the color from green shows the difference of the sides of the equation.
The theorem of Thales ensures that the triangle is right if and only if C lies on a circle with diameter AB. That is, the locus of the "green" C points is a circle... or something more? By computing and showing the implicit locus one can find other curves so that the position of C will introduce suitable lengths p, q and h to satisfy the equation.

What curve (or curves) satisfy the equation (other than the Thales circle of the diameter AB)?

Check your answer here