caryclark@google.com | 9e49fb6 | 2012-08-27 14:11:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
caryclark@google.com | 235f56a | 2012-09-14 14:19:30 +0000 | [diff] [blame] | 7 | #if !defined CUBIC_UTILITIES_H |
| 8 | #define CUBIC_UTILITIES_H |
| 9 | |
caryclark@google.com | 8dcf114 | 2012-07-02 20:27:02 +0000 | [diff] [blame] | 10 | #include "DataTypes.h" |
caryclark@google.com | 6d0032a | 2013-01-04 19:41:13 +0000 | [diff] [blame] | 11 | #include "SkTDArray.h" |
caryclark@google.com | 8dcf114 | 2012-07-02 20:27:02 +0000 | [diff] [blame] | 12 | |
caryclark@google.com | 73ca624 | 2013-01-17 21:02:47 +0000 | [diff] [blame] | 13 | double calcPrecision(const Cubic& cubic); |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame] | 14 | double cube_root(double x); |
caryclark@google.com | d68bc30 | 2013-01-07 13:17:18 +0000 | [diff] [blame] | 15 | int cubic_to_quadratics(const Cubic& cubic, double precision, |
| 16 | SkTDArray<Quadratic>& quadratics); |
caryclark@google.com | 73ca624 | 2013-01-17 21:02:47 +0000 | [diff] [blame] | 17 | void cubic_to_quadratics(const Cubic& cubic, double precision, SkTDArray<double>& ts); |
caryclark@google.com | c682590 | 2012-02-03 22:07:47 +0000 | [diff] [blame] | 18 | void coefficients(const double* cubic, double& A, double& B, double& C, double& D); |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame] | 19 | int cubicRoots(double A, double B, double C, double D, double t[3]); |
caryclark@google.com | 73ca624 | 2013-01-17 21:02:47 +0000 | [diff] [blame] | 20 | int cubicRootsX(double A, double B, double C, double D, double s[3]); |
| 21 | void demote_cubic_to_quad(const Cubic& cubic, Quadratic& quad); |
caryclark@google.com | 05c4bad | 2013-01-19 13:22:39 +0000 | [diff] [blame^] | 22 | double dx_at_t(const Cubic& , double t); |
| 23 | double dy_at_t(const Cubic& , double t); |
| 24 | void dxdy_at_t(const Cubic& , double t, _Point& y); |
caryclark@google.com | 73ca624 | 2013-01-17 21:02:47 +0000 | [diff] [blame] | 25 | int find_cubic_inflections(const Cubic& src, double tValues[]); |
caryclark@google.com | 8dcf114 | 2012-07-02 20:27:02 +0000 | [diff] [blame] | 26 | bool rotate(const Cubic& cubic, int zero, int index, Cubic& rotPath); |
caryclark@google.com | 8dcf114 | 2012-07-02 20:27:02 +0000 | [diff] [blame] | 27 | void xy_at_t(const Cubic& , double t, double& x, double& y); |
caryclark@google.com | 235f56a | 2012-09-14 14:19:30 +0000 | [diff] [blame] | 28 | |
caryclark@google.com | 05c4bad | 2013-01-19 13:22:39 +0000 | [diff] [blame^] | 29 | extern const int precisionUnit; |
caryclark@google.com | 235f56a | 2012-09-14 14:19:30 +0000 | [diff] [blame] | 30 | #endif |