blob: 5bc15eac92f77b20335e2fc1730e1c23a72c7c46 [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.com8dcf1142012-07-02 20:27:02 +00007#include "DataTypes.h"
8
9void dxdy_at_t(const Quadratic& , double t, double& x, double& y);
10
caryclark@google.com639df892012-01-10 21:46:10 +000011/* Parameterization form, given A*t*t + 2*B*t*(1-t) + C*(1-t)*(1-t)
12 *
13 * a = A - 2*B + C
14 * b = 2*B - 2*C
15 * c = C
16 */
caryclark@google.com27accef2012-01-25 18:57:23 +000017inline void set_abc(const double* quad, double& a, double& b, double& c) {
caryclark@google.com639df892012-01-10 21:46:10 +000018 a = quad[0]; // a = A
19 b = 2 * quad[2]; // b = 2*B
20 c = quad[4]; // c = C
21 b -= c; // b = 2*B - C
22 a -= b; // a = A - 2*B + C
23 b -= c; // b = 2*B - 2*C
24}
caryclark@google.com27accef2012-01-25 18:57:23 +000025
26int quadraticRoots(double A, double B, double C, double t[2]);
caryclark@google.com8dcf1142012-07-02 20:27:02 +000027
28void xy_at_t(const Quadratic& , double t, double& x, double& y);