� ��g�P��,�dZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z mZmZdd lmZdd lmZdd lmZmZdd lmZdd lmZddlmZddlmZddlm Z ddl!mZddl"m#Z#ddl$m%Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+dd�d�Z,d�Z-d"d�Z.dd�d �Z/d!S)#z�Utility functions for geometrical entities. Contains ======== intersection convex_hull closest_points farthest_points are_coplanar are_similar �)�deque)�sqrt)� nsimplify�)�GeometryEntity)� GeometryError)�Point�Point2D�Point3D)� OrderedSet)� factor_terms)�Function� expand_mul)�Float)�ordered)�Symbol)�S)�cancel)� is_sequence)� prec_to_dpsc���|j}�fd�|D��}|std�z���t|��dkrtd�z���|dS)a� Checks whether a Symbol matching ``x`` is present in ``equation`` or not. If present, the matching symbol is returned, else a ValueError is raised. If ``x`` is a string the matching symbol will have the same name; if ``x`` is a Symbol then it will be returned if found. Examples ======== >>> from sympy.geometry.util import find >>> from sympy import Dummy >>> from sympy.abc import x >>> find('x', x) x >>> find('x', Dummy('x')) _x The dummy symbol is returned since it has a matching name: >>> _.name == 'x' True >>> find(x, Dummy('x')) Traceback (most recent call last): ... ValueError: could not find x c�X��g|]&}t�t��r|jn|�k�$|��'S�)� isinstance�str�name)�.0�i�xs ��c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/geometry/util.py� <listcomp>zfind.<locals>.<listcomp>As8��� H� H� H�� �1�c�(:�(:�A�a�f�f��a�G�G�!�G�G�G�zcould not find %srz ambiguous %sr)� free_symbols� ValueError�len)r�equation�free�xss` r �findr)#sm���: � �D� H� H� H� H�T� H� H� H�B� �2��,�q�0�1�1�1� �2�w�w�!�|�|���!�+�,�,�,� �a�5�Lr"c�@�tt|d������S)z?Return the tuple of points sorted numerically according to argsc��|jS�N��args�rs r �<lambda>z!_ordered_points.<locals>.<lambda>Ks����r"��key)�tuple�sorted)�ps r �_ordered_pointsr6Is!�� ���/�/�0�0�0� 1� 1�1r"c����ddlm}ddlm}t |��}t |��D]D�t �|��r2|����t�fd�|D����cS�Etd�|D����r�t|��dkrdS|� ��|� ��}}t |��D]-�tj ||���r|�����.|sdS||||� ����}|D] ��|vrdS� dSg}|D]��t �t��r|� ����-t �|��r|��j���Xt �t ��rC�jD];}t |t"��r$|� t|jd z����<��t%|�S) a  Returns True if the given entities are coplanar otherwise False Parameters ========== e: entities to be checked for being coplanar Returns ======= Boolean Examples ======== >>> from sympy import Point3D, Line3D >>> from sympy.geometry.util import are_coplanar >>> a = Line3D(Point3D(5, 0, 0), Point3D(1, -1, 1)) >>> b = Line3D(Point3D(0, -2, 0), Point3D(3, 1, 1)) >>> c = Line3D(Point3D(0, -1, 0), Point3D(5, -1, 9)) >>> are_coplanar(a, b, c) False r)�LinearEntity3D)�Planec3�B�K�|]}|����V��dSr,)� is_coplanar)rr5rs �r � <genexpr>zare_coplanar.<locals>.<genexpr>ps/�����3�3�A�q�}�}�Q�'�'�3�3�3�3�3�3r"c3�@K�|]}t|t��V��dSr,)rr �rrs r r<zare_coplanar.<locals>.<genexpr>rs,���� -� -�a�:�a�� !� !� -� -� -� -� -� -r"�FT)r)�liner8�planer9�set�listr�remove�allr%�popr � are_collinear�append�extendr.rr � are_coplanar)�er8r9�a�br5�pt3drs @r rJrJNs8���2%�$�$�$�$�$������� �A���A� �!�W�W�4�4�� �a�� � � 4� �H�H�Q�K�K�K��3�3�3�3��3�3�3�3�3� 3� 3� 3� 4� � -� -�1� -� -� -�-�-�#� �q�6�6�A�:�:��5��u�u�w�w������1���a��� � �A��$�Q��1�-�-� ����� � � ��� ��5���a��A�E�E�G�G�$�$�A�� !� !���A�:�:� �5�5���4���� ?� ?�A��!�W�%�%� ?�� � �A������A�~�.�.� ?�� � �A�F�#�#�#�#��A�~�.�.� ?���?�?�A�!�!�U�+�+�?�� � �G�a�f�t�m�$=�>�>�>����T�"�"r"c���||krdSt|dd��}|r ||��St|dd��}|r ||��S|jj}|jj}td|�d|�����)a�Are two geometrical entities similar. Can one geometrical entity be uniformly scaled to the other? Parameters ========== e1 : GeometryEntity e2 : GeometryEntity Returns ======= are_similar : boolean Raises ====== GeometryError When `e1` and `e2` cannot be compared. Notes ===== If the two objects are equal then they are similar. See Also ======== sympy.geometry.entity.GeometryEntity.is_similar Examples ======== >>> from sympy import Point, Circle, Triangle, are_similar >>> c1, c2 = Circle(Point(0, 0), 4), Circle(Point(1, 4), 3) >>> t1 = Triangle(Point(0, 0), Point(1, 0), Point(0, 1)) >>> t2 = Triangle(Point(0, 0), Point(2, 0), Point(0, 2)) >>> t3 = Triangle(Point(0, 0), Point(3, 0), Point(0, 1)) >>> are_similar(t1, t2) True >>> are_similar(t1, t3) False T� is_similarNzCannot test similarity between z and )�getattr� __class__�__name__r)�e1�e2� is_similar1� is_similar2�n1�n2s r � are_similarrZ�s���\ �R�x�x��t��"�l�D�1�1�K����{�2�����"�l�D�1�1�K����{�2���� �� �B� �� �B� �-�68�b�b�"�"�=� ?� ?�?r"c��� �ddlm� ddlm�|r�t d�|D����r*t dd��}|D]}||z }�t |��}n�t � fd�|D����r3t dd��}d}|D]}|j}||j|zz }||z }�|}nMt �fd�|D����r2t dd��}d}|D]}|j }||j |zz }||z }�|}||z}|j d�|j D���Sd S) a�Find the centroid (center of mass) of the collection containing only Points, Segments or Polygons. The centroid is the weighted average of the individual centroid where the weights are the lengths (of segments) or areas (of polygons). Overlapping regions will add to the weight of that region. If there are no objects (or a mixture of objects) then None is returned. See Also ======== sympy.geometry.point.Point, sympy.geometry.line.Segment, sympy.geometry.polygon.Polygon Examples ======== >>> from sympy import Point, Segment, Polygon >>> from sympy.geometry.util import centroid >>> p = Polygon((0, 0), (10, 0), (10, 10)) >>> q = p.translate(0, 20) >>> p.centroid, q.centroid (Point2D(20/3, 10/3), Point2D(20/3, 70/3)) >>> centroid(p, q) Point2D(20/3, 40/3) >>> p, q = Segment((0, 0), (2, 0)), Segment((0, 0), (2, 2)) >>> centroid(p, q) Point2D(1, 2 - sqrt(2)) >>> centroid(Point(0, 0), Point(2, 0)) Point2D(1, 0) Stacking 3 polygons on top of each other effectively triples the weight of that polygon: >>> p = Polygon((0, 0), (1, 0), (1, 1), (0, 1)) >>> q = Polygon((1, 0), (3, 0), (3, 1), (1, 1)) >>> centroid(p, q) Point2D(3/2, 1/2) >>> centroid(p, p, p, q) # centroid x-coord shifts left Point2D(11/10, 1/2) Stacking the squares vertically above and below p has the same effect: >>> centroid(p, p.translate(0, 1), p.translate(0, -1), q) Point2D(11/10, 1/2) r��Segment��Polygonc3�@K�|]}t|t��V��dSr,)rr )r�gs r r<zcentroid.<locals>.<genexpr>s,����2�2��z�!�U�#�#�2�2�2�2�2�2r"rc3�8�K�|]}t|���V��dSr,�r)rrar]s �r r<zcentroid.<locals>.<genexpr>�-�����6�6�A��A�w�'�'�6�6�6�6�6�6r"c3�8�K�|]}t|���V��dSr,rc)rrar_s �r r<zcentroid.<locals>.<genexpr>rdr"c�6�g|]}|�����Sr)�simplifyr>s r r!zcentroid.<locals>.<listcomp>s ��5�5�5��� � � � �5�5�5r"N) r@r]�polygonr_rEr r%�length�midpoint�area�centroid�funcr.) r.�cra�den�L�l�ArLr_r]s @@r rlrl�s�����`������ � � � � � � �7� �2�2�T�2�2�2� 2� 2� ��a�� � �A�� � ���Q�����d�)�)�C�C� �6�6�6�6��6�6�6� 6� 6� ��a�� � �A��A�� � ���H���Q�Z��\�!���Q�����C�C� �6�6�6�6��6�6�6� 6� 6� ��a�� � �A��A�� � ���F���Q�Z��\�!���Q�����C� �S����q�v�5�5�a�f�5�5�5�6�6�/7�7r"c�&� �d�t|��D��� t� ��dkrtd��� � �d����n#t$rtd���wxYwt d�� D����sd�}nd d lm}d g}|� d j� d jz � d j � d j z ��}d}d }td d g��}|t� ��k�r||kra� |d � |d z |kr@|� ��|d z }||kr!� |d � |d z |k�@|D]m}|� |j� |jz � |j � |j z ��}||kr||fg}n||kr|� ||f��n�k|}�n|� |��|d z }|t� ��k��� fd �|D��S)a;Return the subset of points from a set of points that were the closest to each other in the 2D plane. Parameters ========== args A collection of Points on 2D plane. Notes ===== This can only be performed on a set of points whose coordinates can be ordered on the number line. If there are no ties then a single pair of Points will be in the set. Examples ======== >>> from sympy import closest_points, Triangle >>> Triangle(sss=(3, 4, 5)).args (Point2D(0, 0), Point2D(3, 0), Point2D(3, 4)) >>> closest_points(*_) {(Point2D(0, 0), Point2D(3, 0))} References ========== .. [1] https://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairPS.html .. [2] Sweep line algorithm https://en.wikipedia.org/wiki/Sweep_line_algorithm c�,�g|]}t|����Sr�r r>s r r!z"closest_points.<locals>.<listcomp>?���'�'�'������'�'�'r"�z)At least 2 distinct points must be given.c��|jSr,r-r/s r r0z closest_points.<locals>.<lambda>D���Q�V�r"r1�The points could not be sorted.c3�8K�|]}|jD] }|jV�� �dSr,�r.� is_Rational�r�jrs r r<z!closest_points.<locals>.<genexpr>H�3����8�8����8�8�A�q�}�8�8�8�8�8�8�8r"c�b�||z||zz}|jrt|��St|��Sr,�r}�_sqrtr�r�y�args r �hypotzclosest_points.<locals>.hypotI�5���A�#��!��)�C��� "��S�z�z�!���9�9� r"r�r�)rrrc�F��h|]}t�fd�|D������S)c� ��g|] }�|�� Srr�rrr5s �r r!z,closest_points.<locals>.<setcomp>.<listcomp>gs���&�&�&�A�1�Q�4�&�&�&r")r3)r�pairr5s �r � <setcomp>z!closest_points.<locals>.<setcomp>gs6��� 7� 7� 7�D�E�&�&�&�&��&�&�&� '� '� 7� 7� 7r") rBr%r$�sort� TypeErrorrE�mathr�rr�r�popleftrH) r.r��rv� best_distr�left�boxr�dr5s @r �closest_pointsr�sa���F (�'�S��Y�Y�'�'�'�A� �1�v�v��z�z��D�E�E�E�<� ���#�#��$�$�$�$�� �<�<�<��:�;�;�;�<���� �8�8�a�8�8�8� 8� 8�� � � � � ������ ��B���a��d�f�q��t�v�o�q��t�v��!����7�7�I� �A� �D� ��A��-�-�C� �c�!�f�f�*�*��Q�h�h�1�Q�4��7�Q�t�W�Q�Z�/�)�;�;� �K�K�M�M�M� �A�I�D��Q�h�h�1�Q�4��7�Q�t�W�Q�Z�/�)�;�;�� � �A���a��d�f�q��t�v�o�q��t�v��!����7�7�A��9�}�}��!�f�X����i���� � �1�a�&�!�!�!�!���I�I� � � �1� � � � �Q��� �c�!�f�f�*�*�" 8� 7� 7� 7�B� 7� 7� 7�7s �A�A0T)rhc���ddlm}ddlm}t ��}|D]�}t |t ��s> t|��}n-#t$r tdt|��z���wxYwt |t��r|� |����t ||��r|� |j ����t ||��r|� |j����tdt|��z���t!d�|D����rtd���t#|��}t%|��dkr|r|dn |dd fSt%|��d kr ||d|d��}|r|n|d fSd �}g}g} |�d �� ��n#t($rtd���wxYw|D�]} t%|��dkra||d|d| ��dkrD|���t%|��dkr||d|d| ��dk�Dt%| ��dkra|| d| d| ��dkrD| ���t%| ��dkr|| d| d| ��dk�D|�| ��| �| ����|���t1| |dd�z��} t%| ��d kr || d| d��}|r|n|d fS|r|| �S|���|| fS)a�The convex hull surrounding the Points contained in the list of entities. Parameters ========== args : a collection of Points, Segments and/or Polygons Optional parameters =================== polygon : Boolean. If True, returns a Polygon, if false a tuple, see below. Default is True. Returns ======= convex_hull : Polygon if ``polygon`` is True else as a tuple `(U, L)` where ``L`` and ``U`` are the lower and upper hulls, respectively. Notes ===== This can only be performed on a set of points whose coordinates can be ordered on the number line. See Also ======== sympy.geometry.point.Point, sympy.geometry.polygon.Polygon Examples ======== >>> from sympy import convex_hull >>> points = [(1, 1), (1, 2), (3, 1), (-5, 2), (15, 4)] >>> convex_hull(*points) Polygon(Point2D(-5, 2), Point2D(1, 1), Point2D(3, 1), Point2D(15, 4)) >>> convex_hull(*points, **dict(polygon=False)) ([Point2D(-5, 2), Point2D(15, 4)], [Point2D(-5, 2), Point2D(1, 1), Point2D(3, 1), Point2D(15, 4)]) References ========== .. [1] https://en.wikipedia.org/wiki/Graham_scan .. [2] Andrew's Monotone Chain Algorithm (A.M. Andrew, "Another Efficient Algorithm for Convex Hulls in Two Dimensions", 1979) https://web.archive.org/web/20210511015444/http://geomalgorithms.com/a10-_hull-1.html rr\r^z8%s is not a GeometryEntity and cannot be made into Pointz#Convex hull for %s not implemented.c3�<K�|]}t|��dkV��dS)rwN)r%)rrs r r<zconvex_hull.<locals>.<genexpr>�s,���� "� "�1�3�q�6�6�Q�;� "� "� "� "� "� "r"z2Can only compute the convex hull in two dimensionsrNrwc��|j|jz |j|jz z|j|jz |j|jz zz S)zNReturn positive if p-q-r are clockwise, neg if ccw, zero if collinear.)r�r)r5�q�rs r � _orientationz!convex_hull.<locals>._orientation�s9����a�c� �A�C�!�#�I�&�!�#���)�a�c�A�C�i�)@�@�@r"c��|jSr,r-r/s r r0zconvex_hull.<locals>.<lambda>�ryr"r1rz����������)r@r]rhr_r rrr �NotImplementedErrorr$r�add�update�points�vertices�type�anyrCr%r�r�rFrH�reverser3) rhr.r]r_r5rK�sr��Urp�p_i� convexHulls r � convex_hullr�js���j������ � � � � � �� � �A� �A�A���!�^�,�,� f� f��!�H�H����&� f� f� f� �![�^a�bc�^d�^d�!d�e�e�e� f���� �a�� � � A� �E�E�!�H�H�H�H� ��7� #� #� A� �H�H�Q�X� � � � � ��7� #� #� A� �H�H�Q�Z� � � � �%�5��Q���?�A�A� A� � "� "�� "� "� "�"�"�O��M�N�N�N� �Q���A� �1�v�v��{�{��0�q��t�t�Q�q�T�4�L�0� �Q���1��� �G�A�a�D�!�A�$� � ���*�q�q�!�T��*�A�A�A� �A� �A�<� ���#�#��$�$�$�$�� �<�<�<��:�;�;�;�<���������!�f�f�q�j�j�\�\�!�B�%��2���<�<��A�A� �E�E�G�G�G��!�f�f�q�j�j�\�\�!�B�%��2���<�<��A�A��!�f�f�q�j�j�\�\�!�B�%��2���<�<��A�A� �E�E�G�G�G��!�f�f�q�j�j�\�\�!�B�%��2���<�<��A�A� ���� � � � ���� � � � ��I�I�K�K�K��q�1�Q�r�T�7�{�#�#�J� �:���!��� �G�J�q�M�:�a�=� 1� 1���*�q�q�!�T��*����w� �#�#� � � � � � ��1�v� s�A�*A/�+G�Gc��d�}d�t|��D��}td�|D����sd�}nddlm}g}d}||��D]g}t |��\}}||j|jz |j|jz ��} | |kr||fg}n| |kr|�||f��n�e| }�ht|��S)alReturn the subset of points from a set of points that were the furthest apart from each other in the 2D plane. Parameters ========== args A collection of Points on 2D plane. Notes ===== This can only be performed on a set of points whose coordinates can be ordered on the number line. If there are no ties then a single pair of Points will be in the set. Examples ======== >>> from sympy.geometry import farthest_points, Triangle >>> Triangle(sss=(3, 4, 5)).args (Point2D(0, 0), Point2D(3, 0), Point2D(3, 4)) >>> farthest_points(*_) {(Point2D(0, 0), Point2D(3, 4))} References ========== .. [1] https://code.activestate.com/recipes/117225-convex-hull-and-diameter-of-2d-point-sets/ .. [2] Rotating Callipers Technique https://en.wikipedia.org/wiki/Rotating_calipers c3�K�t|iddi��\}}|�/t|t��rtd���|jV�dSd}t |��dz }|t |��dz ks|dkr�||||fV�|t |��dz kr|dz}n�|dkr|dz }n�||dzj||jz ||j||dz jz z||j||dz jz ||dzj||jz zkr|dz }n|dz}|t |��dz k��|dk��dSdS)NrhFz+At least two distinct points must be given.rr)r�rr r$r.r%r�r)�Pointsr�rprrs r �rotatingCalipersz)farthest_points.<locals>.rotatingCaliperss{�����F�9�y�%�&8�9�9���1� �9��!�U�#�#� P� �!N�O�O�O��&�L�L�L�L�L��A��A���� �A��c�!�f�f�q�j�.�.�A��E�E���d�A�a�D�j� � � ���A���� �?�?���F�A�A��!�V�V���F�A�A���!��f�h��1���'�A�a�D�F�Q�q��s�V�X�,=�>��1���!�A�a�C�&�(�*�q��1��v�x�!�A�$�&�/@�A�B�B���F�A�A���F�A��c�!�f�f�q�j�.�.�A��E�E�E�E�E�Er"c�,�g|]}t|����Srrur>s r r!z#farthest_points.<locals>.<listcomp>rvr"c3�8K�|]}|jD] }|jV�� �dSr,r|r~s r r<z"farthest_points.<locals>.<genexpr>r�r"c�b�||z||zz}|jrt|��St|��Sr,r�r�s r r�zfarthest_points.<locals>.hypotr�r"rr�)rBrEr�r�r6rr�rH) r.r�r5r�r��diamr��hr�r�s r �farthest_pointsr��s��H���2 (�'�S��Y�Y�'�'�'�A� �8�8�a�8�8�8� 8� 8�� � � � � ������ �B� �D� � ��&�&� � ���t�$�$���1� �E�!�#���)�Q�S�1�3�Y� '� '�� �t�8�8��a�&��B�B� �$�Y�Y� �I�I�q�!�f� � � � � ���� �r�7�7�Nr"c ���� �t|��rt|��� |d}nAt|t��r|h� n(t|t��rnt d|z���� �fd�|jD��}t|t��r1t |j���������}n|����}|� |��}i}t|��D]�}|����}|� |tj i��} || z � |tji��} tt!t#| | z � |����d�����} ||dz kr3| � d�|���D����cS| ||<|| z }|����}��dS) a�Return ``dy/dx`` assuming that ``eq == 0``. Parameters ========== y : the dependent variable or a list of dependent variables (with y first) x : the variable that the derivative is being taken with respect to n : the order of the derivative (default is 1) Examples ======== >>> from sympy.abc import x, y, a >>> from sympy.geometry.util import idiff >>> circ = x**2 + y**2 - 4 >>> idiff(circ, y, x) -x/y >>> idiff(circ, y, x, 2).simplify() (-x**2 - y**2)/y**3 Here, ``a`` is assumed to be independent of ``x``: >>> idiff(x + a + y, y, x) -1 Now the x-dependence of ``a`` is made explicit by listing ``a`` after ``y`` in a list. >>> idiff(x + a + y, [y, a], x) -Derivative(a, x) - 1 See Also ======== sympy.core.function.Derivative: represents unevaluated derivatives sympy.core.function.diff: explicitly differentiates wrt symbols rz:expecting x-dependent symbol(s) or function(s) but got: %sc�`��i|]*}|�k�|�v� |t|j�������+Sr)rr)rr��deprs ��r � <dictcomp>zidiff.<locals>.<dictcomp>fsH��� � � �A� ��6�6�a�3�h�h� � �H�Q�V� � �Q� � ��h�hr"F)�deeprc��g|] \}}||f�� Srr)r�k�vs r r!zidiff.<locals>.<listcomp>ws ��9�9�9�t�q�!�Q��F�9�9�9r"N)rrBrrrr$r#r�diff�subs�range�xreplacer�Zero�Oner rr�items) �eqr�r�n�f�dydx�derivsr�deqrMrL�ypr�s ` @r �idiffr�4s�����P�1�~�~�[��!�f�f�� �a�D��� �A�v� � �[��c��� �A�x� � �[� ��U�XY�Y�Z�Z�Z� � � � � ��� � � �A��!�V�����x������"�"�'�'��*�*����v�v�a�y�y�� ������B� �F� �1�X�X� � ���g�g�a�j�j�� �L�L�$���� (� (�� �1�W� � ��a�e�}� -� -�� �*�V�a�R��T�K�K��,?�,?�%@�%@�u�M�M�M� N� N�� ��A��:�:��7�7�9�9�q�w�w�y�y�9�9�9�:�:� :� :� :���t� � �B�Y���y�y��|�|��� � r"F)�pairwisec ����t|��dkrgSt|��}d}t|��D]�\}}t|t��st |��}i}|�t��D]E}|�|jnt|j|��}|� |t|d������F|� |��||<��|s`|d� |d��}|dd�D]3} g} |D]*} | �| � | �����+| }�4n�g} tt|����D]T} t| dzt|����D]1}| �t|| ||�����2�Utt!t#| ������}|�t%|����fd�|D��}|S)a The intersection of a collection of GeometryEntity instances. Parameters ========== entities : sequence of GeometryEntity pairwise (keyword argument) : Can be either True or False Returns ======= intersection : list of GeometryEntity Raises ====== NotImplementedError When unable to calculate intersection. Notes ===== The intersection of any geometrical entity with itself should return a list with one item: the entity in question. An intersection requires two or more entities. If only a single entity is given then the function will return an empty list. It is possible for `intersection` to miss intersections that one knows exists because the required quantities were not fully simplified internally. Reals should be converted to Rationals, e.g. Rational(str(real_num)) or else failures due to floating point issues may result. Case 1: When the keyword argument 'pairwise' is False (default value): In this case, the function returns a list of intersections common to all entities. Case 2: When the keyword argument 'pairwise' is True: In this case, the functions returns a list intersections that occur between any pair of entities. See Also ======== sympy.geometry.entity.GeometryEntity.intersection Examples ======== >>> from sympy import Ray, Circle, intersection >>> c = Circle((0, 1), 1) >>> intersection(c, c.center) [] >>> right = Ray((0, 0), (1, 0)) >>> up = Ray((0, 0), (0, 1)) >>> intersection(c, right, up) [Point2D(0, 0)] >>> intersection(c, right, up, pairwise=True) [Point2D(0, 0), Point2D(0, 2)] >>> left = Ray((1, 0), (0, 0)) >>> intersection(right, left) [Segment2D(Point2D(0, 0), Point2D(1, 0))] rNT)�rationalrrwc�:��g|]}|������Sr)r�r�s �r r!z intersection.<locals>.<listcomp>�s#���#�#�#�!�q�s�s�1�v�v�#�#�#r")r%rC� enumeraterrr �atomsr�_prec�min� setdefaultrr�� intersectionrIr�rrBr)r��entities�kwargs�precrrKr�r��res�entity�newresr�ansrr�r5s @r r�r�}s���x �8�}�}����� ��H�~�~�H� �D��(�#�#� $� $���1��!�^�,�,� ��a���A� �������� 9� 9�A�"�l�1�7�7��A�G�T�0B�0B�D� �L�L��I�a�$�7�7�7� 8� 8� 8� 8��j�j��m�m��� � � �&��q�k�&�&�x��{�3�3���q�r�r�l� � �F��F�� 6� 6��� � �a�n�n�V�4�4�5�5�5�5��C�C�  ����s�8�}�}�%�%� C� C�A��1�q�5�#�h�-�-�0�0� C� C��� � �<��� �X�a�[�A�A�B�B�B�B� C��7�3�s�8�8�$�$�%�%�� �� �� � ��#�#�#�#�s�#�#�#�� �Jr"N)r)0�__doc__� collectionsrr�rr��sympyrr�r� exceptionsr�pointr r r �sympy.core.containersr �sympy.core.exprtoolsr �sympy.core.functionrr�sympy.core.numbersr�sympy.core.sortingr�sympy.core.symbolr�sympy.core.singletonr�sympy.polys.polytoolsr�(sympy.functions.elementary.miscellaneous�sympy.utilities.iterablesr�mpmath.libmp.libmpfrr)r6rJrZrlr�r�r�r�r�rr"r �<module>r�s<�� � �������������������"�"�"�"�"�"�%�%�%�%�%�%�*�*�*�*�*�*�*�*�*�*�,�,�,�,�,�,�-�-�-�-�-�-�4�4�4�4�4�4�4�4�$�$�$�$�$�$�&�&�&�&�&�&�$�$�$�$�$�$�"�"�"�"�"�"�(�(�(�(�(�(�9�9�9�9�9�9�1�1�1�1�1�1�+�+�+�+�+�+�#�#�#�L2�2�2� C#�C#�C#�L9?�9?�9?�xI7�I7�I7�XK8�K8�K8�\ $�p�p�p�p�p�dU�U�U�pF�F�F�F�R&+�`�`�`�`�`�`�`r"
Memory