SkMatrix22.h 748 B

12345678910111213141516171819202122232425262728293031
  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. #ifndef SkMatrix22_DEFINED
  8. #define SkMatrix22_DEFINED
  9. #include "include/core/SkPoint.h"
  10. class SkMatrix;
  11. /** Find the Givens matrix G, which is the rotational matrix
  12. * that rotates the vector h to the positive hoizontal axis.
  13. * G * h = [hypot(h), 0]
  14. *
  15. * This is equivalent to
  16. *
  17. * SkScalar r = h.length();
  18. * SkScalar r_inv = r ? SkScalarInvert(r) : 0;
  19. * h.scale(r_inv);
  20. * G->setSinCos(-h.fY, h.fX);
  21. *
  22. * but has better numerical stability by using (partial) hypot,
  23. * and saves a multiply by not computing r.
  24. */
  25. void SkComputeGivensRotation(const SkVector& h, SkMatrix* G);
  26. #endif