Example 5 In $\triangle A B C$, $D 、 E 、 F$ are the midpoints of $B C$ 、 $C A 、 A B$ respectively, and $G$ is the centroid. How many non-similar triangles $A B C$ are there for each value of $\angle B A C$ such that $A E G F$ is a cyclic quadrilateral?
Solution: From the fact that $A, E, G, F$ are concyclic, we get $\angle CGE = \angle BAC$,

Also, since $DE$ is the midline of $\triangle ABC$, we have $DE \parallel AB$.

Therefore, $\angle CED = \angle BAC$, hence $\angle CGE = \angle CED$.

Let $DE$ intersect $CF$ at $M$, then $\triangle CEM \sim \triangle CGE$, thus $\frac{CM}{CE} = \frac{CE}{CG}$, i.e., $CE^2 = CM \cdot CG$.

Let $AB = c, BC = a, CA = b$, and the median to side $a$ be $m_a$, the median to side $b$ be $m_b$, and the median to side $c$ be $m_c$,
then $\frac{1}{2} m_c \cdot \frac{2}{3} m_c = \left(\frac{1}{2} b\right)^2$, i.e., $m_c^2 = \frac{3}{4} b^2$.
Also, by the median formula, we have $m_c^2 = \frac{1}{2} a^2 + \frac{1}{2} b^2 - \frac{1}{4} c^2$.
From (1) and (2), we get $\frac{3}{4} b^2 = \frac{1}{2} a^2 + \frac{1}{2} b^2 - \frac{1}{4} c^2$, i.e., $b^2 + c^2 = 2a^2$.

By the cosine rule, we have $a^2 = b^2 + c^2 - 2bc \cos \angle BAC$,
From (3) and (4), we get $b^2 + c^2 = 4bc \cos \angle BAC$.
Also, $b^2 + c^2 \geq 2bc$, thus $4bc \cos \angle BAC \geq 2bc$, so $\angle BAC \leq 60^\circ$.

At this point, equation (5) becomes $\left(\frac{b}{c}\right)^2 - 4 \frac{b}{c} \cos \angle BAC + 1 = 0$.

Clearly, the two roots of this equation are reciprocals of each other, therefore, for triangles $ABC$ that satisfy $\angle BAC \leq 60^\circ$ and also satisfy that $AEGF$ is a cyclic quadrilateral, there is only one such triangle that is not similar to others.

When $\angle BAC > 60^\circ$, equation (6) has no solution, and there are no triangles that meet the conditions.