diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-08 11:47:37 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-08 11:47:37 +0000 |
commit | 07393cab57ce74a4aae89a31fae9aaa9780fc19d (patch) | |
tree | 2923009427914f3da107d4797e7e7fd2b9266f9a /src/pathops/SkDQuadImplicit.h | |
parent | 390c6d7a9018e233a6519397ac6c739fb21a99ef (diff) |
Add base types for path ops
Paths contain lines, quads, and cubics, which are
collectively curves.
To work with path intersections, intermediary curves
are constructed. For now, those intermediates use
doubles to guarantee sufficient precision.
The DVector, DPoint, DLine, DQuad, and DCubic
structs encapsulate these intermediate curves.
The DRect and DTriangle structs are created to
describe intersectable areas of interest.
The Bounds struct inherits from SkRect to create
a SkScalar-based rectangle that intersects shared
edges.
This also includes common math equalities and
debugging that the remainder of path ops builds on,
as well as a temporary top-level interface in
include/pathops/SkPathOps.h.
Review URL: https://codereview.chromium.org/12827020
git-svn-id: http://skia.googlecode.com/svn/trunk@8551 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops/SkDQuadImplicit.h')
-rw-r--r-- | src/pathops/SkDQuadImplicit.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/pathops/SkDQuadImplicit.h b/src/pathops/SkDQuadImplicit.h new file mode 100644 index 0000000000..24f1aac2ef --- /dev/null +++ b/src/pathops/SkDQuadImplicit.h @@ -0,0 +1,39 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkDQuadImplicit_DEFINED +#define SkDQuadImplicit_DEFINED + +#include "SkPathOpsQuad.h" + +class SkDQuadImplicit { +public: + explicit SkDQuadImplicit(const SkDQuad& q); + + bool match(const SkDQuadImplicit& two) const; + static bool Match(const SkDQuad& quad1, const SkDQuad& quad2); + + double x2() const { return fP[kXx_Coeff]; } + double xy() const { return fP[kXy_Coeff]; } + double y2() const { return fP[kYy_Coeff]; } + double x() const { return fP[kX_Coeff]; } + double y() const { return fP[kY_Coeff]; } + double c() const { return fP[kC_Coeff]; } + +private: + enum Coeffs { + kXx_Coeff, + kXy_Coeff, + kYy_Coeff, + kX_Coeff, + kY_Coeff, + kC_Coeff, + }; + + double fP[kC_Coeff + 1]; +}; + +#endif |