Skip to content

Commit

Permalink
Moving "algorithms" docs into /algorithms path
Browse files Browse the repository at this point in the history
As a result, had to update the image paths in many non-public
Python docstrings.

Also had to update any reference (in docs or tooling) to the moved
documents.
  • Loading branch information
dhermes committed Oct 24, 2018
1 parent a4ba77b commit 6e9c825
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 56 deletions.
2 changes: 1 addition & 1 deletion DEVELOPMENT.rst
Expand Up @@ -269,7 +269,7 @@ functional test case:
and there is a `Curve-Curve Intersection`_ document which captures many of
the cases in the functional tests.

.. _Curve-Curve Intersection: https://bezier.readthedocs.io/en/latest/curve-curve-intersection.html
.. _Curve-Curve Intersection: https://bezier.readthedocs.io/en/latest/algorithms/curve-curve-intersection.html

A surface-surface intersection functional test case:

Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT.rst.template
Expand Up @@ -269,7 +269,7 @@ functional test case:
and there is a `Curve-Curve Intersection`_ document which captures many of
the cases in the functional tests.

.. _Curve-Curve Intersection: https://bezier.readthedocs.io/en/{rtd_version}/curve-curve-intersection.html
.. _Curve-Curve Intersection: https://bezier.readthedocs.io/en/{rtd_version}/algorithms/curve-curve-intersection.html

A surface-surface intersection functional test case:

Expand Down
Expand Up @@ -44,7 +44,7 @@ Curve-Line Intersection
array([[0.25 , 0.75 ],
[0.375, 0.375]])

.. image:: images/curves1_and_8.png
.. image:: ../images/curves1_and_8.png
:align: center

.. doctest:: intersect-1-9
Expand All @@ -69,7 +69,7 @@ Curve-Line Intersection
array([[0.5],
[0.5]])

.. image:: images/curves1_and_9.png
.. image:: ../images/curves1_and_9.png
:align: center

.. doctest:: intersect-10-11
Expand All @@ -94,7 +94,7 @@ Curve-Line Intersection
array([[3.],
[4.]])

.. image:: images/curves10_and_11.png
.. image:: ../images/curves10_and_11.png
:align: center

.. doctest:: intersect-8-9
Expand All @@ -119,7 +119,7 @@ Curve-Line Intersection
array([[0.5 ],
[0.375]])

.. image:: images/curves8_and_9.png
.. image:: ../images/curves8_and_9.png
:align: center

.. doctest:: intersect-29-30
Expand All @@ -144,7 +144,7 @@ Curve-Line Intersection
array([[0.],
[1.]])

.. image:: images/curves29_and_30.png
.. image:: ../images/curves29_and_30.png
:align: center

Curved Intersections
Expand Down Expand Up @@ -176,7 +176,7 @@ with zero error:
array([[0.25 , 0.75 ],
[0.375, 0.375]])

.. image:: images/curves1_and_5.png
.. image:: ../images/curves1_and_5.png
:align: center

.. doctest:: intersect-3-4
Expand All @@ -201,7 +201,7 @@ with zero error:
array([[0.75 , 2.625 ],
[1.125 , 0.65625]])

.. image:: images/curves3_and_4.png
.. image:: ../images/curves3_and_4.png
:align: center

.. doctest:: intersect-14-16
Expand All @@ -226,7 +226,7 @@ with zero error:
array([[0.375 , 0.625 ],
[0.46875, 0.46875]])

.. image:: images/curves14_and_16.png
.. image:: ../images/curves14_and_16.png
:align: center

Even for curves which don't intersect at exact floating point
Expand Down Expand Up @@ -264,7 +264,7 @@ numbers, we can compute the intersection to machine precision:
>>> binary_exponent(max_err)
-54

.. image:: images/curves1_and_2.png
.. image:: ../images/curves1_and_2.png
:align: center

.. doctest:: intersect-1-7
Expand Down Expand Up @@ -299,7 +299,7 @@ numbers, we can compute the intersection to machine precision:
>>> binary_exponent(max_err)
-54

.. image:: images/curves1_and_7.png
.. image:: ../images/curves1_and_7.png
:align: center

.. doctest:: intersect-1-13
Expand Down Expand Up @@ -334,7 +334,7 @@ numbers, we can compute the intersection to machine precision:
>>> binary_exponent(max_err) <= -53
True

