caryclark@google.com | 9e49fb6 | 2012-08-27 14:11:33 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2012 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 | */ |
caryclark@google.com | c682590 | 2012-02-03 22:07:47 +0000 | [diff] [blame] | 7 | #include "CurveIntersection.h" |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 8 | #include "CubicIntersection_TestData.h" |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame] | 9 | #include "Intersection_Tests.h" |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 10 | |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame] | 11 | void CubicBezierClip_Test() { |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 12 | for (size_t index = 0; index < tests_count; ++index) { |
| 13 | const Cubic& cubic1 = tests[index][0]; |
| 14 | const Cubic& cubic2 = tests[index][1]; |
| 15 | Cubic reduce1, reduce2; |
| 16 | int order1 = reduceOrder(cubic1, reduce1, kReduceOrder_NoQuadraticsAllowed); |
| 17 | int order2 = reduceOrder(cubic2, reduce2, kReduceOrder_NoQuadraticsAllowed); |
| 18 | if (order1 < 4) { |
| 19 | printf("%s [%d] cubic1 order=%d\n", __FUNCTION__, (int) index, order1); |
| 20 | } |
| 21 | if (order2 < 4) { |
| 22 | printf("%s [%d] cubic2 order=%d\n", __FUNCTION__, (int) index, order2); |
| 23 | } |
| 24 | if (order1 == 4 && order2 == 4) { |
| 25 | double minT = 0; |
| 26 | double maxT = 1; |
| 27 | bezier_clip(reduce1, reduce2, minT, maxT); |
| 28 | } |
| 29 | } |
| 30 | } |