� ��g*i��>�dZddlmZmZmZmZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZmZmZmZmZmZmZmZddlmZmZdd lmZdd lmZdd l m!Z!m"Z"dd l#m$Z$m%Z%dd l&m'Z'm(Z(m)Z)ddl*m+Z+ddl,Z,d�e-d��D��\Z.Z/Z0Z1Gd�de��Z2dS)z.Geometrical Planes. Contains ======== Plane �)�Dummy�Rational�S�Symbol)�_symbol)�cos�sin�acos�asin�sqrt�)�GeometryEntity)�Line�Ray�Segment�Line3D� LinearEntity�LinearEntity3D�Ray3D� Segment3D)�Point�Point3D)�Matrix)�cancel)�solve�linsolve)�uniq� is_sequence)� filldedent� func_name� Undecidable)� prec_to_dpsNc�,�g|]}td����S)� plane_dummy)r��.0�is �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/geometry/plane.py� <listcomp>r)s �� 5� 5� 5�q�e�M�"�"� 5� 5� 5��c���eZdZdZdd�Zd�Zdd�Zd�Zdd�Ze d ���Z d �Z d �Z dd �Z d �Zd�Zd�Zd�Zed���Zed���Zd�Zd�Zd�Zd�Zd�Zdd�Zdd�Zed���ZdS)�Planea� A plane is a flat, two-dimensional surface. A plane is the two-dimensional analogue of a point (zero-dimensions), a line (one-dimension) and a solid (three-dimensions). A plane can generally be constructed by two types of inputs. They are: - three non-collinear points - a point and the plane's normal vector Attributes ========== p1 normal_vector Examples ======== >>> from sympy import Plane, Point3D >>> Plane(Point3D(1, 1, 1), Point3D(2, 3, 4), Point3D(2, 2, 2)) Plane(Point3D(1, 1, 1), (-1, 2, -1)) >>> Plane((1, 1, 1), (2, 3, 4), (2, 2, 2)) Plane(Point3D(1, 1, 1), (-1, 2, -1)) >>> Plane(Point3D(1, 1, 1), normal_vector=(1,4,7)) Plane(Point3D(1, 1, 1), (1, 4, 7)) Nc ��t|d���}|r�|r�t|d���}t|d���}tj|||��rtd���|�|��}|�|��}t t |���t |������}n�|�d|��}|� dd��}t|��r,t|��dkr|rt|��j n|}nttd�����td�|D����rtd ���tj|||fi|��S) N���dimz Enter three non-collinear points� normal_vector�evaluateTz� Either provide 3 3D points or a point with a normal vector expressed as a sequence of length 3c3�$K�|] }|jV�� dS�N)�is_zero)r&�coords r(� <genexpr>z Plane.__new__.<locals>.<genexpr>Ls$����<�<�U�5�=�<�<�<�<�<�<r*z#Normal vector cannot be zero vector)rr� are_collinear� ValueError�direction_ratio�tupler�cross�pop�getr�len�argsr�allr�__new__) �cls�p1�a�b�kwargs�p2�p3r2r3s r(rCz Plane.__new__9s��� �R�Q� � � �� � H�� H��q�a����B��q�a����B��$�R��R�0�0� E� �!C�D�D�D��"�"�2�&�&�A��"�"�2�&�&�A�!�&��)�)�/�/�&��)�)�"<�"<�=�=�M�M�� � �?�A�.�.�A��z�z�*�d�3�3�H��1�~�~� K�#�a�&�&�A�+�+�3;� B��� � ���� � � ��-I�"J�"J�K�K�K��<�<�m�<�<�<�<�<� H� �!F�G�G�G��%�c�2�}�G�G��G�G�Gr*c �v�|�ttt��}t |t t f��rxt|�t����}|� t|jft|jft|jfg��}|� d��S t|dd���}|� tttttf|j������}|� d��S#t"$rYdSwxYw)Nrr/T)r1�strictF)�equation�x�y�z� isinstancerrr�arbitrary_point�t�subs�equalsr�xreplace�dict�ziprA� TypeError)�self�o�k�d�es r(� __contains__zPlane.__contains__Ps��� �M�M�!�Q�� "� "�� �a�,��7� 8� 8� ���)�)�!�,�,�-�-�A�����A�C��1�a�c�(�Q���H�5�6�6�A��8�8�A�;�;� � ��a�Q�t�,�,�,�A�� � �4��Q��1�I�q�v� 6� 6�7�7�8�8�A��8�8�A�;�;� ��� � � ��5�5� ���s�<A-D*�* D8�7D8�c ����|j\}}t|���|jdd�i���}t��fd�|D����}|�||d���S)N�nc�.��g|]}|jdd�i�����S)rb�)�evalf)r&r'�dps�optionss ��r(r)z%Plane._eval_evalf.<locals>.<listcomp>as0���<�<�<�1�W�Q�W�.�.�s�.�g�.�.�<�<�<r*F)r2r3rd)rAr"rer<�func)rZ�precrg�pt�tuprfs ` @r(� _eval_evalfzPlane._eval_evalf]su�����)���C��$���� �R�X� '� '�� '�w� '� '���<�<�<�<�<��<�<�<�=�=���y�y��3��y�?�?�?r*c���t|t��r�t|j��}t|j��}|�|��}t td�|jD������}t td�|jD������}t|||zz ��St|t��r�t|j��}t|j��}|�|��}t td�|jD������}t td�|jD������}t|||zz ��SdS)aAngle between the plane and other geometric entity. Parameters ========== LinearEntity3D, Plane. Returns ======= angle : angle in radians Notes ===== This method accepts only 3D entities as it's parameter, but if you want to calculate the angle between a 2D entity and a plane you should first convert to a 3D entity by projecting onto a desired plane and then proceed to calculate the angle. Examples ======== >>> from sympy import Point3D, Line3D, Plane >>> a = Plane(Point3D(1, 2, 2), normal_vector=(1, 2, 3)) >>> b = Line3D(Point3D(1, 3, 4), Point3D(2, 2, 2)) >>> a.angle_between(b) -asin(sqrt(21)/6) c3� K�|] }|dzV�� dS��Nrdr%s r(r8z&Plane.angle_between.<locals>.<genexpr>��&����:�:�!��A��:�:�:�:�:�:r*c3� K�|] }|dzV�� dSrordr%s r(r8z&Plane.angle_between.<locals>.<genexpr>�s&����9�9�!��A��9�9�9�9�9�9r*c3� K�|] }|dzV�� dSrordr%s r(r8z&Plane.angle_between.<locals>.<genexpr>�rqr*c3� K�|] }|dzV�� dSrordr%s r(r8z&Plane.angle_between.<locals>.<genexpr>�s&����7�7�!��A��7�7�7�7�7�7r*N) rQrrr2r;�dotr �sumr r-r )rZr[rFrG�cr]r^s r(� angle_betweenzPlane.angle_betweendsR��> �a�� (� (� !��t�)�*�*�A��q�(�)�)�A����a���A��S�:�:�t�'9�:�:�:�:�:�;�;�A��S�9�9�q�'8�9�9�9�9�9�:�:�A���1�Q�3��=�=� � �a�� � � !��t�)�*�*�A��q��'�'�A����a���A��S�:�:�t�'9�:�:�:�:�:�;�;�A��S�7�7�q��7�7�7�7�7�8�8�A���1�Q�3��=�=� �  !� !r*c �� � � ����|du}|rt|pdd���}n&t|pdd���}t|pdd���}|j\}}}|jj\}}} |jr-|jr&t jt jt jc� � �n| |t jc� � �tt|||f��� t� � �f������\� ��|r�� � �fd�� � �fD��\� � �� ��fd�� ��fD��\� ��t|� t|��zz� t|��zz|� t|��zz�t|��zz| �t|��zz�t|��zz��} n5t|� |zz� |zz|� |zz�|zz| �|zz�|zz��} | S) a� Returns an arbitrary point on the Plane. If given two parameters, the point ranges over the entire plane. If given 1 or no parameters, returns a point with one parameter which, when varying from 0 to 2*pi, moves the point in a circle of radius 1 about p1 of the Plane. Examples ======== >>> from sympy import Plane, Ray >>> from sympy.abc import u, v, t, r >>> p = Plane((1, 1, 1), normal_vector=(1, 0, 0)) >>> p.arbitrary_point(u, v) Point3D(1, u + 1, v + 1) >>> p.arbitrary_point(t) Point3D(1, cos(t) + 1, sin(t) + 1) While arbitrary values of u and v can move the point anywhere in the plane, the single-parameter point can be used to construct a ray whose arbitrary point can be located at angle t and radius r from p.p1: >>> Ray(p.p1, _).arbitrary_point(r) Point3D(1, r*cos(t) + 1, r*sin(t) + 1) Returns ======= Point3D NrST��real�u�vc3�Z�K�|]%}|t�dz�dzz�dzz��z V��&dSro�r )r&�w�x1�y1�z1s ���r(r8z(Plane.arbitrary_point.<locals>.<genexpr>��E�����N�N�A�!�D��Q���Q����Q��!6�7�7�7�N�N�N�N�N�Nr*c3�Z�K�|]%}|t�dz�dzz�dzz��z V��&dSror)r&r��x2�y2�z2s ���r(r8z(Plane.arbitrary_point.<locals>.<genexpr>�r�r*)rr2rErAr6r�One�Zeror<rr=rrr )rZr|r}�circlerNrOrPrFrGrw�pr�r�r�r�r�r�s @@@@@@r(rRzPlane.arbitrary_point�s��������@�d��� � -����S�t�,�,�,�A�A����S�t�,�,�,�A����S�t�,�,�,�A��$���1�a��'�,���1�a� �9� '��� '�������J�B��B�B���Q���J�B��B��6�1�a��)�,�,�2�2�6�2�r�2�,�3G�3G�H�H�I�I� ��B�� � K�N�N�N�N�N�N�"�b�"��N�N�N�J�B��B�N�N�N�N�N�N�"�b�"��N�N�N�J�B��B���B�s�1�v�v�I� ��3�q�6�6� �1��B�s�1�v�v�I� ��3�q�6�6� �1��B�s�1�v�v�I� ��3�q�6�6� �1�3�3�A�A���B�q�D��2�a�4���R��T��B�q�D��!�b��d�(�R��T�/�J�J�A��r*c���tt|����}|D].}t|t��st d|jz����/t |��dkrdSt|��}|�d��}|�|d��}|gkrdS|d}|dd�D]&}|�|��}|r |d|vrdS�'dS)a}Is a sequence of Planes concurrent? Two or more Planes are concurrent if their intersections are a common line. Parameters ========== planes: list Returns ======= Boolean Examples ======== >>> from sympy import Plane, Point3D >>> a = Plane(Point3D(5, 0, 0), normal_vector=(1, -1, 1)) >>> b = Plane(Point3D(0, -2, 0), normal_vector=(3, 1, 1)) >>> c = Plane(Point3D(0, -1, 0), normal_vector=(5, -1, 9)) >>> Plane.are_concurrent(a, b) True >>> Plane.are_concurrent(a, b, c) False z'All objects should be Planes but got %srpFrr NT) �listrrQr-r:rhr@r>� intersection)�planesr'�first�sol�line�ls r(�are_concurrentzPlane.are_concurrent�s��<�d�6�l�l�#�#��� U� U�A��a��'�'� U� �!J�Q�V�!S�T�T�T� U� �v�;�;��?�?��5��f����� � �1� � ��� � ����+�+�� �"�9�9��5��q�6�D��A�B�B�Z� !� !���&�&�q�)�)���!�A�a�D��,�,� �5�5�-��4r*c��|�|��gkr tjSt|tt f��r�|j|j}}|�t||����\}||vr|� |��S|t ||��vr|� |��St|t��dusJ�|� |��St|t��r|n|j}t|j ��j }||jz � |��}t|��S)a@Distance between the plane and another geometric entity. Parameters ========== Point3D, LinearEntity3D, Plane. Returns ======= distance Notes ===== This method accepts only 3D entities as it's parameter, but if you want to calculate the distance between a 2D entity and a plane you should first convert to a 3D entity by projecting onto a desired plane and then proceed to calculate the distance. Examples ======== >>> from sympy import Point3D, Line3D, Plane >>> a = Plane(Point3D(1, 1, 1), normal_vector=(1, 1, 1)) >>> b = Point3D(1, 2, 3) >>> a.distance(b) sqrt(3) >>> c = Line3D(Point3D(2, 3, 1), Point3D(1, 2, 2)) >>> a.distance(c) 0 T)r�rr�rQrrrErIr�distancerr2�unitru�abs)rZr[rFrG�pirbr]s r(r�zPlane.distance�s(��D � � �Q� � �2� %� %��6�M� �a�)�U�+� ,� ,� (��4���q�A��#�#�F�1�a�L�L�1�1�C�B��Q�w�w��}�}�R�(�(�(��i��A�&�&�&�&��}�}�Q�'�'�'�!�!�Y�/�/�4�7�7�7�7��}�}�Q�'�'�'��A�w�'�'� 1�A�A�Q�T�� �D�&� '� '� ,�� ���[� � �a� � ���1�v�v� r*c���t|t��rL|���}|���}t||z �����SdS)a� Returns True if self and o are the same mathematical entities. Examples ======== >>> from sympy import Plane, Point3D >>> a = Plane(Point3D(1, 2, 3), normal_vector=(1, 1, 1)) >>> b = Plane(Point3D(1, 2, 3), normal_vector=(2, 2, 2)) >>> c = Plane(Point3D(1, 2, 3), normal_vector=(-1, 4, 6)) >>> a.equals(a) True >>> a.equals(b) True >>> a.equals(c) False F)rQr-rMr� is_constant)rZr[rFrGs r(rUz Plane.equals6sQ��$ �a�� � � �� � ���A�� � � � �A��!�A�#�;�;�*�*�,�,� ,��5r*c���d�t|||fd��D��\}}}t|||��}|j�|��}|j}t d�t||��D����S)aqThe equation of the Plane. Examples ======== >>> from sympy import Point3D, Plane >>> a = Plane(Point3D(1, 1, 2), Point3D(2, 4, 7), Point3D(3, 5, 1)) >>> a.equation() -23*x + 11*y - 2*z + 16 >>> a = Plane(Point3D(1, 4, 2), normal_vector=(6, 6, 6)) >>> a.equation() 6*x + 6*y + 6*z - 42 c�>�g|]\}}|r|nt|d�����S)Trz)r�r&r'�js r(r)z"Plane.equation.<locals>.<listcomp>_s2��V�V�V���1��3�1�1�v�a�d�3�3�3�V�V�Vr*�xyzc3�&K�|] \}}||zV�� dSr5rdr�s r(r8z!Plane.equation.<locals>.<genexpr>c�*����.�.�D�A�q�A�a�C�.�.�.�.�.�.r*)rXrrEr;r2rv)rZrNrOrPrFrGrws r(rMzPlane.equationPs���W�V��Q��1�I�u�@U�@U�V�V�V���1�a� �A�q�!� � �� �G� #� #�A� &� &�� � ���.�.�C��1�I�I�.�.�.�.�.�/r*c�L�t|t��st|d���}t|t��r ||vr|gSgSt|ttf���r�|j|j}}t|t��rt||��}nct|t��rt||��}n=t|t��rt||��}ntd|jz���||vr|gSt|�t"����}|jt|j��}}t'||z �|��t"��}|sgSd�|D��}t+|��dkr d�|D��}t+|��dkrt-d���|�t"|d��}||vrgS|gSt|t0���r&|�|��r|gS|�|��rgSt7t8d ��\}} } t;|jg��t;|jg��} }t=|�| ����}|� || | ��} |� || | ��} t=tC| | g|| | ����d}|| | fD]}|�|d��}�tt|��|� ��gSd S) a  The intersection with other geometrical entity. Parameters ========== Point, Point3D, LinearEntity, LinearEntity3D, Plane Returns ======= List Examples ======== >>> from sympy import Point3D, Line3D, Plane >>> a = Plane(Point3D(1, 2, 3), normal_vector=(1, 1, 1)) >>> b = Point3D(1, 2, 3) >>> a.intersection(b) [Point3D(1, 2, 3)] >>> c = Line3D(Point3D(1, 4, 7), Point3D(2, 2, 2)) >>> a.intersection(c) [Point3D(2, 2, 2)] >>> d = Plane(Point3D(6, 0, 0), normal_vector=(2, -5, 3)) >>> e = Plane(Point3D(2, 0, 0), normal_vector=(3, 4, -3)) >>> d.intersection(e) [Line3D(Point3D(78/23, -24/23, 0), Point3D(147/23, 321/23, 23))] r/r0zunhandled linear entity: %sc�$�g|] }|jdu� |��S)F��is_realr%s r(r)z&Plane.intersection.<locals>.<listcomp>�s$��@�@�@�q���%�)?�)?��)?�)?�)?r*r c� �g|] }|j� |�� Srdr�r%s r(r)z&Plane.intersection.<locals>.<listcomp>�s��7�7�7�1�Q�Y�7�Q�7�7�7r*znot sure which point is realrr��r;N)"rQrrrrrErIrrrrrrr:rhrrRrSr2rrur@r!rTr-rU� is_parallel�maprrr�r=rMr)rZr[rErIrFrbrwr�rNrOrPrGr]r^�resultr's r(r�zPlane.intersectionfs ��<�!�^�,�,� ��a�Q����A� �a�� � � ��D�y�y��s� �� � �a�,��7� 8� 8� ��T�1�4��B��!�W�%�%� I��b�"�%�%����A�s�#�#� I��"�b�M�M����A�t�$�$� I��2�r�N�N��� �!>���!G�H�H�H��D�y�y��s� ��A�-�-�a�0�0�1�1������);�!<�!<�A���1�r�6�,�,�q�/�/�1�-�-��� ��I�@�@�A�@�@�@�A��1�v�v��z�z�7�7��7�7�7���1�v�v��{�{�)�*H�I�I�I����q�!�A�$���A���z�z�!� ��3�J� �a�� � � D��{�{�1�~�~� ��v� �����"�"� D�� ��e�U�+�+���1�a��t�1�2�3�3�V�Q�_�<M�5N�5N�1���������$�$���M�M�!�Q��*�*���J�J�q�!�Q�'�'���h��1�v�q�!�Q�7�7�8�8��;���Q���>�>�A�V�[�[��A�->�->�F�F��w�v����B�B�B�C�C� D� Dr*c�8��t|t��rt��tt t ��|�tt t ��z ���tt t �� St|t��r|�vSt|t��rt�fd��D����St|t��r&td��j dd�D����SdS)a8 Returns True if `o` is coplanar with self, else False. Examples ======== >>> from sympy import Plane >>> o = (0, 0, 0) >>> p = Plane(o, (1, 1, 1)) >>> p2 = Plane(o, (2, 2, 2)) >>> p == p2 False >>> p.is_coplanar(p2) True c3� �K�|]}|�vV�� dSr5rd)r&r'rZs �r(r8z$Plane.is_coplanar.<locals>.<genexpr>�s'�����/�/�Q�q�D�y�/�/�/�/�/�/r*c3�"K�|] }|dkV�� dS)rNrdr%s r(r8z$Plane.is_coplanar.<locals>.<genexpr>�s&����>�>�!�q�A�v�>�>�>�>�>�>r*Nrp) rQr-rrMrNrOrP�hasrrrBrr2)rZr[s` r(� is_coplanarzPlane.is_coplanar�s���� �a�� � � W��d�m�m�A�q�!�4�4�Q�Z�Z��1�a�5H�5H�H�I�I�M�M�a�QR�TU�V�V�V� V� �a�� !� !� ?���9� � ��>� *� *� ?��/�/�/�/�$�/�/�/�/�/� /� ��>� *� *� ?��>�>�t�'9�"�1�"�'=�>�>�>�>�>� >� ?� ?r*c�d�t|t��r?|j}|j}t d�t ||��D����}|dkrdSdSt|t ��rFt|j��}t|j��}|�|��j rdSdSdS)a�Is the given geometric entity parallel to the plane? Parameters ========== LinearEntity3D or Plane Returns ======= Boolean Examples ======== >>> from sympy import Plane, Point3D >>> a = Plane(Point3D(1,4,6), normal_vector=(2, 4, 6)) >>> b = Plane(Point3D(3,1,3), normal_vector=(4, 8, 12)) >>> a.is_parallel(b) True c3�&K�|] \}}||zV�� dSr5rdr�s r(r8z$Plane.is_parallel.<locals>.<genexpr>�r�r*rTFN) rQrr;r2rvrXr-rr=�is_zero_matrix)rZr�rFrGrws r(r�zPlane.is_parallel�s���. �a�� (� (� ��!�A��"�A��.�.�C��1�I�I�.�.�.�.�.�A��A�v�v��t��u� ��5� !� !� ��q��'�'�A��t�)�*�*�A��w�w�q�z�z�(� ��t��u�  � r*c�p�t|t��rFt|j��}t|j��}|�|��jrdSdSt|t��rEt|j��}t|j��}|�|��dkrdSdSdS)a�Is the given geometric entity perpendicualar to the given plane? Parameters ========== LinearEntity3D or Plane Returns ======= Boolean Examples ======== >>> from sympy import Plane, Point3D >>> a = Plane(Point3D(1,4,6), normal_vector=(2, 4, 6)) >>> b = Plane(Point3D(2, 2, 2), normal_vector=(-1, 2, -1)) >>> a.is_perpendicular(b) True TFr) rQrrr;r2r=r�r-ru)rZr�rFrGs r(�is_perpendicularzPlane.is_perpendicular�s���. �a�� (� (� ��q�(�)�)�A��t�)�*�*�A��w�w�q�z�z�(� ��t��u� ��5� !� !� ��a�o�&�&�1��d�(�)�)�1��e�e�A�h�h�!�m�m��d��e��5r*c��|jdS)agNormal vector of the given plane. Examples ======== >>> from sympy import Point3D, Plane >>> a = Plane(Point3D(1, 1, 1), Point3D(2, 3, 4), Point3D(2, 2, 2)) >>> a.normal_vector (-1, 2, -1) >>> a = Plane(Point3D(1, 1, 1), normal_vector=(1, 4, 7)) >>> a.normal_vector (1, 4, 7) r �rA�rZs r(r2zPlane.normal_vector#s�� �y��|�r*c��|jdS)aThe only defining point of the plane. Others can be obtained from the arbitrary_point method. See Also ======== sympy.geometry.point.Point3D Examples ======== >>> from sympy import Point3D, Plane >>> a = Plane(Point3D(1, 1, 1), Point3D(2, 3, 4), Point3D(2, 2, 2)) >>> a.p1 Point3D(1, 1, 1) rr�r�s r(rEzPlane.p15s��&�y��|�r*c�2�|j}t||���S)a� Plane parallel to the given plane and passing through the point pt. Parameters ========== pt: Point3D Returns ======= Plane Examples ======== >>> from sympy import Plane, Point3D >>> a = Plane(Point3D(1, 4, 6), normal_vector=(2, 4, 6)) >>> a.parallel_plane(Point3D(2, 3, 5)) Plane(Point3D(2, 3, 5), (2, 4, 6)) )r2)r2r-�rZrjrFs r(�parallel_planezPlane.parallel_planeJs��. � ���R�q�)�)�)�)r*c�2�|j}t||���S)a�A line perpendicular to the given plane. Parameters ========== pt: Point3D Returns ======= Line3D Examples ======== >>> from sympy import Plane, Point3D >>> a = Plane(Point3D(1,4,6), normal_vector=(2, 4, 6)) >>> a.perpendicular_line(Point3D(9, 8, 7)) Line3D(Point3D(9, 8, 7), Point3D(11, 12, 13)) r�)r2rr�s r(�perpendicular_linezPlane.perpendicular_lineds��, � ���b�!�,�,�,�,r*c��t|��dkrtd���t|��}t|��dkr|�|j��t|��dkrE|j\}}}||cxkrdkrnnd}nd}|�|dt |�z��d�|D��\}}t||��}t||j���} || vrH|j\}}}||cxkrdkrnnt ddd��} nt ddd��} | |vr| dz} n|t |j�z} t||| ��S) aU Return a perpendicular passing through the given points. If the direction ratio between the points is the same as the Plane's normal vector then, to select from the infinite number of possible planes, a third point will be chosen on the z-axis (or the y-axis if the normal vector is already parallel to the z-axis). If less than two points are given they will be supplied as follows: if no point is given then pt1 will be self.p1; if a second point is not given it will be a point through pt1 on a line parallel to the z-axis (if the normal is not already the z-axis, otherwise on the line parallel to the y-axis). Parameters ========== pts: 0, 1 or 2 Point3D Returns ======= Plane Examples ======== >>> from sympy import Plane, Point3D >>> a, b = Point3D(0, 0, 0), Point3D(0, 1, 0) >>> Z = (0, 0, 1) >>> p = Plane(a, normal_vector=Z) >>> p.perpendicular_plane(a, b) Plane(Point3D(0, 0, 0), (1, 0, 0)) rpz&No more than 2 pts should be provided.rr )rr r)rrr c�0�g|]}t|d�����S)r/r0)rr%s r(r)z-Plane.perpendicular_plane.<locals>.<listcomp>�s"��/�/�/�a�%��q�/�/�/�/�/�/r*r�) r@r:r��appendrEr2rrr-) rZ�ptsrNrOrP�dirrErIr�rbrJs r(�perpendicular_planezPlane.perpendicular_plane}sx��B �s�8�8�a�<�<��E�F�F� F��3�i�i�� �s�8�8�q�=�=� �J�J�t�w� � � � �s�8�8�q�=�=��(�G�A�q�!��A�{�{�{�{��{�{�{�{�{������ �J�J�s�1�v��� �-� .� .� .�/�/�3�/�/�/���B� �2�r�N�N�� �2�t�'9� :� :� :�� ��6�6��(�G�A�q�!��A�{�{�{�{��{�{�{�{�{��Q��1�%�%����Q��1�%�%���Q�w�w��a�����g�t�1�2�2�B��R��R� � � r*c���t|ttf��std���|�|j��|�|j��}}||kr|St|ttf��rt||��St|ttf��rt||��St|ttf��rt||��SdS)a0Project the given line onto the plane through the normal plane containing the line. Parameters ========== LinearEntity or LinearEntity3D Returns ======= Point3D, Line3D, Ray3D or Segment3D Notes ===== For the interaction between 2D and 3D lines(segments, rays), you should convert the line to 3D by using this method. For example for finding the intersection between a 2D and a 3D line, convert the 2D line to a 3D line by projecting it on a required plane and then proceed to find the intersection between those lines. Examples ======== >>> from sympy import Plane, Line, Line3D, Point3D >>> a = Plane(Point3D(1, 1, 1), normal_vector=(1, 1, 1)) >>> b = Line(Point3D(1, 1), Point3D(2, 2)) >>> a.projection_line(b) Line3D(Point3D(4/3, 4/3, 1/3), Point3D(5/3, 5/3, -1/3)) >>> c = Line3D(Point3D(1, 1, 1), Point3D(2, 2, 2)) >>> a.projection_line(c) Point3D(1, 1, 1) zEnter a linear entity onlyN) rQrr�NotImplementedError� projectionrErIrrrrrr)rZr�rFrGs r(�projection_linezPlane.projection_line�s���H�$��~� >�?�?� D�%�&B�C�C� C����t�w�'�'������)A�)A�1�� ��6�6��H� �d�T�6�N� +� +� ��!�Q�<�<� � �d�S�%�L� )� )� ���A�;�;� � �d�W�i�0� 1� 1� #��Q��?�?� "� #� #r*c ��t|d���}||vr|S|�t||t|j��z����dS)aProject the given point onto the plane along the plane normal. Parameters ========== Point or Point3D Returns ======= Point3D Examples ======== >>> from sympy import Plane, Point3D >>> A = Plane(Point3D(1, 1, 2), normal_vector=(1, 1, 1)) The projection is along the normal vector direction, not the z axis, so (1, 1) does not project to (1, 1, 2) on the plane A: >>> b = Point3D(1, 1) >>> A.projection(b) Point3D(5/3, 5/3, 2/3) >>> _ in A True But the point (1, 1, 2) projects to (1, 1) on the XY-plane: >>> XY = Plane((0, 0, 0), (0, 0, 1)) >>> XY.projection((1, 1, 2)) Point3D(1, 1, 0) r/r0r)rr�rrr2)rZrj�rvs r(r�zPlane.projection�sX��D�2�1� � � �� ��:�:��I�� � ���B���9K�1L�1L�,L�!M�!M�N�N�q�Q�Qr*c �`�|�tj|��}nt}tdt|�dd����zdz t dt|�dd����zdz i}|�tt ���|��S)a Returns a random point on the Plane. Returns ======= Point3D Examples ======== >>> from sympy import Plane >>> p = Plane((1, 0, 0), normal_vector=(0, 1, 0)) >>> r = p.random_point(seed=42) # seed value is optional >>> r.n(3) Point3D(2.29, 0, -1.35) The random point can be moved to lie on the circle of radius 1 centered on p1: >>> c = p.p1 + (r - p.p1).unit >>> c.distance(p.p1).equals(1) True Nrprr )�random�RandomrNr�gaussrOrRrT)rZ�seed�rng�paramss r(� random_pointzPlane.random_points���0 � ��-��%�%�C�C��C� �q��#�)�)�A�q�/�/�*�*�*�Q�.� �q��#�)�)�A�q�/�/�*�*�*�Q�.�0���#�#�A�q�)�)�.�.�v�6�6�6r*c��t|t��st||j���}t|t��st d���||jkr|St|t ��rD|�B|�|��|jz }|||jz jz }t||d���}ngt|t ��rCt|t ��r.|�||��}t||z ||fd���}nt d���|st dt|��z���|dS) a~Return the parameter(s) corresponding to the given point. Examples ======== >>> from sympy import pi, Plane >>> from sympy.abc import t, u, v >>> p = Plane((2, 0, 0), (0, 0, 1), (0, 1, 0)) By default, the parameter value returned defines a point that is a distance of 1 from the Plane's p1 value and in line with the given point: >>> on_circle = p.arbitrary_point(t).subs(t, pi/4) >>> on_circle.distance(p.p1) 1 >>> p.parameter_value(on_circle, t) {t: pi/4} Moving the point twice as far from p1 does not change the parameter value: >>> off_circle = p.p1 + (on_circle - p.p1)*2 >>> off_circle.distance(p.p1) 2 >>> p.parameter_value(off_circle, t) {t: pi/4} If the 2-value parameter is desired, supply the two parameter symbols and a replacement dictionary will be returned: >>> p.parameter_value(on_circle, u, v) {u: sqrt(10)/10, v: sqrt(10)/30} >>> p.parameter_value(off_circle, u, v) {u: sqrt(10)/5, v: sqrt(10)/15} r0zother must be a pointNT)rWzexpecting 1 or 2 symbolszGiven point is not on %sr) rQrr�ambient_dimensionr:rErrRr�rr )rZ�otherr|r}�delta�eqr�rjs r(�parameter_valuezPlane.parameter_value:sI��L�%��0�0� =��%�T�%;�<�<�<�E��%��'�'� 6��4�5�5� 5� �D�G� � ��L� �a�� � � 9�Q�Y��(�(��+�+�d�g�5�E��%�$�'�/�/�/�B���A�D�)�)�)�C�C� ��6� "� "� 9�z�!�V�'<�'<� 9��%�%�a��+�+�B���U� �Q��F��6�6�6�C�C��7�8�8� 8�� K��7�)�D�/�/�I�J�J� J��1�v� r*c��|jjSr5)rEr�r�s r(r�zPlane.ambient_dimensionss ���w�(�(r*)NN)r`)NNNr5)�__name__� __module__� __qualname__�__doc__rCr_rlrxrR� staticmethodr�r�rUrMr�r�r�r��propertyr2rEr�r�r�r�r�r�r�r�rdr*r(r-r-s���������4H�H�H�H�. � � �@�@�@�@�,!�,!�,!�^7�7�7�7�t�.�.��\�.�b4�4�4�n���40�0�0�0�,QD�QD�QD�h?�?�?�2%�%�%�P&�&�&�P����X��"����X��(*�*�*�4-�-�-�2@!�@!�@!�D1#�1#�1#�f%R�%R�%R�N7�7�7�7�B7�7�7�7�r�)�)��X�)�)�)r*r-)3r�� sympy.corerrrr�sympy.core.symbolr�(sympy.functions.elementary.trigonometricrr r r r �entityrr�rrrrrrrr�pointrr�sympy.matricesr�sympy.polys.polytoolsr� sympy.solversrr�sympy.utilities.iterablesrr�sympy.utilities.miscrr r!�mpmath.libmp.libmpfr"r��rangerNrOrPrSr-rdr*r(�<module>r�s�����2�1�1�1�1�1�1�1�1�1�1�1�%�%�%�%�%�%�O�O�O�O�O�O�O�O�O�O�O�O�O�O�"�"�"�"�"�"�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�!�!�!�!�!�!�!�!�!�!�!�!�!�!�(�(�(�(�(�(�)�)�)�)�)�)�)�)�7�7�7�7�7�7�7�7�C�C�C�C�C�C�C�C�C�C�+�+�+�+�+�+� � � � �6� 5�E�E�!�H�H� 5� 5� 5� ��1�a��W )�W )�W )�W )�W )�N�W )�W )�W )�W )�W )r*
Memory