Not entirely clear where one detail which is not mentioned. Ternary quadratic form always amounts to a Pell equation. For example if you take a fairly simple equation. And set some conditions for the coefficients.
All of numbers can be any character.In Equation: $qX^2+Y^2=Z^2+a$
If the ratio is factored so: $a=(b-c)(b+c)$
Then we use the solutions of Pell's equation: $p^2-fs^2=\pm1$
where: $f=(q+1)k^2-2kt-(q-1)t^2$
Then the solutions are of the form:
$$X=2(ck-bt)ps+2(bk^2-(b+c)kt+ct^2)s^2$$
$$Y=bp^2+2c(k-t)ps-(b(q-1)k^2+2(b-qc)kt+b(q-1)t^2)s^2$$
$$Z=cp^2+2b(k-t)ps+(c(q+1)k^2-2(bq+c)kt+c(q+1)t^2)s^2$$
All of numbers can be any character.
For the equation: $qX^2+Y^2=Z^2+j$
In the case where a square: $a=\sqrt{\frac{j}{q}}$
Using equation Pell: $p^2-(q+1)s^2=1$
Then the solution can be written:
$$X=2s(s\pm{p})L\pm{ap^2}+2aps\pm{a(q+1)s^2}=bL+af$$
$$Y=(p^2\pm2ps+(1-q)s^2)L\pm{ap^2}+2aps\pm{a(q+1)s^2}=cL+af$$
$$Z=(p^2\pm2ps+(q+1)s^2)L\pm{ap^2}+2a(q+1)ps\pm{a(q+1)s^2}=fL+at$$
$L$ - any integer number given by us.
The most interesting thing is that these numbers are solutions of equations:
$qb^2+c^2=f^2$
$t^2-(q+1)f^2=\pm{q}$
If we use the equation Pell: $p^2-(q+1)s^2=k$
And substituting the solutions in the upper formula, we have solutions of the following equations.
$qb^2+c^2=f^2$
where: $c-b=k$
$t^2-(q+1)f^2=\pm{qk^2}$
True, I use this formula in reverse order. Find solutions of Pell's equation is much more complicated than the simple equations like Pythagorean triples. So find them and then have solutions of Pell's equation. The most interesting thing is that the solution of Pell related to Pythagorean triples.
You can also write a more General formula. In this case it will be necessary to consider all the possible equivalent forms. In this case, anyway. The problem is reduced to solving a Pell equation. I think it's easier to solve.
This approach makes it quite easy to prove that the curves for triangular numbers is always possible to write the solution. If the coefficients of the 1-St degree is not equal to 0. And the coefficients of the 2nd degree don't create a trivial situation. The formula there. https://math.stackexchange.com/questions/794510/curves-triangular-numbers