bungeman@google.com | d3fbd34 | 2014-04-15 15:52:07 +0000 | [diff] [blame] | 1 | /* |
| 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.org | 2cfa320 | 2014-04-19 22:00:40 +0000 | [diff] [blame] | 8 | #ifndef SkMatrix22_DEFINED |
| 9 | #define SkMatrix22_DEFINED |
| 10 | |
bungeman@google.com | d3fbd34 | 2014-04-15 15:52:07 +0000 | [diff] [blame] | 11 | #include "SkPoint.h" |
| 12 | |
| 13 | class 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 | */ |
| 29 | void SkComputeGivensRotation(const SkVector& h, SkMatrix* G); |
commit-bot@chromium.org | 2cfa320 | 2014-04-19 22:00:40 +0000 | [diff] [blame] | 30 | |
| 31 | #endif |