392fa03a1b
Fits a cubic to an arc on the unit circle using the following constraints: 1) The endpoints and tangent directions at the endpoints must match the arc. 2) The cubic must be symmetric (length(p1 - p0) == length(p3 - p2)). 3) The height of the cubic must match the height of the arc. Using the above constraints, we arrive at the following formula for the control length (c) (i.e., lengths of (p1 - p0) and (p3 - p2)): d = x0*x1 + y0*y1 c = (sqrt(1 + d) * kM + kA) * rsqrt(1 - d) (Where x0,y0,x1,y1 are the endpoints, kM = -4/3, and kA = 4/3 * sqrt(2).) The sample also comes with a root finder that finds the max error value of the curve, which ends up serving as a semi-formal proof that: 1) Max error always occurs at T=0.21132486540519, regardless of endpoints. 2) Error is reduced by exactly 64x each time we halve the arc angle Change-Id: I29ad60dda06743d79f71275c38ffdd97261159ac Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295303 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Mike Reed <reed@google.com>
99 lines
3.5 KiB
Plaintext
99 lines
3.5 KiB
Plaintext
# Copyright 2016 Google Inc.
|
|
#
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# Things are easiest for everyone if these source paths are absolute.
|
|
_samplecode = get_path_info("../samplecode", "abspath")
|
|
|
|
samples_sources = [
|
|
"$_samplecode/PerlinPatch.cpp",
|
|
"$_samplecode/Sample.cpp",
|
|
"$_samplecode/Sample.h",
|
|
"$_samplecode/Sample2PtRadial.cpp",
|
|
"$_samplecode/Sample3D.cpp",
|
|
"$_samplecode/SampleAAClip.cpp",
|
|
"$_samplecode/SampleAAGeometry.cpp",
|
|
"$_samplecode/SampleAARectModes.cpp",
|
|
"$_samplecode/SampleAARects.cpp",
|
|
"$_samplecode/SampleAndroidShadows.cpp",
|
|
"$_samplecode/SampleAnimBlur.cpp",
|
|
"$_samplecode/SampleAnimatedImage.cpp",
|
|
"$_samplecode/SampleAnimatedText.cpp",
|
|
"$_samplecode/SampleArc.cpp",
|
|
"$_samplecode/SampleAtlas.cpp",
|
|
"$_samplecode/SampleBackdropBounds.cpp",
|
|
"$_samplecode/SampleBitmapRect.cpp",
|
|
"$_samplecode/SampleCamera.cpp",
|
|
"$_samplecode/SampleChart.cpp",
|
|
"$_samplecode/SampleChineseFling.cpp",
|
|
"$_samplecode/SampleCircle.cpp",
|
|
"$_samplecode/SampleClip.cpp",
|
|
"$_samplecode/SampleClipDrawMatch.cpp",
|
|
"$_samplecode/SampleClock.cpp",
|
|
"$_samplecode/SampleColorFilter.cpp",
|
|
"$_samplecode/SampleComplexClip.cpp",
|
|
"$_samplecode/SampleCowboy.cpp",
|
|
"$_samplecode/SampleCusp.cpp",
|
|
"$_samplecode/SampleDegenerateQuads.cpp",
|
|
"$_samplecode/SampleDegenerateTwoPtRadials.cpp",
|
|
"$_samplecode/SampleEffects.cpp",
|
|
"$_samplecode/SampleEmboss.cpp",
|
|
"$_samplecode/SampleFatBits.cpp",
|
|
"$_samplecode/SampleFillType.cpp",
|
|
"$_samplecode/SampleFilter2.cpp",
|
|
"$_samplecode/SampleFilterQuality.cpp",
|
|
"$_samplecode/SampleFitCubicToCircle.cpp",
|
|
"$_samplecode/SampleFlutterAnimate.cpp",
|
|
"$_samplecode/SampleGlyphTransform.cpp",
|
|
"$_samplecode/SampleGradients.cpp",
|
|
"$_samplecode/SampleHT.cpp",
|
|
"$_samplecode/SampleHairCurves.cpp",
|
|
"$_samplecode/SampleHairModes.cpp",
|
|
"$_samplecode/SampleHairline.cpp",
|
|
"$_samplecode/SampleIdentityScale.cpp",
|
|
"$_samplecode/SampleImageFilterDAG.cpp",
|
|
"$_samplecode/SampleLCD.cpp",
|
|
"$_samplecode/SampleLayerMask.cpp",
|
|
"$_samplecode/SampleLayers.cpp",
|
|
"$_samplecode/SampleManyRects.cpp",
|
|
"$_samplecode/SampleMegaStroke.cpp",
|
|
"$_samplecode/SampleMixer.cpp",
|
|
"$_samplecode/SamplePatch.cpp",
|
|
"$_samplecode/SamplePath.cpp",
|
|
"$_samplecode/SamplePathClip.cpp",
|
|
"$_samplecode/SamplePathEffects.cpp",
|
|
"$_samplecode/SamplePathOverstroke.cpp",
|
|
"$_samplecode/SamplePathText.cpp",
|
|
"$_samplecode/SamplePolyToPoly.cpp",
|
|
"$_samplecode/SampleQuadStroker.cpp",
|
|
"$_samplecode/SampleRectanizer.cpp",
|
|
"$_samplecode/SampleRegion.cpp",
|
|
"$_samplecode/SampleRepeatTile.cpp",
|
|
"$_samplecode/SampleSG.cpp",
|
|
"$_samplecode/SampleSVGFile.cpp",
|
|
"$_samplecode/SampleShaders.cpp",
|
|
"$_samplecode/SampleShadowColor.cpp",
|
|
"$_samplecode/SampleShadowReference.cpp",
|
|
"$_samplecode/SampleShadowUtils.cpp",
|
|
"$_samplecode/SampleShip.cpp",
|
|
"$_samplecode/SampleSlides.cpp",
|
|
"$_samplecode/SampleStringArt.cpp",
|
|
"$_samplecode/SampleStrokePath.cpp",
|
|
"$_samplecode/SampleStrokeRect.cpp",
|
|
"$_samplecode/SampleSubpixelTranslate.cpp",
|
|
"$_samplecode/SampleTessellatedWedge.cpp",
|
|
"$_samplecode/SampleTextBox.cpp",
|
|
"$_samplecode/SampleTextEffects.cpp",
|
|
"$_samplecode/SampleTextureUpload.cpp",
|
|
"$_samplecode/SampleThinAA.cpp",
|
|
"$_samplecode/SampleUnpremul.cpp",
|
|
"$_samplecode/SampleVertices.cpp",
|
|
"$_samplecode/SampleWritePixels.cpp",
|
|
"$_samplecode/SampleXfer.cpp",
|
|
"$_samplecode/SampleXfermodesBlur.cpp",
|
|
"$_samplecode/vertexdump.cpp",
|
|
]
|
|
|
|
samples_sources_ccpr = [ "$_samplecode/SampleCCPRGeometry.cpp" ]
|