.. image:: images/curves1_and_13.png
.. image:: ../images/curves1_and_13.png
:align: center

.. doctest:: intersect-21-22
Expand Down Expand Up @@ -369,7 +369,7 @@ numbers, we can compute the intersection to machine precision:
>>> binary_exponent(max_err)
-53

.. image:: images/curves21_and_22.png
.. image:: ../images/curves21_and_22.png
:align: center

For higher degree intersections, the error starts to get a little
Expand Down Expand Up @@ -412,7 +412,7 @@ larger.
>>> binary_exponent(max_err) <= -50
True

.. image:: images/curves15_and_25.png
.. image:: ../images/curves15_and_25.png
:align: center

.. doctest:: intersect-11-26
Expand Down Expand Up @@ -447,7 +447,7 @@ larger.
>>> binary_exponent(max_err)
-50

.. image:: images/curves11_and_26.png
.. image:: ../images/curves11_and_26.png
:align: center

.. doctest:: intersect-8-27
Expand Down Expand Up @@ -484,7 +484,7 @@ larger.
>>> binary_exponent(max_err) <= -51
True

.. image:: images/curves8_and_27.png
.. image:: ../images/curves8_and_27.png
:align: center

Intersections at Endpoints
Expand Down Expand Up @@ -512,7 +512,7 @@ Intersections at Endpoints
array([[1.],
[0.]])

.. image:: images/curves1_and_18.png
.. image:: ../images/curves1_and_18.png
:align: center

.. doctest:: intersect-1-19
Expand All @@ -537,7 +537,7 @@ Intersections at Endpoints
array([[1.],
[0.]])

.. image:: images/curves1_and_19.png
.. image:: ../images/curves1_and_19.png
:align: center

.. doctest:: intersect-10-17
Expand All @@ -562,7 +562,7 @@ Intersections at Endpoints
array([[3.],
[4.]])

.. image:: images/curves10_and_17.png
.. image:: ../images/curves10_and_17.png
:align: center

Detecting Self-Intersections
Expand Down Expand Up @@ -591,7 +591,7 @@ Detecting Self-Intersections
array([[-0.09375 , -0.25 ],
[ 0.828125, 1.375 ]])

.. image:: images/curves42_and_43.png
.. image:: ../images/curves42_and_43.png
:align: center

Limitations
Expand Down Expand Up @@ -639,13 +639,13 @@ successfully terminates
array([[0.5],
[0.5]])

.. image:: images/curves1_and_6.png
.. image:: ../images/curves1_and_6.png
:align: center

This library makes an earnest effort to compute tangent intersections.
For example, when the curves

.. image:: images/curves14_and_15.png
.. image:: ../images/curves14_and_15.png
:align: center

have been subdivided and approximated by lines, the corresponding
Expand Down Expand Up @@ -704,14 +704,14 @@ number and the other is not:
array([[4.5],
[4.5]])

.. image:: images/curves10_and_23.png
.. image:: ../images/curves10_and_23.png
:align: center

In addition to points of tangency, **coincident curve segments**
are partially supported (but are in general hard to detect). For the
curves

.. image:: images/curves1_and_24.png
.. image:: ../images/curves1_and_24.png
:align: center

the library determines the "intersection" points as the beginning
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions docs/algorithms/index.rst
@@ -0,0 +1,9 @@
##########
Algorithms
##########

.. toctree::
:titlesonly:

curve-curve-intersection
helpers
3 changes: 1 addition & 2 deletions docs/index.rst
Expand Up @@ -18,8 +18,7 @@

python/index
abi/index
curve-curve-intersection
algorithm-helpers
algorithms/index
development
releases/index

Expand Down
3 changes: 1 addition & 2 deletions docs/index.rst.release.template
Expand Up @@ -16,8 +16,7 @@

python/index
abi/index
curve-curve-intersection
algorithm-helpers
algorithms/index
development
releases/index

