639df89148
A experimental/Intersection A experimental/Intersection/Intersections.h A experimental/Intersection/DataTypes.cpp A experimental/Intersection/QuadraticReduceOrder.cpp A experimental/Intersection/IntersectionUtilities.cpp A experimental/Intersection/CubicIntersection_Tests.h A experimental/Intersection/LineParameteters_Test.cpp A experimental/Intersection/ReduceOrder.cpp A experimental/Intersection/QuadraticIntersection.cpp A experimental/Intersection/Extrema.h A experimental/Intersection/CubicIntersection_TestData.h A experimental/Intersection/QuadraticParameterization_Test.cpp A experimental/Intersection/TestUtilities.cpp A experimental/Intersection/CubicRoots.cpp A experimental/Intersection/QuadraticParameterization.cpp A experimental/Intersection/QuadraticSubDivide.cpp A experimental/Intersection/LineIntersection_Test.cpp A experimental/Intersection/LineIntersection.cpp A experimental/Intersection/CubicParameterizationCode.cpp A experimental/Intersection/LineParameters.h A experimental/Intersection/CubicIntersection.h A experimental/Intersection/CubeRoot.cpp A experimental/Intersection/SkAntiEdge.h A experimental/Intersection/ConvexHull_Test.cpp A experimental/Intersection/CubicBezierClip_Test.cpp A experimental/Intersection/CubicIntersection_Tests.cpp A experimental/Intersection/CubicBezierClip.cpp A experimental/Intersection/CubicIntersectionT.cpp A experimental/Intersection/Inline_Tests.cpp A experimental/Intersection/ReduceOrder_Test.cpp A experimental/Intersection/QuadraticIntersection_TestData.h A experimental/Intersection/DataTypes.h A experimental/Intersection/Extrema.cpp A experimental/Intersection/EdgeApp.cpp A experimental/Intersection/CubicIntersection_TestData.cpp A experimental/Intersection/IntersectionUtilities.h A experimental/Intersection/CubicReduceOrder.cpp A experimental/Intersection/CubicCoincidence.cpp A experimental/Intersection/CubicIntersection_Test.cpp A experimental/Intersection/CubicIntersection.cpp A experimental/Intersection/QuadraticUtilities.h A experimental/Intersection/SkAntiEdge.cpp A experimental/Intersection/TestUtilities.h A experimental/Intersection/CubicParameterization_Test.cpp A experimental/Intersection/LineIntersection.h A experimental/Intersection/CubicSubDivide.cpp A experimental/Intersection/CubicParameterization.cpp A experimental/Intersection/QuadraticBezierClip_Test.cpp A experimental/Intersection/QuadraticBezierClip.cpp A experimental/Intersection/BezierClip_Test.cpp A experimental/Intersection/ConvexHull.cpp A experimental/Intersection/BezierClip.cpp A experimental/Intersection/QuadraticIntersection_TestData.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@3005 2bbb7eff-a529-9590-31e7-b0007b416f81
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#include "CubicIntersection.h"
|
|
#include "CubicIntersection_Tests.h"
|
|
#include "TestUtilities.h"
|
|
|
|
const Quadratic quadratics[] = {
|
|
{{0, 0}, {1, 0}, {1, 1}},
|
|
};
|
|
|
|
const size_t quadratics_count = sizeof(quadratics) / sizeof(quadratics[0]);
|
|
|
|
int firstCubicCoincidenceTest = 0;
|
|
|
|
void CubicCoincidence_Test() {
|
|
// split large quadratic
|
|
// upscale quadratics to cubics
|
|
// compare original, parts, to see if the are coincident
|
|
for (size_t index = firstCubicCoincidenceTest; index < quadratics_count; ++index) {
|
|
const Quadratic& test = quadratics[index];
|
|
QuadraticPair split;
|
|
chop_at(test, split, 0.5);
|
|
Quadratic midThird;
|
|
sub_divide(test, 1.0/3, 2.0/3, midThird);
|
|
Cubic whole, first, second, mid;
|
|
quad_to_cubic(test, whole);
|
|
quad_to_cubic(split.first(), first);
|
|
quad_to_cubic(split.second(), second);
|
|
quad_to_cubic(midThird, mid);
|
|
if (!implicit_matches(whole, first)) {
|
|
printf("%s-1 %d\n", __FUNCTION__, (int)index);
|
|
}
|
|
if (!implicit_matches(whole, second)) {
|
|
printf("%s-2 %d\n", __FUNCTION__, (int)index);
|
|
}
|
|
if (!implicit_matches(mid, first)) {
|
|
printf("%s-3 %d\n", __FUNCTION__, (int)index);
|
|
}
|
|
if (!implicit_matches(mid, second)) {
|
|
printf("%s-4 %d\n", __FUNCTION__, (int)index);
|
|
}
|
|
if (!implicit_matches(first, second)) {
|
|
printf("%s-5 %d\n", __FUNCTION__, (int)index);
|
|
}
|
|
}
|
|
}
|