Skip to content

Commit

Permalink
Improved documentation for `regridding.geometry.two_line_segment_inte…
Browse files Browse the repository at this point in the history
…rsection_parameters()`.
  • Loading branch information
byrdie committed Dec 2, 2023
1 parent 69e21f8 commit 4cfe3c6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion regridding/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,27 @@ def two_line_segment_intersection_parameters(
Computes the parameters
(:math:`\text{sdet}`, :math:`\text{tdet}`, and :math:`\text{det}`)
associated with the intersection of two 2D line segments,
:math:`p` and :math:`q`, as described in :footcite:t:`GraphicsGemsIII`.
:math:`p` and :math:`q`.
This function uses the method described in :footcite:t:`GraphicsGemsIII`.
:math:`\text{sdet}`, :math:`\text{tdet}`, and :math:`\text{det}` are expected
to be used to compute the quantities
.. math::
s &= \text{sdet} / \text{det}
t &= \text{tdet} / \text{det},
which can be used to compute the intersection :math:`(x, y)` using the
parametric equations of the lines:
.. math::
x = (1 - s) * x_{\text{q1}} + s * x_{\text{q2}} = (1 - t) * x_{\text{p1}} + t * x_{\text{p2}}
y = (1 - s) * y_{\text{q1}} + s * y_{\text{q2}} = (1 - t) * y_{\text{p1}} + t * y_{\text{p2}}.
The quantities :math:`s` and :math:`t` are not computed directly
because doing so leads to a loss of precision.
Parameters
----------
Expand Down

0 comments on commit 4cfe3c6

Please sign in to comment.