2012-08-27 14:11:33 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2012-09-14 14:19:30 +00:00
|
|
|
#if !defined CUBIC_UTILITIES_H
|
|
|
|
#define CUBIC_UTILITIES_H
|
|
|
|
|
2012-07-02 20:27:02 +00:00
|
|
|
#include "DataTypes.h"
|
2013-01-04 19:41:13 +00:00
|
|
|
#include "SkTDArray.h"
|
2012-07-02 20:27:02 +00:00
|
|
|
|
2013-01-17 21:02:47 +00:00
|
|
|
double calcPrecision(const Cubic& cubic);
|
2013-01-22 12:55:54 +00:00
|
|
|
#if SK_DEBUG
|
|
|
|
double calcPrecision(const Cubic& cubic, double t, double scale);
|
|
|
|
#endif
|
|
|
|
void chop_at(const Cubic& src, CubicPair& dst, double t);
|
2012-01-25 18:57:23 +00:00
|
|
|
double cube_root(double x);
|
2013-01-07 13:17:18 +00:00
|
|
|
int cubic_to_quadratics(const Cubic& cubic, double precision,
|
|
|
|
SkTDArray<Quadratic>& quadratics);
|
2013-01-17 21:02:47 +00:00
|
|
|
void cubic_to_quadratics(const Cubic& cubic, double precision, SkTDArray<double>& ts);
|
2012-02-03 22:07:47 +00:00
|
|
|
void coefficients(const double* cubic, double& A, double& B, double& C, double& D);
|
2012-01-25 18:57:23 +00:00
|
|
|
int cubicRoots(double A, double B, double C, double D, double t[3]);
|
2013-01-17 21:02:47 +00:00
|
|
|
int cubicRootsX(double A, double B, double C, double D, double s[3]);
|
|
|
|
void demote_cubic_to_quad(const Cubic& cubic, Quadratic& quad);
|
2013-01-19 13:22:39 +00:00
|
|
|
double dx_at_t(const Cubic& , double t);
|
|
|
|
double dy_at_t(const Cubic& , double t);
|
|
|
|
void dxdy_at_t(const Cubic& , double t, _Point& y);
|
2013-01-17 21:02:47 +00:00
|
|
|
int find_cubic_inflections(const Cubic& src, double tValues[]);
|
2012-07-02 20:27:02 +00:00
|
|
|
bool rotate(const Cubic& cubic, int zero, int index, Cubic& rotPath);
|
2013-01-22 12:55:54 +00:00
|
|
|
void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst);
|
2012-07-02 20:27:02 +00:00
|
|
|
void xy_at_t(const Cubic& , double t, double& x, double& y);
|
2012-09-14 14:19:30 +00:00
|
|
|
|
2013-01-19 13:22:39 +00:00
|
|
|
extern const int precisionUnit;
|
2012-09-14 14:19:30 +00:00
|
|
|
#endif
|