Expand Down
3 changes: 1 addition & 2 deletions scripts/check_doc_templates.py
Expand Up @@ -109,8 +109,7 @@
python/index
abi/index
curve-curve-intersection
algorithm-helpers
algorithms/index
development
releases/index
Expand Down
7 changes: 4 additions & 3 deletions src/bezier/_curve_helpers.py
Expand Up @@ -9,6 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Private helper methods for B |eacute| zier curves.
As a convention, the functions defined here with a leading underscore
Expand Down Expand Up @@ -498,7 +499,7 @@ def _get_curvature(nodes, tangent_vec, s):
\frac{B'(s) \times B''(s)}{\left\lVert B'(s) \right\rVert_2^3}
.. image:: images/get_curvature.png
.. image:: ../images/get_curvature.png
:align: center
.. testsetup:: get-curvature
Expand Down Expand Up @@ -604,7 +605,7 @@ def _newton_refine(nodes, point, s):
\Longrightarrow \Delta s &= -\frac{2}{5}
\end{align*}
.. image:: images/newton_refine_curve.png
.. image:: ../images/newton_refine_curve.png
:align: center
.. testsetup:: newton-refine-curve, newton-refine-curve-cusp
Expand Down Expand Up @@ -639,7 +640,7 @@ def _newton_refine(nodes, point, s):
injective with non-zero gradient), Newton's method may
break down and converge linearly:
.. image:: images/newton_refine_curve_cusp.png
.. image:: ../images/newton_refine_curve_cusp.png
:align: center
.. doctest:: newton-refine-curve-cusp
Expand Down
15 changes: 8 additions & 7 deletions src/bezier/_geometric_intersection.py
Expand Up @@ -9,6 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Helpers for intersecting B |eacute| zier curves via geometric methods.
As a convention, the functions defined here with a leading underscore
Expand Down Expand Up @@ -163,7 +164,7 @@ def linearization_error(nodes):
\left.\frac{s(1 - s)}{2!} \cdot 10\right|_{s = \frac{1}{2}}
= \frac{5}{4}.
.. image:: images/linearization_error.png
.. image:: ../images/linearization_error.png
:align: center
.. testsetup:: linearization-error, linearization-error-fail
Expand Down Expand Up @@ -307,7 +308,7 @@ def segment_intersection(start0, end0, start1, end1):
L_1\left(\frac{3}{4}\right) =
\frac{1}{2} \left[\begin{array}{c} 1 \\ 1 \end{array}\right]`.
.. image:: images/segment_intersection1.png
.. image:: ../images/segment_intersection1.png
:align: center
.. testsetup:: segment-intersection1, segment-intersection2
Expand Down Expand Up @@ -347,7 +348,7 @@ def segment_intersection(start0, end0, start1, end1):
we should be able to determine that the lines don't intersect, but
this function is not meant for that check:
.. image:: images/segment_intersection2.png
.. image:: ../images/segment_intersection2.png
:align: center
.. doctest:: segment-intersection2
Expand Down Expand Up @@ -454,7 +455,7 @@ def parallel_lines_parameters(start0, end0, start1, end1):
If it is not on the first line, then we are done, the
segments don't meet:
.. image:: images/parallel_lines_parameters1.png
.. image:: ../images/parallel_lines_parameters1.png
:align: center
.. testsetup:: parallel-different1, parallel-different2
Expand Down Expand Up @@ -496,7 +497,7 @@ def parallel_lines_parameters(start0, end0, start1, end1):
:math:`E_1 = S_0 + 2 \Delta_0`) correspond to segments that
don't meet:
.. image:: images/parallel_lines_parameters2.png
.. image:: ../images/parallel_lines_parameters2.png
:align: center
.. doctest:: parallel-different2
Expand All @@ -519,7 +520,7 @@ def parallel_lines_parameters(start0, end0, start1, end1):
but if the intervals overlap, like :math:`\left[0, 1\right]` and
:math:`\left[-1, \frac{1}{2}\right]`, the segments meet:
.. image:: images/parallel_lines_parameters3.png
.. image:: ../images/parallel_lines_parameters3.png
:align: center
.. testsetup:: parallel-different3, parallel-different4
Expand Down Expand Up @@ -552,7 +553,7 @@ def parallel_lines_parameters(start0, end0, start1, end1):
Similarly, if the second interval completely contains the first,
the segments meet:
.. image:: images/parallel_lines_parameters4.png
.. image:: ../images/parallel_lines_parameters4.png
:align: center
.. doctest:: parallel-different4
Expand Down

0 comments on commit 6e9c825

Please sign in to comment.