1 /* 2 * Copyright 2023 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkQuads_DEFINED 9 #define SkQuads_DEFINED 10 11 /** 12 * Utilities for dealing with quadratic formulas with one variable: 13 * f(t) = A*t^2 + B*t + C 14 */ 15 class SkQuads { 16 public: 17 /** 18 * Puts up to 2 real solutions to the equation 19 * A*t^2 + B*t + C = 0 20 * in the provided array. 21 */ 22 static int RootsReal(double A, double B, double C, 23 double solution[2]); 24 25 /** 26 * Evaluates the quadratic function with the 3 provided coefficients and the 27 * provided variable. 28 */ EvalAt(double A,double B,double C,double t)29 static double EvalAt(double A, double B, double C, double t) { 30 return A * t * t + 31 B * t + 32 C; 33 } 34 }; 35 36 #endif 37