chromium/third_party/skia/src/pathops/SkPathOpsConic.cpp

/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include "src/pathops/SkPathOpsConic.h"

#include "include/core/SkTypes.h"
#include "include/private/base/SkFloatingPoint.h"
#include "src/pathops/SkIntersections.h"
#include "src/pathops/SkPathOpsCubic.h"
#include "src/pathops/SkPathOpsQuad.h"
#include "src/pathops/SkPathOpsRect.h"
#include "src/pathops/SkPathOpsTypes.h"

#include <cmath>

struct SkDLine;

// cribbed from the float version in SkGeometry.cpp
static void conic_deriv_coeff(const double src[],
                              SkScalar w,
                              double coeff[3]) {}

static double conic_eval_tan(const double coord[], SkScalar w, double t) {}

int SkDConic::FindExtrema(const double src[], SkScalar w, double t[1]) {}

SkDVector SkDConic::dxdyAtT(double t) const {}

static double conic_eval_numerator(const double src[], SkScalar w, double t) {}


static double conic_eval_denominator(SkScalar w, double t) {}

bool SkDConic::hullIntersects(const SkDCubic& cubic, bool* isLinear) const {}

SkDPoint SkDConic::ptAtT(double t) const {}

/* see quad subdivide for point rationale */
/* w rationale : the mid point between t1 and t2 could be determined from the computed a/b/c
   values if the computed w was known. Since we know the mid point at (t1+t2)/2, we'll assume
   that it is the same as the point on the new curve t==(0+1)/2.

    d / dz == conic_poly(dst, unknownW, .5) / conic_weight(unknownW, .5);

    conic_poly(dst, unknownW, .5)
                  =   a / 4 + (b * unknownW) / 2 + c / 4
                  =  (a + c) / 4 + (bx * unknownW) / 2

    conic_weight(unknownW, .5)
                  =   unknownW / 2 + 1 / 2

    d / dz                  == ((a + c) / 2 + b * unknownW) / (unknownW + 1)
    d / dz * (unknownW + 1) ==  (a + c) / 2 + b * unknownW
              unknownW       = ((a + c) / 2 - d / dz) / (d / dz - b)

    Thus, w is the ratio of the distance from the mid of end points to the on-curve point, and the
    distance of the on-curve point to the control point.
 */
SkDConic SkDConic::subDivide(double t1, double t2) const {}

SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t2,
        SkScalar* weight) const {}

int SkTConic::intersectRay(SkIntersections* i, const SkDLine& line) const {}

bool SkTConic::hullIntersects(const SkDQuad& quad, bool* isLinear) const  {}

bool SkTConic::hullIntersects(const SkDCubic& cubic, bool* isLinear) const {}

void SkTConic::setBounds(SkDRect* rect) const {}