Skip to content

Commit

Permalink
Removing segment_intersection from ABI.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Nov 27, 2017
1 parent 6645b01 commit 4060590
Show file tree
Hide file tree
Showing 6 changed files with 986 additions and 1,361 deletions.
3 changes: 0 additions & 3 deletions src/bezier/_curve_intersection.pxd
Expand Up @@ -22,9 +22,6 @@ cdef extern from "bezier/curve_intersection.h":
TANGENT = 1
DISJOINT = 2

void segment_intersection(
double *start0, double *end0, double *start1, double *end1,
double *s, double *t, bool_t *success)
void newton_refine_intersect(
double *s, int *num_nodes1, double *nodes1,
double *t, int *num_nodes2, double *nodes2,
Expand Down
2,306 changes: 981 additions & 1,325 deletions src/bezier/_curve_intersection_speedup.c

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions src/bezier/_curve_intersection_speedup.pyx
Expand Up @@ -39,27 +39,6 @@ TOO_SMALL_TEMPLATE = (
'for {:d} intersections but only had space for {:d}.')


def segment_intersection(
double[::1, :] start0, double[::1, :] end0,
double[::1, :] start1, double[::1, :] end1):
cdef double s, t
cdef bool_t success

bezier._curve_intersection.segment_intersection(
&start0[0, 0],
&end0[0, 0],
&start1[0, 0],
&end1[0, 0],
&s,
&t,
&success,
)
if success:
return s, t, True
else:
return None, None, False


def newton_refine(
double s, double[::1, :] nodes1, double t, double[::1, :] nodes2):
cdef int num_nodes1, num_nodes2
Expand Down
11 changes: 4 additions & 7 deletions src/bezier/_geometric_intersection.py
Expand Up @@ -261,7 +261,7 @@ def linearization_error(nodes):
return multiplier * np.linalg.norm(worst_case, ord=2)


def _segment_intersection(start0, end0, start1, end1):
def segment_intersection(start0, end0, start1, end1):
r"""Determine the intersection of two line segments.
Assumes each line is parametric
Expand Down Expand Up @@ -427,8 +427,7 @@ def _segment_intersection(start0, end0, start1, end1):
def _parallel_different(start0, end0, start1, end1):
r"""Checks if two parallel lines ever meet.
Meant as a back-up when
:func:`segment_intersection() <._segment_intersection>` fails.
Meant as a back-up when :func:`segment_intersection` fails.
.. note::
Expand All @@ -440,8 +439,8 @@ def _parallel_different(start0, end0, start1, end1):
they are parallel but on **different** lines, then there is a
**guarantee** of no intersection.
In :func:`segment_intersection() <._segment_intersection>`, we utilized
the normal form of the lines (via the cross product):
In :func:`segment_intersection`, we utilized the normal form of the
lines (via the cross product):
.. math::
Expand Down Expand Up @@ -1191,12 +1190,10 @@ def from_shape(cls, shape):
# pylint: disable=invalid-name
if _curve_intersection_speedup is None: # pragma: NO COVER
bbox_intersect = _bbox_intersect
segment_intersection = _segment_intersection
parallel_different = _parallel_different
all_intersections = _all_intersections
else:
bbox_intersect = _curve_intersection_speedup.bbox_intersect
segment_intersection = _curve_intersection_speedup.segment_intersection
parallel_different = _curve_intersection_speedup.parallel_different
all_intersections = _curve_intersection_speedup.all_intersections
atexit.register(
Expand Down
3 changes: 1 addition & 2 deletions src/bezier/curve_intersection.f90
Expand Up @@ -85,8 +85,7 @@ subroutine linearization_error( &
end subroutine linearization_error

subroutine segment_intersection( &
start0, end0, start1, end1, s, t, success) &
bind(c, name='segment_intersection')
start0, end0, start1, end1, s, t, success)

real(c_double), intent(in) :: start0(1, 2)
real(c_double), intent(in) :: end0(1, 2)
Expand Down
3 changes: 0 additions & 3 deletions src/bezier/include/bezier/curve_intersection.h
Expand Up @@ -25,9 +25,6 @@ enum BoxIntersectionType {
DISJOINT = 2,
};

void segment_intersection(
double *start0, double *end0, double *start1, double *end1,
double *s, double *t, bool *success);
void newton_refine_intersect(
double *s, int *num_nodes1, double *nodes1,
double *t, int *num_nodes2, double *nodes2,
Expand Down

0 comments on commit 4060590

Please sign in to comment.