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
2013-04-08 11:47:37 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/pathops/SkPathOpsCubic.h"
|
|
|
|
#include "tests/PathOpsTestCommon.h"
|
|
|
|
#include "tests/Test.h"
|
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
2013-04-08 11:47:37 +00:00
|
|
|
|
2016-10-20 15:32:18 +00:00
|
|
|
static const CubicPts hullTests[] = {
|
2015-04-20 15:31:59 +00:00
|
|
|
{{{2.6250000819563866, 2.3750000223517418}, {2.833333432674408, 2.3333333432674408}, {3.1111112236976624, 2.3333333134651184}, {3.4074075222015381, 2.3333332538604736}}},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const size_t hullTests_count = SK_ARRAY_COUNT(hullTests);
|
|
|
|
|
|
|
|
DEF_TEST(PathOpsCubicHull, reporter) {
|
|
|
|
for (size_t index = 0; index < hullTests_count; ++index) {
|
2016-10-20 15:32:18 +00:00
|
|
|
const CubicPts& c = hullTests[index];
|
|
|
|
SkDCubic cubic;
|
|
|
|
cubic.debugSet(c.fPts);
|
2015-04-20 15:31:59 +00:00
|
|
|
char order[4];
|
|
|
|
cubic.convexHull(order);
|
|
|
|
}
|
|
|
|
}
|