blob: 6159472f7e8d04f542f168abc3643129f2ff0062 [file] [log] [blame]
caryclark@google.com9e49fb62012-08-27 14:11:33 +00001/*
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.com235f56a2012-09-14 14:19:30 +00007#if !defined CUBIC_UTILITIES_H
8#define CUBIC_UTILITIES_H
9
caryclark@google.com8dcf1142012-07-02 20:27:02 +000010#include "DataTypes.h"
caryclark@google.com6d0032a2013-01-04 19:41:13 +000011#include "SkTDArray.h"
caryclark@google.com8dcf1142012-07-02 20:27:02 +000012
caryclark@google.com73ca6242013-01-17 21:02:47 +000013double calcPrecision(const Cubic& cubic);
caryclark@google.com27accef2012-01-25 18:57:23 +000014double cube_root(double x);
caryclark@google.comd68bc302013-01-07 13:17:18 +000015int cubic_to_quadratics(const Cubic& cubic, double precision,
16 SkTDArray<Quadratic>& quadratics);
caryclark@google.com73ca6242013-01-17 21:02:47 +000017void cubic_to_quadratics(const Cubic& cubic, double precision, SkTDArray<double>& ts);
caryclark@google.comc6825902012-02-03 22:07:47 +000018void coefficients(const double* cubic, double& A, double& B, double& C, double& D);
caryclark@google.com27accef2012-01-25 18:57:23 +000019int cubicRoots(double A, double B, double C, double D, double t[3]);
caryclark@google.com73ca6242013-01-17 21:02:47 +000020int cubicRootsX(double A, double B, double C, double D, double s[3]);
21void demote_cubic_to_quad(const Cubic& cubic, Quadratic& quad);
caryclark@google.com8dcf1142012-07-02 20:27:02 +000022double derivativeAtT(const double* cubic, double t);
caryclark@google.com8dcf1142012-07-02 20:27:02 +000023void dxdy_at_t(const Cubic& , double t, double& x, double& y);
caryclark@google.com73ca6242013-01-17 21:02:47 +000024int find_cubic_inflections(const Cubic& src, double tValues[]);
caryclark@google.com8dcf1142012-07-02 20:27:02 +000025bool rotate(const Cubic& cubic, int zero, int index, Cubic& rotPath);
26double secondDerivativeAtT(const double* cubic, double t);
27void xy_at_t(const Cubic& , double t, double& x, double& y);
caryclark@google.com235f56a2012-09-14 14:19:30 +000028
29#endif