<commit_before># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

"""Helper for B |eacute| zier Curves.

.. |eacute| unicode:: U+000E9 .. LATIN SMALL LETTER E WITH ACUTE
   :trim:

.. testsetup:: *

  import numpy as np
  import bezier

.. autofunction:: bezier._intersection_helpers.linearization_error
.. autofunction:: bezier._intersection_helpers.newton_refine
.. autofunction:: bezier._intersection_helpers.segment_intersection
"""


import itertools

import matplotlib.pyplot as plt
import numpy as np
import six

from bezier import _base
from bezier import _curve_helpers
from bezier import _intersection_helpers


_REPR_TEMPLATE = (
    '<{} (degree={:d}, dimension={:d}, start={:g}, end={:g})>')
_FREXP = np.frexp  # pylint: disable=no-member
_MAX_INTERSECT_SUBDIVISIONS = 20
_ERROR_EXPONENT = -26
_LINEAR_SUBDIVIDE = np.array([
    [1.0, 0.0],
    [0.5, 0.5],
    [0.0, 1.0],
])
_QUADRATIC_SUBDIVIDE = np.array([
    [1.0, 0.0, 0.0],
    [0.5, 0.5, 0.0],
    [0.25, 0.5, 0.25],
    [0.0, 0.5, 0.5],
    [0.0, 0.0, 1.0],
])
_CUBIC_SUBDIVIDE = np.array([
    [1.0, 0.0, 0.0, 0.0],
    [0.5, 0.5, 0.0, 0.0],
    [0.25, 0.5, 0.25, 0.0],
    [0.125, 0.375, 0.375, 0.125],
    [0.0, 0.25, 0.5, 0.25],<commit_msg>Requiring higher accuracy for curve intersection.<commit_after># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

"""Helper for B |eacute| zier Curves.

.. |eacute| unicode:: U+000E9 .. LATIN SMALL LETTER E WITH ACUTE
   :trim:

.. testsetup:: *

  import numpy as np
  import bezier

.. autofunction:: bezier._intersection_helpers.linearization_error
.. autofunction:: bezier._intersection_helpers.newton_refine
.. autofunction:: bezier._intersection_helpers.segment_intersection
"""


import itertools

import matplotlib.pyplot as plt
import numpy as np
import six

from bezier import _base
from bezier import _curve_helpers
from bezier import _intersection_helpers


_REPR_TEMPLATE = (
    '<{} (degree={:d}, dimension={:d}, start={:g}, end={:g})>')
_FREXP = np.frexp  # pylint: disable=no-member
_MAX_INTERSECT_SUBDIVISIONS = 25
_ERROR_EXPONENT = -40  # 2.0**(-40) ~= 1e-12
_LINEAR_SUBDIVIDE = np.array([
    [1.0, 0.0],
    [0.5, 0.5],
    [0.0, 1.0],
])
_QUADRATIC_SUBDIVIDE = np.array([
    [1.0, 0.0, 0.0],
    [0.5, 0.5, 0.0],
    [0.25, 0.5, 0.25],
    [0.0, 0.5, 0.5],
    [0.0, 0.0, 1.0],
])
_CUBIC_SUBDIVIDE = np.array([
    [1.0, 0.0, 0.0, 0.0],
    [0.5, 0.5, 0.0, 0.0],
    [0.25, 0.5, 0.25, 0.0],
    [0.125, 0.375, 0.375, 0.125],
    [0.0, 0.25, 0.5, 0.25],
{'fraction_non_alphanumeric': 0.1440068985340615, 'fraction_numerical': 0.06409887898821501, 'mean_word_length': 3.501940491591203, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1724362', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1321, 'n_words': 390}