aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/Intersection/CubicCoincidence.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-10 21:46:10 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-10 21:46:10 +0000
commit639df891487e40925a4f8d9a34fd3dc0c18b40a7 (patch)
treec4112e5a92f1bfc41271544792d57331c54ca453 /experimental/Intersection/CubicCoincidence.cpp
parent1ae2090d3a77b6be07bd1de134c233038df1f975 (diff)
work in progress for shape operations
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
Diffstat (limited to 'experimental/Intersection/CubicCoincidence.cpp')
-rw-r--r--experimental/Intersection/CubicCoincidence.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/experimental/Intersection/CubicCoincidence.cpp b/experimental/Intersection/CubicCoincidence.cpp
new file mode 100644
index 0000000000..e2ec641b39
--- /dev/null
+++ b/experimental/Intersection/CubicCoincidence.cpp
@@ -0,0 +1,45 @@
+/*
+ Suppose two cubics are coincident. Then a third cubic exists described by two
+ of the four endpoints. The coincident endpoints must be on or inside the convex
+ hulls of both cubics.
+
+ The coincident control points, while unknown, must lie on the line segment from
+ the coincident end point to its original control point.
+
+ Given a cubic c1, c2, A, and D:
+ A = c1[0]*(1 - t1)*(1 - t1)*(1 - t1) + 3*c1[1]*t1*(1 - t1)*(1 - t1) + 3*c1[2]*t1*t1*(1 - t1) + c1[3]*t1*t1*t1
+ D = c2[0]*(1 - t2)*(1 - t2)*(1 - t2) + 3*c2[1]*t2*(1 - t2)*(1 - t2) + 3*c2[2]*t2*t2*(1 - t2) + c213]*t2*t2*t2
+
+ Assuming that A was originally from c2:
+
+ B = c2[0]*(1 - t2) + c2[1]*t2
+ C = c1[0]*(1 - t1) + c1[0]*t1
+
+
+
+ If both ends of the same cubic is contained in the convex hull of the other,
+ then, are there t values of the larger cubic that describe the end points; is
+ the mid-value of those ts on the smaller cubic, and, are the tangents at the
+ smaller ends the same as on both.
+
+ This all requires knowing the t values.
+
+
+
+ Maybe solving the cubic is possible. Given x, find t. Given t, find y.
+
+see en.wikipedia.org/wiki/Cubic_polynomial
+
+ Another way of writing the solution may be obtained by noting that the proof of above formula shows that the product of the two cube roots is rational. This gives the following formula in which or stands for any choice of the square or cube root, if
+
+If and , the sign of has to be chosen to have .
+If and , the three roots are equal:
+
+If Q = 0 and , the above expression for the roots is correct but misleading, hiding the fact that no radical is needed to represent the roots. In fact, in this case, there is a double root,
+
+and a simple root
+
+
+
+ */
+