kzc_solve.hpp File Reference

Equation solving utilities. More...

Functions

KZ_INLINE void kzcSolveNormalizedQuadratic (kzFloat P, kzFloat Q, kzBool *out_solutions, kzFloat *out_solution1, kzFloat *out_solution2)
 Solves a quadratic of form x^2 + P x + Q = 0. More...
 
KZ_INLINE void kzcSolveQuadratic (kzFloat A, kzFloat B, kzFloat C, kzBool *out_solutions, kzFloat *out_solution1, kzFloat *out_solution2)
 Solves a quadratic of form Ax^2 + Bx + C = 0. More...
 

Detailed Description

Equation solving utilities.

Copyright 2008-2017 by Rightware. All rights reserved.

Function Documentation

KZ_INLINE void kzcSolveNormalizedQuadratic ( kzFloat  P,
kzFloat  Q,
kzBool out_solutions,
kzFloat out_solution1,
kzFloat out_solution2 
)

Solves a quadratic of form x^2 + P x + Q = 0.

Avoids losing precision unnecessarily.

If there are no solutions, out_solutions will be KZ_FALSE. Otherwise, out_solution1 will be the smaller solution and out_solution2 will be the greater solution.

KZ_INLINE void kzcSolveQuadratic ( kzFloat  A,
kzFloat  B,
kzFloat  C,
kzBool out_solutions,
kzFloat out_solution1,
kzFloat out_solution2 
)

Solves a quadratic of form Ax^2 + Bx + C = 0.

Avoids losing precision unnecessarily.

If there are no solutions, out_solutions will be KZ_FALSE. Otherwise, out_solution1 will be the smaller solution and out_solution2 will be the greater solution.