blob: bc567eab8e3970d41f2a05f8f524b1b5c4f261bf [file] [log] [blame]
bungeman@google.comd3fbd342014-04-15 15:52:07 +00001/*
2 * Copyright 2014 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
commit-bot@chromium.org2cfa3202014-04-19 22:00:40 +00008#ifndef SkMatrix22_DEFINED
9#define SkMatrix22_DEFINED
10
bungeman@google.comd3fbd342014-04-15 15:52:07 +000011#include "SkPoint.h"
12
13class SkMatrix;
14
15/** Find the Givens matrix G, which is the rotational matrix
16 * that rotates the vector h to the positive hoizontal axis.
17 * G * h = [hypot(h), 0]
18 *
19 * This is equivalent to
20 *
21 * SkScalar r = h.length();
22 * SkScalar r_inv = r ? SkScalarInvert(r) : 0;
23 * h.scale(r_inv);
24 * G->setSinCos(-h.fY, h.fX);
25 *
26 * but has better numerical stability by using (partial) hypot,
27 * and saves a multiply by not computing r.
28 */
29void SkComputeGivensRotation(const SkVector& h, SkMatrix* G);
commit-bot@chromium.org2cfa3202014-04-19 22:00:40 +000030
31#endif