Home | History | Annotate | Download | only in Intersection
      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  */
      7 #if !defined CUBIC_UTILITIES_H
      8 #define CUBIC_UTILITIES_H
      9 
     10 #include "DataTypes.h"
     11 #include "SkTDArray.h"
     12 
     13 double calcPrecision(const Cubic& cubic);
     14 #if SK_DEBUG
     15 double calcPrecision(const Cubic& cubic, double t, double scale);
     16 #endif
     17 void chop_at(const Cubic& src, CubicPair& dst, double t);
     18 bool clockwise(const Cubic& c);
     19 double cube_root(double x);
     20 int cubic_to_quadratics(const Cubic& cubic, double precision,
     21         SkTDArray<Quadratic>& quadratics);
     22 void cubic_to_quadratics(const Cubic& cubic, double precision, SkTDArray<double>& ts);
     23 void coefficients(const double* cubic, double& A, double& B, double& C, double& D);
     24 bool controls_contained_by_ends(const Cubic& c);
     25 int cubicRootsValidT(double A, double B, double C, double D, double t[3]);
     26 int cubicRootsReal(double A, double B, double C, double D, double s[3]);
     27 void demote_cubic_to_quad(const Cubic& cubic, Quadratic& quad);
     28 double dx_at_t(const Cubic& , double t);
     29 double dy_at_t(const Cubic& , double t);
     30 //void dxdy_at_t(const Cubic& , double t, _Point& y);
     31 _Vector dxdy_at_t(const Cubic& cubic, double t);
     32 bool ends_are_extrema_in_x_or_y(const Cubic& );
     33 int find_cubic_inflections(const Cubic& src, double tValues[]);
     34 int find_cubic_max_curvature(const Cubic& src, double tValues[]);
     35 bool monotonic_in_y(const Cubic& c);
     36 bool rotate(const Cubic& cubic, int zero, int index, Cubic& rotPath);
     37 bool serpentine(const Cubic& c);
     38 void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst);
     39 void sub_divide(const Cubic& , const _Point& a, const _Point& d, double t1, double t2, _Point [2]);
     40 _Point top(const Cubic& , double startT, double endT);
     41 void xy_at_t(const Cubic& , double t, double& x, double& y);
     42 _Point xy_at_t(const Cubic& , double t);
     43 
     44 extern const int gPrecisionUnit;
     45 
     46 #endif
     47