Ë
    JÿiŒ ã                  ó  — U d Z ddlmZ ddlZddlZddlZddlZddlZ	ddl
mZmZmZmZ ddlmZmZmZmZ ddlmZmZ ddlmZ ddlmZmZ ddlmZ dd	lm Z  dd
l!m"Z"m#Z# ddl$m%Z%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z, ddl-m.Z.m/Z/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z> ddl?m@Z@ ddlAmBZBmCZC ddlDmEZE ddlFmGZGmHZHmIZImJZJmKZK ddlLmMZMmNZNmOZOmPZPmQZQ erddlRmSZSmTZTmUZUmVZV  ej®                  d«      j±                   ej²                  «       «        ej®                  d«      ZZdZ[dZ\edz  Z]dez  Z^d„ Z_ G d„ d«      Z`e`eaebebf   z  eaebebebf   z  eeb   z  Zcdedd <   	  G d!„ d"ee«      Zf G d#„ d$ef¬%«      Zg G d&„ d'«      Zh G d(„ d)«      Zi G d*„ d+«      Zj G d,„ d-ejÖ                  «      Zl G d.„ d/«      Zm G d0„ d1ej«      ZnenZoeneaebebebf   z  Zpdedd2<   	  G d3„ d4ej«      Zq G d5„ d6«      Zr G d7„ d8ee«      Zs G d9„ d:es¬%«      Zt	 d<	 	 	 	 	 	 	 	 	 d=d;„Zuy)>a  
build123d geometry

name: geometry.py
by:   Gumyr
date: March 2nd, 2023

desc:
    This python module contains geometric objects used by the topology.py
    module to form the build123d direct api.

license:

    Copyright 2023 Gumyr

    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.

é    )ÚannotationsN)ÚdegreesÚpiÚradiansÚisclose)ÚAnyÚoverloadÚ	TypeAliasÚTYPE_CHECKING)ÚIterableÚSequence)ÚBnd_BoxÚBnd_OBB)Ú	BRep_Tool)Ú
BRepBndLib)ÚBRepBuilderAPI_MakeFaceÚBRepBuilderAPI_Transform)Ú	BRepGPropÚBRepGProp_Face)Ú	BRepTools)ÚGeom_BoundedSurfaceÚ	Geom_LineÚ
Geom_Plane)ÚGeomAPI_ProjectPointOnSurfÚGeomAPI_IntCSÚGeomAPI_IntSS)Úgp_Ax1Úgp_Ax2Úgp_Ax3Úgp_DirÚgp_EulerSequenceÚgp_GTrsfÚgp_LinÚgp_PlnÚgp_PntÚgp_QuaternionÚgp_TrsfÚgp_VecÚgp_XYZ)ÚGProp_GProps)ÚQuantity_ColorÚQuantity_ColorRGBA)ÚTopLoc_Location)ÚTopoDSÚTopoDS_EdgeÚTopoDS_FaceÚTopoDS_ShapeÚTopoDS_Vertex)ÚAlignÚAlign2DTypeÚAlign3DTypeÚ	IntrinsicÚ	Extrinsicé   )ÚEdgeÚFaceÚShapeÚVertexÚ	build123dç�íµ ÷Æ°>g{®Gáz„?ç     €f@é´   c                 ó®  — d\  }}}}}| r¢t        | d   t        «      r| d   }n‰t        | d   t        «      r| d   }npt        | d   t        «      r| d   }nWt        | d   t        t
        f«      rt	        | d   «      }n/t        | d   d«      r| d   }nt        dt        | d   «      › �«      ‚dj                  t        |j                  «       «      j                  g d¢«      «      }|rt        d|› �«      ‚|j                  d|«      }|j                  d	|«      }|j                  d
|«      }|j                  d|«      }|j                  d|«      }|||||fS )N)NNNNNr   ÚwrappedzUnexpected argument type ú, )ÚaxisÚplaneÚlocationÚvectorÚshapeúUnexpected argument(s) rD   rE   rG   rF   rH   )Ú
isinstanceÚAxisÚPlaneÚLocationÚVectorÚtupleÚhasattrÚ
ValueErrorÚtypeÚjoinÚsetÚkeysÚ
differenceÚget)ÚargsÚkwargsrD   rE   rG   rF   rH   Úunknown_argss           úc/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/build123d/geometry.pyÚ_parse_intersect_argsr\   `   sL  € Ø+6Ñ(€Dˆ%�˜ 5áÜ�d˜1‘gœtÔ$Ø˜‘7‰DÜ˜˜Q™¤Ô'Ø˜‘G‰EÜ˜˜Q™¤Ô*Ø˜A‘w‰HÜ˜˜Q™¤&¬% Ô1Ü˜D ™G“_‰FÜ�T˜!‘W˜iÔ(Ø˜‘G‰EäÐ8¼¸dÀ1¹g»¸ÐHÓIÐIà—9‘9ÜˆF�K‰K‹MÓ×%Ñ%Ò&VÓWó€Lñ ÜÐ2°<°.ÐAÓBÐBà�:‰:�f˜dÓ#€DØ�J‰J�w Ó&€EØ�Z‰Z˜ &Ó)€FØ�z‰z˜* hÓ/€HØ�J‰J�w Ó&€Eà�˜ ¨%Ð/Ð/ó    c                  óÆ  — e Zd ZU dZded<   dZed=d„«       Zed>d„«       Zed?d„«       Zed@d„«       ZedAd	„«       Zed
„ «       Zd„ Zd„ Zd„ Z	e
dBd„«       Zej                  dCd„«       Ze
dBd„«       Zej                  dCd„«       Ze
dBd„«       Zej                  dCd„«       Ze
dDd„«       ZdEd„Ze
dBd„«       ZdFd„ZdGd„ZdHd„ZdHd„ZdHd„ZdHd„ZdFd„ZdId„ZdId„ZdJd „ZdId!„ZdKd"„ZdKd#„ZdKd$„ZdGd%„Z dLdMd'„Z!dNd(„Z"dOd)„Z#dOd*„Z$dPd+„Z%dKd,„Z&dBd-„Z'dQd.„Z(dRd/„Z)e)Z*dSd0„Z+dTd1„Z,dKd2„Z-dKd3„Z.dUd4„Z/dVd5„Z0dWdXd6„Z1dYd7„Z2edZd8„«       Z3ed[d9„«       Z3ed\d:„«       Z3ed]d;„«       Z3d<„ Z3y&)^rN   aÎ  Create a 3-dimensional vector

    Args:
        x (float): x component
        y (float): y component
        z (float): z component
        vec (Vector |  Sequence(float) |  gp_Vec |  gp_Pnt |  gp_Dir |  gp_XYZ): vector
            representations

    Note that if no z value is provided it's assumed to be zero. If no values are provided
    the returned Vector has the value of 0, 0, 0.

    Attributes:
        wrapped (gp_Vec): the OCP vector object

    r(   Ú_wrappedr   c                 ó   — y ©N© ©ÚselfÚXÚYÚZs       r[   Ú__init__zVector.__init__–   ó   € àr]   c                 ó   — y ra   rb   )rd   re   rf   s      r[   rh   zVector.__init__š   ri   r]   c                 ó   — y ra   rb   ©rd   Úvs     r[   rh   zVector.__init__ž   ri   r]   c                 ó   — y ra   rb   rl   s     r[   rh   zVector.__init__¢   ri   r]   c                 ó   — y ra   rb   rl   s     r[   rh   zVector.__init__¦   ri   r]   c                 ó   — y ra   rb   ©rd   s    r[   rh   zVector.__init__ª   ri   r]   c           	     óR  ‡— d| _         d\  }}}}dj                  t        |j                  «       «      j	                  g d¢«      «      }|rt        d|› �«      ‚‰r[t        ˆfd„t        t        ‰«      «      D «       «      r5t        ‰«      }|dgt        ddt        ‰«      z
  «      z  z  }|dd \  }}}�n|t        ‰«      d	k(  sd
|v �ri‰r‰d   nd }	|j                  d
|	«      }	t        |	t        «      r%t        |	j                  j!                  «       «      }�nt#        |	d«      rSt        |	j                  t$        «      r9t'        j(                  |	j                  «      }
t        |
j!                  «       «      }nºt        |	t*        t,        f«      rH	 |	D �cg c]  }t/        |«      ‘Œ }}t        |«      dk  r|dgdt        |«      z
  z  z  }t        |dd Ž }n\t        |	t        t2        t4        f«      rt        |	j!                  «       «      }n't        |	t6        «      rt        |	«      }nt1        d«      ‚|j                  d|«      }|j                  d|«      }|j                  d|«      }|€t        |||«      n|}|| _        y c c}w # t0        t
        f$ r}t1        d«      |‚d }~ww xY w)Nr   ©r   r   r   NrC   )rm   re   rf   rg   rI   c              3  óP   •K  — | ]  }t        ‰|   t        t        f«      –— Œ y ­wra   ©rJ   ÚintÚfloat)Ú.0ÚirX   s     €r[   Ú	<genexpr>z"Vector.__init__.<locals>.<genexpr>¶   s#   øè ø€ ÐTÑCS¸aœ
 4¨¡7¬S´%¨L×9ÑCSùs   ƒ#&ç        é   r8   rm   rB   zExpected floatsz%Expected floats, OCC gp_, or iterablere   rf   rg   )Úvector_indexrS   rT   rU   rV   rQ   ÚallÚrangeÚlenÚlistÚmaxrW   rJ   rN   r(   rB   ÚXYZrP   r2   r   ÚPnt_srO   r   rw   Ú	TypeErrorr%   r    r)   r_   )rd   rX   rY   ÚxÚyÚzÚocp_vecrZ   ÚvaluesÚ	first_argÚ
geom_pointÚvalueÚexcs    `           r[   rh   zVector.__init__®   sT  ø€ ØˆÔØ(Ñˆˆ1ˆa�à—y‘y¤ V§[¡[£]Ó!3×!>Ñ!>Ò?SÓ!TÓUˆÙÜÐ6°|°nÐEÓFÐFá”CÓTÄ5ÌÈTËÔCSÓTÔTÜ˜$“ZˆFØ�s�eœc ! a¬#¨d«)¡mÓ5Ñ5Ñ5ˆFØ˜Q˜q�k‰GˆAˆq’!Ü�‹Y˜!Š^˜s fš}Ù#'˜˜Qš¨TˆIØŸ
™
 3¨	Ó2ˆIÜ˜)¤VÔ,Ü  ×!2Ñ!2×!6Ñ!6Ó!8Ó9’Ü˜ IÔ.´:Ø×!Ñ!¤=ô4ô 'Ÿ_™_¨Y×->Ñ->Ó?�
Ü  §¡Ó!1Ó2‘Ü˜I¬¬xÐ'8Ô9ð@Ù8AÓB¹	¨uœe E�l¸	�FÐBô �v“; ’?Ø˜s˜e q¬3¨v«;¡Ñ7Ñ7�FÜ  &¨¨1 +Ð.‘Ü˜I¬´¼Ð'?Ô@Ü  §¡£Ó1‘Ü˜I¤vÔ.Ü  Ó+‘äÐ GÓHÐHØ�J‰J�s˜AÓˆØ�J‰J�s˜AÓˆØ�J‰J�s˜AÓˆØ%, _”&˜˜A˜q”/¸'ˆàˆ�ùò# CøÜ!¤:Ð.ò @Ü#Ð$5Ó6¸CÐ?ûð@ús*   ÆJ ÆJÆ%J ÊJ ÊJ&ÊJ!Ê!J&c                ó   — d| _         | S ©zInitialize to beginningr   )r}   rq   s    r[   Ú__iter__zVector.__iter__Ù   s   € àˆÔØˆr]   c                ó:  — | j                   dk(  r#| xj                   dz  c_         | j                  }|S | j                   dk(  r#| xj                   dz  c_         | j                  }|S | j                   dk(  r#| xj                   dz  c_         | j                  }|S t        ‚)úreturn the next valuer   r8   é   )r}   re   rf   rg   ÚStopIteration©rd   r�   s     r[   Ú__next__zVector.__next__Þ   s›   € à×Ñ Ò!Ø×Ò Ñ"ÕØ—F‘FˆEð ˆð ×Ñ !Ò#Ø×Ò Ñ"ÕØ—F‘FˆEð ˆð ×Ñ !Ò#Ø×Ò Ñ"ÕØ—F‘FˆEð ˆô  Ðr]   c                ó6   — | j                   j                  «       S )zGet x value)rB   re   rq   s    r[   re   zVector.Xí   ó   € ð �|‰|�~‰~ÓÐr]   c                ó:   — | j                   j                  |«       y)zSet x valueN)rB   ÚSetXr–   s     r[   re   zVector.Xò   ó   € ð 	�‰×Ñ˜%Õ r]   c                ó6   — | j                   j                  «       S )zGet y value)rB   rf   rq   s    r[   rf   zVector.Y÷   r™   r]   c                ó:   — | j                   j                  |«       y)zSet y valueN)rB   ÚSetYr–   s     r[   rf   zVector.Yü   rœ   r]   c                ó6   — | j                   j                  «       S )zGet z value)rB   rg   rq   s    r[   rg   zVector.Z  r™   r]   c                ó:   — | j                   j                  |«       y)zSet z valueN)rB   ÚSetZr–   s     r[   rg   zVector.Z  rœ   r]   c                ó   — | j                   S )zOCCT object)r_   rq   s    r[   rB   zVector.wrapped  s   € ð �}‰}Ðr]   c                óH   — | j                   | j                  | j                  fS )zReturn tuple equivalent©re   rf   rg   rq   s    r[   Úto_tuplezVector.to_tuple  s   € à—‘˜Ÿ™ §¡Ð'Ð'r]   c                ó6   — | j                   j                  «       S )zVector length)rB   Ú	Magnituderq   s    r[   ÚlengthzVector.length  s   € ð �|‰|×%Ñ%Ó'Ð'r]   c                ó^   — t        | j                  j                  |j                  «      «      S )zMathematical cross function)rN   rB   ÚCrossed©rd   Úvecs     r[   ÚcrosszVector.cross  s    € ä�d—l‘l×*Ñ*¨3¯;©;Ó7Ó8Ð8r]   c                óL   — | j                   j                  |j                   «      S )zMathematical dot function)rB   ÚDotr¬   s     r[   Údotz
Vector.dot  s   € à�|‰|×Ñ §¡Ó,Ð,r]   c                ó*  — t        |t        «      r0t        | j                  j                  |j                  «      «      }|S t        |t        «      r9t        | j                  j                  t        |«      j                  «      «      }|S t        d«      ‚)z!Mathematical subtraction functionz5Only Vectors or tuples can be subtracted from Vectors)rJ   rN   rB   Ú
SubtractedrO   rQ   ©rd   r­   Úresults      r[   Úsubz
Vector.sub!  st   € ä�cœ6Ô"Ü˜DŸL™L×3Ñ3°C·K±KÓ@ÓAˆFð ˆô ˜œUÔ#Ü˜DŸL™L×3Ñ3´F¸3³K×4GÑ4GÓHÓIˆFð ˆô ÐTÓUÐUr]   c                ó$   — | j                  |«      S )z#Mathematical subtraction operator -)r¶   r¬   s     r[   Ú__sub__zVector.__sub__,  ó   € à�x‰x˜‹}Ðr]   c                ó*  — t        |t        «      r0t        | j                  j                  |j                  «      «      }|S t        |t        «      r9t        | j                  j                  t        |«      j                  «      «      }|S t        d«      ‚)zMathematical addition functionz.Only Vectors or tuples can be added to Vectors)rJ   rN   rB   ÚAddedrO   rQ   r´   s      r[   Úaddz
Vector.add0  st   € ä�cœ6Ô"Ü˜DŸL™L×.Ñ.¨s¯{©{Ó;Ó<ˆFð ˆô ˜œUÔ#Ü˜DŸL™L×.Ñ.¬v°c«{×/BÑ/BÓCÓDˆFð ˆô ÐMÓNÐNr]   c                ó$   — | j                  |«      S )z Mathematical addition operator +)r¼   r¬   s     r[   Ú__add__zVector.__add__;  r¹   r]   c                óL   — |dk(  rt        ddd«      n|}| j                  |«      S )z(Mathematical reverse addition operator +r   )rN   r¼   r¬   s     r[   Ú__radd__zVector.__radd__?  s%   € à!$¨¢Œf�Q˜˜1Œo¨sˆØ�x‰x˜‹}Ðr]   c                óJ   — t        | j                  j                  |«      «      S )zMathematical multiply function)rN   rB   Ú
Multiplied©rd   Úscales     r[   ÚmultiplyzVector.multiplyD  s   € ä�d—l‘l×-Ñ-¨eÓ4Ó5Ð5r]   c                ó$   — | j                  |«      S ©z Mathematical multiply operator *©rÅ   rÃ   s     r[   Ú__mul__zVector.__mul__H  ó   € à�}‰}˜UÓ#Ð#r]   c                ó*   — | j                  d|z  «      S )z Mathematical division operator /ç      ð?rÈ   )rd   Údenoms     r[   Ú__truediv__zVector.__truediv__L  s   € à�}‰}˜S 5™[Ó)Ð)r]   c                ó$   — | j                  |«      S rÇ   rÈ   rÃ   s     r[   Ú__rmul__zVector.__rmul__P  rÊ   r]   c                óH   — t        | j                  j                  «       «      S )zScale to length of 1)rN   rB   Ú
Normalizedrq   s    r[   Ú
normalizedzVector.normalizedT  s   € ä�d—l‘l×-Ñ-Ó/Ó0Ð0r]   c                ó   — | dz  S )zNReturn a vector with the same magnitude but pointing in the opposite directionç      ð¿rb   rq   s    r[   ÚreversezVector.reverseX  s   € à�d‰{Ðr]   c                ó   — | S )zøcenter

        Returns:
          The center of myself is myself.
          Provided so that vectors, vertices, and other shapes all support a
          common interface, when center() is requested for all objects on the
          stack.

        rb   rq   s    r[   ÚcenterzVector.center\  s	   € ð ˆr]   c                óZ   — | j                   j                  |j                   «      t        z  S )zUnsigned angle between vectors©rB   ÚAngleÚRAD2DEGr¬   s     r[   Ú	get_anglezVector.get_angleh  s    € à�|‰|×!Ñ! #§+¡+Ó.´Ñ8Ð8r]   Nc                ó”   — |€t        ddd«      }n|j                  }| j                  j                  |j                  |«      t        z  S )u~  Signed Angle Between Vectors

        Return the signed angle in degrees between two vectors with the given normal
        based on this math: angle = atan2((Va Ã— Vb) â‹… Vn, Va â‹… Vb)

        Args:
            v (Vector): Second Vector
            normal (Vector, optional): normal direction. Defaults to None.

        Returns:
            float: Angle between vectors
        r   éÿÿÿÿ)r(   rB   ÚAngleWithRefrÜ   )rd   r­   ÚnormalÚ	gp_normals       r[   Úget_signed_anglezVector.get_signed_anglel  s@   € ð ˆ>Ü˜q ! RÓ(‰IàŸ™ˆIØ�|‰|×(Ñ(¨¯©°iÓ@Ä7ÑJÐJr]   c                óN   — |j                   }|| j                  |«      ||z  z  z  S )zûReturns a new vector equal to the projection of this Vector onto the line
        represented by Vector <line>

        Args:
            line (Vector): project to this line

        Returns:
            Vector: Returns the projected vector.

        )r©   r±   )rd   ÚlineÚline_lengths      r[   Úproject_to_linezVector.project_to_line  s*   € ð —k‘kˆà�t—x‘x “~¨°{Ñ)BÑCÑDÐDr]   c                óT   — |j                   j                  | j                  «       «      S )z2Minimum unsigned distance between vector and plane)rB   ÚDistanceÚto_pnt©rd   rE   s     r[   Údistance_to_planezVector.distance_to_planeŽ  s   € à�}‰}×%Ñ% d§k¡k£mÓ4Ð4r]   c                óR   — | |j                   z
  j                  |j                  «      S )z+Signed distance from plane to point vector.)Úoriginr±   Úz_dirrë   s     r[   Úsigned_distance_from_planez!Vector.signed_distance_from_plane’  s    € à�u—|‘|Ñ#×(Ñ(¨¯©Ó5Ð5r]   c                ó†   — |j                   }|j                  }| || |z
  j                  |«      |j                  dz  z  z  z
  S )z¼Vector is projected onto the plane provided as input.

        Args:
          args: Plane object

        Returns the projected vector.
          plane: Plane:

        Returns:

        r”   )rî   rï   r±   r©   )rd   rE   Úbaserá   s       r[   Úproject_to_planezVector.project_to_plane–  sC   € ð �|‰|ˆØ—‘ˆà�f $¨¡+×!2Ñ!2°6Ó!:¸f¿m¹mÈQÑ>NÑ NÑOÑOÐOr]   c                ó   — | dz  S )z#Flip direction of vector operator -rß   rb   rq   s    r[   Ú__neg__zVector.__neg__§  s   € à�b‰yÐr]   c                ó   — | j                   S )zVector length operator abs())r©   rq   s    r[   Ú__abs__zVector.__abs__«  s   € à�{‰{Ðr]   c                ó$   — | j                  |«      S ©zintersect vector with other &©Ú	intersect©rd   Úothers     r[   Ú__and__zVector.__and__¯  ó   € à�~‰~˜eÓ$Ð$r]   c                óX  — t        | j                  «      t        kD  rt        | j                  d«      nd}t        | j                  «      t        kD  rt        | j                  d«      nd}t        | j
                  «      t        kD  rt        | j
                  d«      nd}d|d›d|d›d|d›d�S )zDisplay vectoré   r{   zVector(z.14grC   Ú))Úabsre   Ú	TOLERANCEÚroundrf   rg   )rd   r†   r‡   rˆ   s       r[   Ú__repr__zVector.__repr__³  s†   € ä!$ T§V¡V£¬yÒ!8ŒE�$—&‘&˜"Ô¸cˆÜ!$ T§V¡V£¬yÒ!8ŒE�$—&‘&˜"Ô¸cˆÜ!$ T§V¡V£¬yÒ!8ŒE�$—&‘&˜"Ô¸cˆØ˜˜4˜  1 T (¨"¨Q¨t¨H°AÐ6Ð6r]   c                ó|   — t        |t        «      st        S | j                  j	                  |j                  dd«      S )zVectors equal operator ==çñhãˆµøä>)rJ   rN   ÚNotImplementedrB   ÚIsEqualrü   s     r[   Ú__eq__zVector.__eq__¼  s/   € ä˜%¤Ô(Ü!Ð!Ø�|‰|×#Ñ# E§M¡M°7¸GÓDÐDr]   c                ó–   — t        t        | j                  d«      t        | j                  d«      t        | j                  d«      f«      S )zHash of Vectoré   )Úhashr  re   rf   rg   rq   s    r[   Ú__hash__zVector.__hash__Â  s5   € ä”U˜4Ÿ6™6 1Ó%¤u¨T¯V©V°QÓ'7¼¸t¿v¹vÀqÓ9IÐJÓKÐKr]   c                óX   — t        | j                  | j                  | j                  «      S ©zReturn copy of self©rN   re   rf   rg   rq   s    r[   Ú__copy__zVector.__copy__Æ  ó   € ä�d—f‘f˜dŸf™f d§f¡fÓ-Ð-r]   c                óX   — t        | j                  | j                  | j                  «      S ©zReturn deepcopy of selfr  ©rd   Ú_memos     r[   Ú__deepcopy__zVector.__deepcopy__Ê  r  r]   c                óH   — t        | j                  j                  «       «      S )zConvert to OCCT gp_Pnt object)r%   rB   rƒ   rq   s    r[   rê   zVector.to_pntÎ  ó   € ä�d—l‘l×&Ñ&Ó(Ó)Ð)r]   c                óH   — t        | j                  j                  «       «      S )zConvert to OCCT gp_Dir object)r    rB   rƒ   rq   s    r[   Úto_dirzVector.to_dirÒ  r  r]   c                óz  — |s]| j                  «       }|j                  |j                  j                  «       «      }t	        t        |j                  «       «      «      }|S | j                  «       }|j                  |j                  j                  «       «      }t	        t        |j                  «       «      «      }|S )a;  Apply affine transformation

        Args:
            affine_transform (Matrix): affine transformation matrix
            is_direction (bool, optional): Should self be transformed as a vector or direction?
                Defaults to False (vector)

        Returns:
            Vector: transformed vector
        )rê   ÚTransformedrB   ÚTrsfrN   r(   rƒ   r  )rd   Úaffine_transformÚis_directionÚpntÚpnt_tÚreturn_valueÚdirÚdir_ts           r[   Ú	transformzVector.transformÖ  s•   € ñ ð —+‘+“-ˆCØ—O‘OÐ$4×$<Ñ$<×$AÑ$AÓ$CÓDˆEÜ!¤&¨¯©«Ó"5Ó6ˆLð Ðð —+‘+“-ˆCØ—O‘OÐ$4×$<Ñ$<×$AÑ$AÓ$CÓDˆEÜ!¤&¨¯©«Ó"5Ó6ˆLØÐr]   c                ót   — t        | j                  j                  |j                  t        |z  dz  «      «      S )zðRotate about axis

        Rotate about the given Axis by an angle in degrees

        Args:
            axis (Axis): Axis of rotation
            angle (float): angle in degrees

        Returns:
            Vector: rotated vector
        r@   )rN   rB   ÚRotatedr   )rd   rD   Úangles      r[   ÚrotatezVector.rotateî  s-   € ô �d—l‘l×*Ñ*¨4¯<©<¼¸e¹ÀcÑ9IÓJÓKÐKr]   c                 ó   — y)z&Find intersection of vector and vectorNrb   ©rd   rG   s     r[   rû   zVector.intersectü  ó   � r]   c                 ó   — y)z(Find intersection of location and vectorNrb   ©rd   rF   s     r[   rû   zVector.intersect   r/  r]   c                 ó   — y)z$Find intersection of axis and vectorNrb   ©rd   rD   s     r[   rû   zVector.intersect  r/  r]   c                 ó   — y)z%Find intersection of plane and vectorNrb   rë   s     r[   rû   zVector.intersect  r/  r]   c                óÐ   — t        |i |¤Ž\  }}}}}|�|j                  | «      S |�|j                  | «      S |�| |k(  r|S |�|j                  | «      S |�|j                  | «      S y ra   )r\   rû   ©rd   rX   rY   rD   rE   rG   rF   rH   s           r[   rû   zVector.intersect  sˆ   € Ü/DÀdÐ/UÈfÑ/UÑ,ˆˆe�V˜X uàÐØ—>‘> $Ó'Ð'àÐØ—?‘? 4Ó(Ð(àÐ $¨&¢.ØˆMàÐØ×%Ñ% dÓ+Ð+àÐØ—?‘? 4Ó(Ð(ð r]   ©re   rw   rf   rw   rg   rw   )re   rw   rf   rw   )rm   rN   )rm   úSequence[float])rm   z!gp_Vec | gp_Pnt | gp_Dir | gp_XYZ©Úreturnrw   )r�   rw   r:  ÚNone)r:  r(   )r:  ztuple[float, float, float])r­   rN   r:  rN   )r­   rN   r:  rw   )r­   Ú
VectorLiker:  rN   )rÄ   rw   r:  rN   )rÍ   rw   r:  rN   ©r:  rN   ra   )r­   rN   rá   úVector | Noner:  rw   )rå   rN   r:  rN   )rE   rL   r:  rw   )rE   rL   r:  rN   )rý   ú,Axis | Location | Plane | VectorLike | Shape©r:  Ústr©rý   Úobjectr:  Úbool)r:  rv   )r:  r%   )r:  r    )F)r!  ÚMatrixr"  rD  r:  rN   )rD   rK   r+  rw   r:  rN   ©rG   r<  r:  r>  )rF   rM   r:  r>  )rD   rK   r:  r>  )rE   rL   r:  r>  )4Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__Ú_dimr	   rh   r‘   r—   Úpropertyre   Úsetterrf   rg   rB   r¦   r©   r®   r±   r¶   r¸   r¼   r¾   rÀ   rÅ   rÉ   rÎ   rÐ   rÓ   rÖ   rØ   rÝ   rã   rç   rì   rð   ró   rõ   r÷   rþ   r  Ú__str__r  r  r  r  rê   r  r(  r,  rû   rb   r]   r[   rN   rN   €   sM  … ñð$ ÓØ€Dàòó ðð òó ðð òó ðð òó ðð òó ðð ñó ðò) òVò
ð ò ó ð ð ‡X�Xò!ó ð!ð ò ó ð ð ‡X�Xò!ó ð!ð ò ó ð ð ‡X�Xò!ó ð!ð òó ðó(ð ò(ó ð(ó9ó-ó	óó	óóó
6ó$ó*ó$ó1óó
ó9ôKó&Eó5ó6óPó"óó%ó7ð €GóEóLó.ó.ó*ó*ôó0Lð ò5ó ð5ð ò7ó ð7ð ò3ó ð3ð ò4ó ð4ó)r]   rN   r
   r<  c                  óF   — e Zd ZdZedd„«       Zedd„«       Zedd„«       Zy)ÚAxisMetaz*Axis meta class to enable class propertiesc                ó   —  | dd«      S )zX Axis©r   r   r   ©r8   r   r   rb   ©Úclss    r[   re   z
AxisMeta.X/  ó   € ñ �9˜iÓ(Ð(r]   c                ó   —  | dd«      S )zY AxisrS  ©r   r8   r   rb   rU  s    r[   rf   z
AxisMeta.Y4  rW  r]   c                ó   —  | dd«      S )zZ AxisrS  ©r   r   r8   rb   rU  s    r[   rg   z
AxisMeta.Z9  rW  r]   N©r:  rK   )rG  rH  rI  rJ  rM  re   rf   rg   rb   r]   r[   rQ  rQ  ,  s?   „ Ù4àò)ó ð)ð ò)ó ð)ð ò)ó ñ)r]   rQ  c                  óT  — e Zd ZdZdZedd„«       Zedd„«       Zed d„«       Zd„ Zed!d„«       Zd"d„Z	d"d	„Z
d#d
„Zd#d„Zd$d„Zd%d„Zd&d„Z	 	 d'	 	 	 	 	 	 	 d(d„Zd)d*d„Zd)d*d„Zd)d*d„Zd)d+d„Zd,d„Zd"d„Zd"d„Z	 	 	 	 d-d„Zed.d„«       Zed/d„«       Zed0d„«       Zed1d„«       Zd„ Zy)2rK   aŽ  Axis

    Axis defined by point and direction

    Args:
        origin (VectorLike): start point
        direction (VectorLike): direction
        edge (Edge): origin & direction defined by start of edge

    Attributes:
        position (Vector): the global position of the axis origin
        direction (Vector): the normalized direction vector
        wrapped (gp_Ax1): the OCP axis object
    r8   c                 ó   — y©zAxis: point and directionNrb   )rd   Úgp_ax1s     r[   rh   zAxis.__init__Q  r/  r]   c                 ó   — yr_  rb   )rd   rî   Ú	directions      r[   rh   zAxis.__init__U  r/  r]   c                 ó   — y)zAxis: start of EdgeNrb   )rd   Úedges     r[   rh   zAxis.__init__Y  r/  r]   c           	     óØ  — |j                  dd «      }|j                  dd «      }|j                  dd «      }|j                  dd «      }|r+t        ddj                  |j                  «       «      › �«      ‚t	        |«      dk(  r`t        |d   t        «      r|d   }nZt        |d   d	«      r2|d   j                  �#t        |d   j                  t        «      r|d   }n|d   }nt	        |«      d
k(  r|\  }}|�Òt        |d	«      r¸|j                  �¬t        |j                  t        «      r’|j                  }t        j                  |t        «       t        «       «      }t        j                  |«      \  }	}
t        «       }t        «       }|j!                  |	||«       t#        |«      }t#        t%        |«      «      }nt        d|› �«      ‚|�&t        |t        «      st        d|› �«      ‚|| _        nS	 t#        |«      }t#        |«      }t        |j)                  «       t%        t+        |j-                  «       «      Ž «      | _        t#        | j                  j/                  «       j1                  «       | j                  j/                  «       j3                  «       | j                  j/                  «       j5                  «       «      | _        t#        | j                  j9                  «       j1                  «       | j                  j9                  «       j3                  «       | j                  j9                  «       j5                  «       «      | _        y # t&        $ r}t        d«      |‚d }~ww xY w)Nr`  rî   rb  rd  úUnexpected argument(s): rC   r8   r   rB   r”   zInvalid argument zInvalid Axis parameter zInvalid Axis parameters)ÚpoprQ   rS   rU   r€   rJ   r   rP   rB   r/   r   ÚCurve_srw   ÚRange_sr%   r(   ÚD1rN   r    r…   rê   rO   rÓ   rM   re   rf   rg   ÚpositionÚ	Directionrb  )rd   rX   rY   r`  rî   rb  rd  Útopods_edgeÚcurveÚ	param_minÚ	param_maxÚ
origin_pntÚtangent_vecÚorigin_vectorÚdirection_vectorrŽ   s                   r[   rh   zAxis.__init__]  sÔ  € à—‘˜H dÓ+ˆØ—‘˜H dÓ+ˆØ—J‘J˜{¨DÓ1ˆ	Ø�z‰z˜& $Ó'ˆñ ÜÐ7¸¿	¹	À&Ç+Á+Ã-Ó8PÐ7QÐRÓSÐSäˆt‹9˜Š>Ü˜$˜q™'¤6Ô*Ø˜a™‘ä˜˜Q™ Ô+Ø˜‘G—O‘OÐ/Ü˜t A™wŸ™´Ô<à˜A‘w‘à˜a™‘Ü�‹Y˜!Š^Ø $ÑˆF�IàÐä˜˜iÔ(Ø—L‘LÐ,Ü˜tŸ|™|¬[Ô9ð ,0¯<©<�Ü!×)Ñ)¨+´u³wÄÃÓH�Ü'0×'8Ñ'8¸Ó'EÑ$�	˜9Ü#›X�
Ü$›h�Ø—‘˜ J°Ô<Ü 
Ó+�Ü"¤6¨+Ó#6Ó7‘	ä Ð#4°T°FÐ!;Ó<Ð<àÐÜ˜f¤fÔ-Ü Ð#:¸6¸(Ð!CÓDÐDØ#)ˆD�LðEÜ & v£�Ü#)¨)Ó#4Ð ô "Ø×$Ñ$Ó&ÜœÐ.×9Ñ9Ó;Ó<Ð=óˆDŒLô
 Ø�L‰L×!Ñ!Ó#×%Ñ%Ó'Ø�L‰L×!Ñ!Ó#×%Ñ%Ó'Ø�L‰L×!Ñ!Ó#×%Ñ%Ó'ó
ˆŒô
  Ø�L‰L×"Ñ"Ó$×&Ñ&Ó(Ø�L‰L×"Ñ"Ó$×&Ñ&Ó(Ø�L‰L×"Ñ"Ó$×&Ñ&Ó(ó
ˆ�øô ò EÜ Ð!:Ó;ÀÐDûðEús   Ç4M Í	M)ÍM$Í$M)c                óV   — t        t        | j                  | j                  ¬«      «      S )zReturn self as Location©rî   rï   )rM   rL   rk  rb  rq   s    r[   rF   zAxis.location£  s   € ô œ T§]¡]¸$¿.¹.ÔIÓJÐJr]   c                óB   — t        | j                  | j                  «      S r  ©rK   rk  rb  rq   s    r[   r  zAxis.__copy__¨  ó   € ä�D—M‘M 4§>¡>Ó2Ð2r]   c                óB   — t        | j                  | j                  «      S r  rx  r  s     r[   r  zAxis.__deepcopy__¬  ry  r]   c                ót   — d| j                   j                  «       › d| j                  j                  «       › d�S )úDisplay selfÚ(Ú,r  )rk  r¦   rb  rq   s    r[   r  zAxis.__repr__°  s3   € à�4—=‘=×)Ñ)Ó+Ð,¨A¨d¯n©n×.EÑ.EÓ.GÐ-HÈÐJÐJr]   c                óž   — t        | «      j                  › d| j                  j                  «       › d| j                  j                  «       › d�S )r|  z: (r~  r  )rR   rG  rk  r¦   rb  rq   s    r[   rO  zAxis.__str__´  sC   € ä�t“*×%Ñ%Ð& c¨$¯-©-×*@Ñ*@Ó*BÐ)CÀ1ÀTÇ^Á^×E\ÑE\ÓE^ÐD_Ð_`ÐaÐar]   c                ó–   — t        |t        «      st        S | j                  |j                  k(  xr | j                  |j                  k(  S ra   )rJ   rK   r	  rk  rb  rü   s     r[   r  zAxis.__eq__¸  s7   € Ü˜%¤Ô&Ü!Ð!Ø�}‰} §¡Ñ.ÒT°4·>±>ÀUÇ_Á_Ñ3TÐTr]   c                ó´   — | j                   €t        d«      ‚|j                   }| j                   }|j                  |j                  «       «      }t	        |«      S )zIrelocates self to a new location possibly changing position and directionzCan't located empty Axis)rB   rQ   r  ÚTransformationrK   )rd   Únew_locationÚtop_locationÚself_gp_ax1Ú
new_gp_ax1s        r[   ÚlocatedzAxis.located½  sP   € à�<‰<ÐÜÐ7Ó8Ð8Ø(4×(<Ñ(<ˆØ"Ÿl™lˆØ(×4Ñ4°\×5PÑ5PÓ5RÓSˆ
Ü�JÓÐr]   c                óD   — t        | j                  | j                  ¬«      S )zReturn self as Planerv  )rL   rk  rb  rq   s    r[   Úto_planezAxis.to_planeÆ  s   € ä˜DŸM™M°·±Ô@Ð@r]   c                ód   — | j                   j                  |j                   |t        dz  z  |«      S )aì  are axes coaxial

        True if the angle between self and other is lower or equal to angular_tolerance and
        the distance between self and other is lower or equal to linear_tolerance.

        Args:
            other (Axis): axis to compare to
            angular_tolerance (float, optional): max angular deviation. Defaults to 1e-5.
            linear_tolerance (float, optional): max linear deviation. Defaults to 1e-5.

        Returns:
            bool: axes are coaxial
        r@   )rB   Ú	IsCoaxialr   )rd   rý   Úangular_toleranceÚlinear_tolerances       r[   Ú
is_coaxialzAxis.is_coaxialÊ  s1   € ð& �|‰|×%Ñ%Ø�M‰MÐ,´°S±Ñ9Ð;Kó
ð 	
r]   c                ób   — | j                   j                  |j                   |t        dz  z  «      S )už  are axes normal

        Returns True if the direction of this and another axis are normal to each other. That is,
        if the angle between the two axes is equal to 90Â° within the angular_tolerance.

        Args:
            other (Axis): axis to compare to
            angular_tolerance (float, optional): max angular deviation. Defaults to 1e-5.

        Returns:
            bool: axes are normal
        r@   )rB   ÚIsNormalr   ©rd   rý   rŒ  s      r[   Ú	is_normalzAxis.is_normalá  s)   € ð �|‰|×$Ñ$ U§]¡]Ð4EÌÈcÉÑ4RÓSÐSr]   c                ób   — | j                   j                  |j                   |t        dz  z  «      S )u¹  are axes opposite

        Returns True if the direction of this and another axis are parallel with
        opposite orientation. That is, if the angle between the two axes is equal
        to 180Â° within the angular_tolerance.

        Args:
            other (Axis): axis to compare to
            angular_tolerance (float, optional): max angular deviation. Defaults to 1e-5.

        Returns:
            bool: axes are opposite
        r@   )rB   Ú
IsOppositer   r‘  s      r[   Úis_oppositezAxis.is_oppositeð  ó*   € ð �|‰|×&Ñ& u§}¡}Ð6GÌ2ÐPSÉ8Ñ6TÓUÐUr]   c                ób   — | j                   j                  |j                   |t        dz  z  «      S )uÔ  are axes parallel

        Returns True if the direction of this and another axis are parallel with same
        orientation or opposite orientation. That is, if the angle between the two axes is
        equal to 0Â° or 180Â° within the angular_tolerance.

        Args:
            other (Axis): axis to compare to
            angular_tolerance (float, optional): max angular deviation. Defaults to 1e-5.

        Returns:
            bool: axes are parallel
        r@   )rB   Ú
IsParallelr   r‘  s      r[   Úis_parallelzAxis.is_parallel   r–  r]   c                óZ  — | j                  ||«      rA| j                  |j                  z
  j                  | j                  «      }|j                  |kD  S | j                  |j                  z
  j                  | j                  j                  |j                  «      «      }t        |«      |kD  S )a(  are axes skew

        Returns True if this axis and another axis are skew, meaning they are neither
        parallel nor coplanar. Two axes are skew if they do not lie in the same plane
        and never intersect.

        Mathematically, this means:
        - The axes are **not parallel** (the cross product of their direction vectors
          is nonzero).
        - The axes are **not coplanar** (the vector between their positions is not
          aligned with the plane spanned by their directions).

        If either condition is false (i.e., the axes are parallel or coplanar), they are
        not skew.

        Args:
            other (Axis): axis to compare to
            tolerance (float, optional): max deviation. Defaults to 1e-5.

        Returns:
            bool: axes are skew
        )r™  rk  r®   rb  r©   r±   r  )rd   rý   Ú	toleranceÚparallel_offsetÚcoplanaritys        r[   Úis_skewzAxis.is_skew  s�   € ð. ×Ñ˜E 9Ô-à#Ÿ}™}¨u¯~©~Ñ=×DÑDÀTÇ^Á^ÓTˆOà"×)Ñ)¨IÑ5Ð5ð —}‘} u§~¡~Ñ5×:Ñ:Ø�N‰N× Ñ  §¡Ó1ó
ˆô
 �;Ó )Ñ+Ð+r]   c                óZ   — | j                   j                  |j                   «      t        z  S )u  calculate angle between axes

        Computes the angular value, in degrees, between the direction of self and other
        between 0Â° and 360Â°.

        Args:
            other (Axis): axis to compare to

        Returns:
            float: angle between axes
        rÚ   rü   s     r[   Úangle_betweenzAxis.angle_between5  s"   € ð �|‰|×!Ñ! %§-¡-Ó0´7Ñ:Ð:r]   c                óT   —  t        | «      | j                  j                  «       «      S )z1Return a copy of self with the direction reversed)rR   rB   ÚReversedrq   s    r[   rÖ   zAxis.reverseC  s    € àŒt�D‹z˜$Ÿ,™,×/Ñ/Ó1Ó2Ð2r]   c                ó"   — | j                  «       S )zFlip direction operator -)rÖ   rq   s    r[   rõ   zAxis.__neg__G  s   € à�|‰|‹~Ðr]   c                ó$   — | j                  |«      S rù   rú   rü   s     r[   rþ   zAxis.__and__K  ó   € ð �~‰~˜eÓ$Ð$r]   c                 ó   — y)z$Find intersection of vector and axisNrb   r.  s     r[   rû   zAxis.intersectQ  r/  r]   c                 ó   — y)z&Find intersection of location and axisNrb   r1  s     r[   rû   zAxis.intersectU  r/  r]   c                 ó   — y)z"Find intersection of axis and axisNrb   r3  s     r[   rû   zAxis.intersectY  r/  r]   c                 ó   — y)z#Find intersection of plane and axisNrb   rë   s     r[   rû   zAxis.intersect]  r/  r]   c                óØ  — t        |i |¤Ž\  }}}}}|��| j                  |«      r| S | j                  |«      ry t        j                  g | j
                  ¢«      }t        j                  g | j                  ¢«      }	t        j                  g |j
                  ¢«      }
t        j                  g |j                  ¢«      }t        j                  |	| t        j                  |	|«      g«      j                  }|
|z
  }t        j                  j                  ||d ¬«      d   \  }}}|||	z  z   }t        |Ž S |�|j                  | «      S |�M|| j
                  z
  }|j                  | j                  «      }| j                  |z  | j
                  z   }||k(  r|S |�At        |«      j                  }| j                  |j
                  «      �|| j                  k(  r|S |�|j                  | «      S y )N)Úrcondr   )r\   rŽ  rž  ÚnpÚarrayrk  rb  r®   ÚTÚlinalgÚlstsqrN   rû   r±   rL   rï   )rd   rX   rY   rD   rE   rG   rF   rH   Úp1Úd1Úp2Úd2Úsystem_of_equationsÚorigin_diffÚt1Út2Ú_Úintersection_pointÚvec_to_pointÚprojected_lengthÚprojected_vecÚlocation_dirs                         r[   rû   zAxis.intersecta  sØ  € Ü/DÀdÐ/UÈfÑ/UÑ,ˆˆe�V˜X uàÑØ�‰˜tÔ$Ø�à�|‰|˜DÔ!Øô —‘Ð*˜DŸM™MÐ*Ó+ˆBÜ—‘Ð+˜DŸN™NÐ+Ó,ˆBÜ—‘Ð*˜DŸM™MÐ*Ó+ˆBÜ—‘Ð+˜DŸN™NÐ+Ó,ˆBô #%§(¡(¨B°°´R·X±X¸bÀ"Ó5EÐ+FÓ"G×"IÑ"IÐØ˜r™'ˆKÜŸ	™	Ÿ™Ð(;¸[ÐPT˜ÓUÐVWÑX‰IˆB��Að "$ b¨2¡g¡ÐÜÐ-Ð.Ð.àÐØ—?‘? 4Ó(Ð(àÐà! D§M¡MÑ1ˆLð  ,×/Ñ/°·±Ó?ÐØ ŸN™NÐ-=Ñ=ÀÇÁÑMˆMð ˜Ò&Ø�àÐä  ›?×0Ñ0ˆLð —‘˜x×0Ñ0Ó1Ð=Ø  D§N¡NÒ2à�àÐØ—?‘? 4Ó(Ð(ð r]   N)r`  r   )rî   r<  rb  r<  )rd  r9   ©r:  rM   r\  r@  rB  )rƒ  rM   ©r:  rL   )r  r  )rý   rK   rŒ  rw   r�  rw   r:  rD  )r  )rý   rK   rŒ  rw   r:  rD  )rý   rK   r›  rw   r:  rD  )rý   rK   r:  rw   )rý   r?  r:  zVector | Location | Axis | NonerF  ©rF   rM   r:  úLocation | None)rD   rK   r:  úAxis | None©rE   rL   r:  rÃ  )rG  rH  rI  rJ  rL  r	   rh   rM  rF   r  r  r  rO  r  r‡  r‰  rŽ  r’  r•  r™  rž  r   rÖ   rõ   rþ   rû   rb   r]   r[   rK   rK   ?  sP  „ ñð €Dàò(ó ð(ð ò(ó ð(ð ò"ó ð"òD
ðL òKó ðKó3ó3óKóbóUó
 óAð $(Ø"&ð	
àð
ð !ð
ð  ð	
ð
 
ó
ô.TôVô Vô #,óJ;ó3óð%ØAð%à	(ó%ð ò3ó ð3ð ò5ó ð5ð ò1ó ð1ð ò2ó ð2ó4)r]   rK   )Ú	metaclassc                  óœ   — e Zd ZdZdd„Zedd„«       Zd„ Zdd„Z	 d	 	 	 	 	 dd„Z	e
dd„«       Ze	 	 	 d	 	 	 	 	 	 	 	 	 dd	„«       Zdd
„Zdd„Zy)ÚBoundBoxzA BoundingBox for a Shapec                ó  — |j                  «       r
d\  }}}}}}n|j                  «       \  }}}}}}|j                  «       rd n|| _        t        |||«      | _        t        |||«      | _        t        ||z
  ||z
  ||z
  «      | _        y )N)r   r   r   r   r   r   )ÚIsVoidÚGetrB   rN   Úminr‚   Úsize)rd   Úbounding_boxÚx_minÚy_minÚz_minÚx_maxÚy_maxÚz_maxs           r[   rh   zBoundBox.__init__›  s‹   € à×ÑÔ Ø7?Ñ4ˆE�5˜% ¨©uà7C×7GÑ7GÓ7IÑ4ˆE�5˜% ¨¨uØ+×2Ñ2Ô4‘t¸,ˆŒÜ˜% ¨Ó.ˆŒÜ˜% ¨Ó.ˆŒÜ˜5 5™=¨%°%©-¸À¹ÓGˆ�	r]   c                óV   — | j                   €y| j                   j                  «       dz  S )z/body diagonal length (i.e. object maximum size)r{   ç      à?©rB   ÚSquareExtentrq   s    r[   ÚdiagonalzBoundBox.diagonal¦  s)   € ð �<‰<ÐØØ�|‰|×(Ñ(Ó*¨cÑ1Ð1r]   c                ó  — d| j                   j                  › d| j                  j                  › d| j                   j                  › d| j                  j                  › d| j                   j                  › d| j                  j                  › �S )zDisplay bounding box parameterszbbox: z	 <= x <= rC   z	 <= y <= z	 <= z <= )rË  re   r‚   rf   rg   rq   s    r[   r  zBoundBox.__repr__­  se   € ð �T—X‘X—Z‘Z�L 	¨$¯(©(¯*©*¨°R¸¿¹¿
¹
°|À9ÈTÏXÉXÏZÉZÈLÐXZØ�x‰x�z‰zˆl˜) D§H¡H§J¡J <ð1ð	
r]   c                ó:   — | j                   | j                  z   dz  S )z!Return center of the bounding boxr”   )rË  r‚   rq   s    r[   rØ   zBoundBox.center´  s   € à—‘˜4Ÿ8™8Ñ# qÑ(Ð(r]   Nc                óâ  — |€t         n|}t        «       }|j                  |«       | j                  �|j	                  | j                  «       t        |t        «      r |j                  |Ž  t        |«      S t        |t        «      r( |j                  |j                  «       Ž  t        |«      S t        |t        «      r'|j                  �|j	                  |j                  «       t        |«      S )a  Returns a modified (expanded) bounding box

        obj can be one of several things:
            1. a 3-tuple corresponding to x,y, and z amounts to add
            2. a vector, containing the x,y,z values to add
            3. another bounding box, where a new box will be created that
               encloses both.

        This bounding box is not changed.

        Args:
          obj: tuple[float, float, float] | Vector | BoundBox]:
          tol: float:  (Default value = None)

        Returns:

        )ÚTOLr   ÚSetGaprB   ÚAddrJ   rO   ÚUpdaterN   r¦   rÇ  )rd   ÚobjÚtolÚtmps       r[   r¼   zBoundBox.add¸  sº   € ð. �[�c cˆä‹iˆØ�
‰
�3ŒØ�<‰<Ð#Ø�G‰G�D—L‘LÔ!ä�cœ5Ô!ØˆC�J‰J˜Ñô ˜‹}Ðô ˜œVÔ$ØˆC�J‰J˜Ÿ™›Ñ'ô ˜‹}Ðô ˜œXÔ&¨3¯;©;Ð+BØ�G‰G�C—K‘KÔ ä˜‹}Ðr]   c                óê  — | j                   j                  |j                   j                  k  r‹| j                  j                  |j                  j                  kD  r^| j                   j                  |j                   j                  k  r1| j                  j                  |j                  j                  kD  r| }|S |j                   j                  | j                   j                  k  r‹|j                  j                  | j                  j                  kD  r^|j                   j                  | j                   j                  k  r1|j                  j                  | j                  j                  kD  r|}|S d}|S )aÖ  Compares bounding boxes

        Compares bounding boxes. Returns none if neither is inside the other.
        Returns the outer one if either is outside the other.

        BoundBox.is_inside works in 3d, but this is a 2d bounding box, so it
        doesn't work correctly plus, there was all kinds of rounding error in
        the built-in implementation i do not understand.

        Args:
          bb1: BoundBox:
          bb2: BoundBox:

        Returns:

        N)rË  re   r‚   rf   )Úbb1Úbb2rµ   s      r[   Úfind_outside_box_2dzBoundBox.find_outside_box_2dß  sê   € ð( �G‰G�I‰I˜Ÿ™Ÿ	™	Ò!Ø—‘—	‘	˜CŸG™GŸI™IÒ%Ø—‘—	‘	˜CŸG™GŸI™IÒ%Ø—‘—	‘	˜CŸG™GŸI™IÒ%àˆFð ˆð �G‰G�I‰I˜Ÿ™Ÿ	™	Ò!Ø—‘—	‘	˜CŸG™GŸI™IÒ%Ø—‘—	‘	˜CŸG™GŸI™IÒ%Ø—‘—	‘	˜CŸG™GŸI™IÒ%àˆFð ˆð ˆFØˆr]   c                óV  — t        j                  |«       |€t        n|}t        «       }t	        «       }|r3|rt        j                  ||ddd«       nGt        j                  ||«       n0|rt        j                  ||«       nt        j                  ||d«       |r | |«      S  | |«      S )a  Constructs a bounding box from a TopoDS_Shape

        Args:
            shape: TopoDS_Shape:
            tolerance: float:  (Default value = None)
            optimal: bool:  This algorithm builds precise bounding box (Default value = True)

        Returns:

        FT)	r   ÚClean_srÜ  r   r   r   ÚAddOBB_sÚAddOptimal_sÚAdd_s)rV  rH   r›  ÚoptimalÚorientedÚbboxÚbbox_obbs          r[   Úfrom_topo_dszBoundBox.from_topo_ds  s”   € ô$ 	×Ñ˜%Ô à$Ð,•C°)ˆ	Ü‹yˆÜ“9ˆááÜ×#Ñ# E¨8°U¸DÀ%ÕHä×'Ñ'¨¨tÕ4ñ Ü×#Ñ# E¨8Õ4ä× Ñ  ¨¨dÔ3á (‰s�8‹}Ð7©c°$«iÐ7r]   c                ó4  — |j                   j                  | j                   j                  kD  xré |j                   j                  | j                   j                  kD  xrº |j                   j                  | j                   j                  kD  xr‹ |j                  j                  | j                  j                  k  xr\ |j                  j                  | j                  j                  k  xr- |j                  j                  | j                  j                  k   S )zpIs the provided bounding box inside this one?

        Args:
          b2: BoundBox:

        Returns:

        )rË  re   rf   rg   r‚   )rd   Ú
second_boxs     r[   Ú	is_insidezBoundBox.is_inside+  sÉ   € ð �N‰N×Ñ˜tŸx™xŸz™zÑ)ò .Ø—‘× Ñ  4§8¡8§:¡:Ñ-ò.à—‘× Ñ  4§8¡8§:¡:Ñ-ò.ð —‘× Ñ  4§8¡8§:¡:Ñ-ò.ð —‘× Ñ  4§8¡8§:¡:Ñ-ò	.ð
 —‘× Ñ  4§8¡8§:¡:Ñ-ð
ð 	
r]   c                ó|   — t        | j                  j                  «       | j                  j                  «       |«      S )ú6Amount to move object to achieve the desired alignment)Úto_align_offsetrË  r¦   r‚   )rd   Úaligns     r[   rö  zBoundBox.to_align_offset=  s+   € ä˜tŸx™x×0Ñ0Ó2°D·H±H×4EÑ4EÓ4GÈÓOÐOr]   )rÍ  r   r:  r;  r9  r=  ra   )rà  z.tuple[float, float, float] | Vector | BoundBoxrá  úfloat | Noner:  rÇ  )rä  rÇ  rå  rÇ  r:  zBoundBox | None)NTF)
rH   r1   r›  rø  rì  rD  rí  rD  r:  rÇ  )rò  rÇ  r:  rD  )r÷  úAlign2DType | Align3DTyper:  rN   )rG  rH  rI  rJ  rh   rM  rØ  r  rØ   r¼   Ústaticmethodræ  Úclassmethodrð  ró  rö  rb   r]   r[   rÇ  rÇ  ˜  sÀ   „ Ù#ó	Hð ò2ó ð2ò
ó)ð !ð%à;ð%ð ð%ð 
ó	%ðN ò"ó ð"ðH ð #'ØØð$8àð$8ð  ð$8ð ð	$8ð
 ð$8ð 
ò$8ó ð$8óL
ô$Pr]   rÇ  c                  ó¨   — e Zd ZdZedd„«       Zeddd„«       Zeddd„«       Zedd„«       Zeddd„«       Zd„ Zd„ Zd	„ Zd
„ Zdd„Z	dd„Z
dd„Zdd„Zy)ÚColorz„
    Color object based on OCCT Quantity_ColorRGBA.

    Attributes:
        wrapped (Quantity_ColorRGBA): the OCP color object
    c                 ó   — y)zcColor from OCCT color object

        Args:
            name (Quantity_ColorRGBA): q_color
        Nrb   )rd   Úq_colors     r[   rh   zColor.__init__J  r/  r]   c                 ó   — y)zÍColor from name

        `OCCT Color Names
            <https://dev.opencascade.org/doc/refman/html/_quantity___name_of_color_8hxx.html>`_

        Args:
            name (str): color, e.g. "blue"
        Nrb   )rd   ÚnameÚalphas      r[   rh   zColor.__init__R  r/  r]   c                 ó   — y)a
  Color from RGBA and Alpha values

        Args:
            red (float): 0.0 <= red <= 1.0
            green (float): 0.0 <= green <= 1.0
            blue (float): 0.0 <= blue <= 1.0
            alpha (float, optional): 0.0 <= alpha <= 1.0. Defaults to 0.0.
        Nrb   )rd   ÚredÚgreenÚbluer  s        r[   rh   zColor.__init__]  r/  r]   c                 ó   — y)zwColor from a 3 or 4 tuple of float values

        Args:
            color_tuple (tuple[float]): _description_
        Nrb   )rd   Úcolor_tuples     r[   rh   zColor.__init__h  r/  r]   c                 ó   — y)zÍColor from a hexadecimal color code with an optional alpha value

        Args:
            color_code (hexadecimal int): 0xRRGGBB
            alpha (hexadecimal int): 0x00 <= alpha as hex <= 0xFF
        Nrb   )rd   Ú
color_coder  s      r[   rh   zColor.__init__p  r/  r]   c                óò  — d\  }}}}}}}	}
t        |«      dk(  r3t        |d   t        «      r |d   ddt        |d   «      z
  z  z   \  }}}}n¦t        |«      dk(  st        |«      dk(  rst        |d   t        «      r|d   }
nqt        |d   t        «      r|d   }	t        |«      dk(  r|d   nd}nCt        |d   t
        «      r0|d   }t        |«      dk(  r|d   }nt        |«      dk\  r	|dd \  }}}t        |«      dk(  r|d   }|j                  d	|	«      }	|j                  d
|«      }|j                  d|«      }|j                  d|«      }|j                  d|«      }|	€|j                  d|«      }n|j                  d|«      }|dz  }|	�=t        |	t        «      r-t        |	d«      \  }}t        |d«      \  }}|dz  }|dz  }|dz  }|�|ddt        |«      z
  z  z   \  }}}}|
�|
| _        d| _        y |ret        «       | _        t        j                  |d   | j                  «      }|st        d|› �«      ‚| j                  j                  |«       d| _        y t        ||||«      | _        d| _        y )N)rÌ   rÌ   rÌ   rÌ   NNNNr8   r   ©rÌ   é   r”   éÿ   r|   r
  r  r  r  r  r  i   é   zUnknown color name: )r€   rJ   rO   r,   rv   rA  rW   ÚdivmodrB   ÚColorFromName_srQ   ÚSetAlphaÚ
iter_index)rd   rX   rY   r  r  r  r  r  r  r
  rÿ  Ú	remainderÚexistss                r[   rh   zColor.__init__y  s�  € ð	K
ÑGˆˆU�D˜% ¨d°JÀô ˆt‹9˜Š>œj¨¨a©´%Ô8Ø&*¨1¡g°¸!¼cÀ$ÀqÁ'»lÑ:JÑ0KÑ&KÑ#ˆC�˜™eÜ�‹Y˜!Š^œs 4›y¨Aš~Ü˜$˜q™'Ô#5Ô6Ø˜q™'‘Ü˜D ™G¤SÔ)Ø! !™W�
Ü#& t£9°¢>˜˜Qš°t‘Ü˜D ™G¤SÔ)Ø˜A‘w�Ü�t“9 ’>Ø  ™G‘EÜ�‹Y˜!Š^Ø# A a˜yÑˆC�˜Üˆt‹9˜Š>Ø˜‘GˆEà—Z‘Z ¨jÓ9ˆ
Ø�j‰j˜ Ó$ˆØ—
‘
˜7 EÓ*ˆØ�z‰z˜& $Ó'ˆØ—j‘j °Ó<ˆàÐØ—J‘J˜w¨Ó.‰Eà—J‘J˜w¨Ó.ˆEØ˜C‘KˆEàÐ!¤j°¼SÔ&AÜ# J°Ó7‰NˆC�Ü  ¨CÓ0‰KˆE�4Ø˜‘)ˆCØ˜C‘KˆEØ˜#‘:ˆDàÐ"Ø&1°F¸aÄ#ÀkÓBRÑ>RÑ4SÑ&SÑ#ˆC�˜˜eàÐØ"ˆDŒLð ˆ�ñ Ü-Ó/ˆDŒLÜ'×7Ñ7¸¸Q¹ÀÇÁÓNˆFÙÜ Ð#7¸°vÐ!>Ó?Ð?Ø�L‰L×!Ñ! %Ô(ð ˆ�ô .¨c°5¸$ÀÓFˆDŒLàˆ�r]   c                ó   — d| _         | S r�   )r  rq   s    r[   r‘   zColor.__iter__¹  s   € àˆŒØˆr]   c                ó<  — | j                   j                  «       }|j                  «       |j                  «       |j	                  «       | j                   j                  «       f}| j                  dkD  rt        ‚|| j                     }| xj                  dz  c_        |S )r“   r|   r8   )rB   ÚGetRGBÚRedÚGreenÚBlueÚAlphar  r•   )rd   ÚrgbÚ	rgb_tupler�   s       r[   r—   zColor.__next__¾  st   € à�l‰l×!Ñ!Ó#ˆØ—W‘W“Y §	¡	£¨S¯X©X«Z¸¿¹×9KÑ9KÓ9MÐNˆ	à�?‰?˜QÒÜÐà˜dŸo™oÑ.ˆEØ�OŠO˜qÑ �OØˆr]   c                ó   — t        | «      S )zValue as tuple)rO   rq   s    r[   r¦   zColor.to_tupleË  s   € ä�T‹{Ðr]   c                ó$   — t        t        | «      Ž S r  ©rý  rO   rq   s    r[   r  zColor.__copy__Ï  ó   € ä”e˜D“kÐ"Ð"r]   c                ó$   — t        t        | «      Ž S r  r!  r  s     r[   r  zColor.__deepcopy__Ó  r"  r]   c                ó°   — | j                   j                  «       j                  «       }t        j                  |«      }dt        t        | «      «      › d|› �S )zGenerate stringzColor: z ~ )rB   r  ÚNamer+   ÚStringName_srA  rO   )rd   Úquantity_color_enumÚquantity_color_strs      r[   rO  zColor.__str__×  sO   € à"Ÿl™l×1Ñ1Ó3×8Ñ8Ó:ÐÜ+×8Ñ8Ð9LÓMÐØœœU 4›[Ó)Ð*¨#Ð.@Ð-AÐBÐBr]   c                ó0   — dt        t        | «      «      › �S )z
Color reprrý  )rA  rO   rq   s    r[   r  zColor.__repr__Ý  s   € à”sœ5 ›;Ó'Ð(Ð)Ð)r]   N)rÿ  r,   r  )r  rA  r  rw   )r  rw   r  rw   r  rw   r  rw   )r  ztuple[float])r  )r
  rv   r  rv   )r:  rý  r@  )rG  rH  rI  rJ  r	   rh   r‘   r—   r¦   r  r  rO  r  rb   r]   r[   rý  rý  B  s•   „ ñð òó ðð óó ðð óó ðð òó ðð óó ðò>ò@ò

òó#ó#óCô*r]   rý  c                  óÌ  — e Zd ZdZi ej
                  ej                  “ej                  ej                  “ej                  ej                  “ej                  ej                  “ej                  ej                  “ej                   ej"                  “ej$                  ej&                  “ej(                  ej*                  “ej,                  ej.                  “ej0                  ej2                  “ej4                  ej6                  “ej8                  ej:                  “ej
                  ej>                  “ej                  ej@                  “ej                  ejB                  “ej                  ejD                  “ej                  ejF                  “ej                   ejH                  ej$                  ejJ                  ej(                  ejL                  ej,                  ejN                  ej0                  ejP                  ej4                  ejR                  ej8                  ejT                  i¥Z+e,d„ «       Z-e,d)d„«       Z-e,d*d+d„«       Z-e,	 d,	 	 	 d-d„«       Z-e,	 	 	 	 	 	 d.d„«       Z-e,d/d„«       Z-e,d0d	„«       Z-e,d1d
„«       Z-e,d2d„«       Z-e,	 	 	 	 	 	 d3d„«       Z-d„ Z-e.d4d„«       Z/e/j`                  d5d„«       Z/e.d4d„«       Z1e1j`                  d6d„«       Z1e.d7d„«       Z2e.d7d„«       Z3e.d7d„«       Z4d8d„Z5d8d„Z6d8d„Z7e,d9d„«       Z8e,d:d„«       Z8e,d;d„«       Z8	 	 	 	 d<d„Z8d=d„Z9d>d„Z:d8d„Z;	 	 	 	 d?d„Z<d7d „Z=d@d!„Z>d"„ Z?d#„ Z@e,dAd$„«       ZAe,dBd%„«       ZAe,dCd&„«       ZAe,dDd'„«       ZAd(„ ZAy)ErM   a^  Location in 3D space. Depending on usage can be absolute or relative.

    This class wraps the TopLoc_Location class from OCCT. It can be used to move Shape
    objects in both relative and absolute manner. It is the preferred type to locate objects
    in build123d.

    Attributes:
        wrapped (TopLoc_Location): the OCP location object

    c                 ó   — y)zVEmpty location with not rotation or translation with respect to the original location.Nrb   rq   s    r[   rh   zLocation.__init__	  r/  r]   c                 ó   — y)z%Location with another given location.Nrb   r1  s     r[   rh   zLocation.__init__  r/  r]   c                 ó   — y)z“Location with translation with respect to the original location.
        If angle != 0 then the location includes a rotation around z-axis by angleNrb   )rd   Útranslationr+  s      r[   rh   zLocation.__init__  r/  r]   Nc                 ó   — y)z«Location with translation with respect to the original location.
        If rotation is not None then the location includes the rotation (see also Rotation class)
        Nrb   )rd   r.  Úrotations      r[   rh   zLocation.__init__  r/  r]   c                 ó   — y)zøLocation with translation with respect to the original location.
        If rotation is not None then the location includes the rotation (see also Rotation class)
        ordering defaults to Intrinsic.XYZ, but can also be set to Extrinsic
        Nrb   )rd   r.  r0  Úorderings       r[   rh   zLocation.__init__  r/  r]   c                 ó   — y)z4Location corresponding to the location of the Plane.Nrb   rë   s     r[   rh   zLocation.__init__*  r/  r]   c                 ó   — y)zbLocation corresponding to the angular location of the Plane with
        translation plane_offset.Nrb   )rd   rE   Úplane_offsets      r[   rh   zLocation.__init__.  r/  r]   c                 ó   — y)z8Location wrapping the low-level TopLoc_Location object tNrb   )rd   Útop_locs     r[   rh   zLocation.__init__3  r/  r]   c                 ó   — y)z0Location wrapping the low-level gp_Trsf object tNrb   )rd   Úgp_trsfs     r[   rh   zLocation.__init__7  r/  r]   c                 ó   — y)zqLocation with translation t and rotation around direction by angle
        with respect to the original location.Nrb   )rd   r.  rb  r+  s       r[   rh   zLocation.__init__;  r/  r]   c                ó†	  — t        «       }t        |«      dk(  r�n�t        |«      dk(  �r%|d   }t        |t        t        f«      r&|j                  t        |«      j                  «       �n=t        |t        «      rxt        |j                  j                  «       |j                  j                  «       |j                  j                  «       «      }|j                  |«       |j                  «        �nµt        |d   t         «      r|j                  | _        y t        |t"        «      r|| _        y t        |t         «      r|}�ndt%        d«      ‚t        |«      dk(  �r»t&        j(                  }t        |d   t        t        f«      �rt        |d   t        t        f«      rW|d   D �cg c]  }t+        |«      ‘Œ }}t-        «       } |j.                  | j0                  |   g|¢­Ž  |j3                  |«       n|t        |d   t        t4        f«      rct        |d   t6        t8        f«      rJt+        |d   «      }	t-        «       }|j/                  | j0                  |   dd|	«       |j3                  |«       |j                  t        |d   «      j                  «       �n|\  }}
t        t        |
«      j                  «       |j                  j                  «       |j                  j                  «       «      }|j                  |«       |j                  «        �n�t        |«      dk(  �r€t        |d   t        t        f«      rŒt        |d   t        t        f«      rst        |d   t6        t8        f«      rZ|\  }}}	|j3                  t;        t        «       j                  «       t        |«      j                  «       «      |	t<        z  dz  «       n·t        |d   t        t        f«      r“t        |d   t        t        f«      rzt        |d   t>        t&        f«      ra|d   }|d   D �cg c]  }t+        |«      ‘Œ }}|d   }t-        «       } |j.                  | j0                  |   g|¢­Ž  |j3                  |«       nt%        d«      ‚|j                  t        |«      j                  «       t#        |«      | _        y c c}w c c}w )Nr   r8   zUnexpected parametersr”   r|   r?   z'Unsupported argument types for Location) r'   r€   rJ   rN   r   ÚSetTranslationPartrB   rL   r   Ú_originrê   rï   r  Úx_dirÚSetTransformationÚInvertrM   r-   r…   r6   rƒ   r   r&   ÚSetEulerAnglesÚ_rot_order_dictÚSetRotationrO   rv   rw   r   r   r7   )rd   rX   r(  r.  Úcoordinate_systemr2  Úar0  Ú
quaternionr+  rî   rD   s               r[   rh   zLocation.__init__B  sê  € ä“Iˆ	äˆt‹9˜Š>Ùä�‹Y˜!‹^Ø˜q™'ˆKä˜+¬´Ð'9Ô:Ø×,Ñ,¬V°KÓ-@×-HÑ-HÖIÜ˜K¬Ô/Ü$*Ø×'Ñ'×.Ñ.Ó0Ø×%Ñ%×,Ñ,Ó.Ø×%Ñ%×,Ñ,Ó.ó%Ð!ð
 ×+Ñ+Ð,=Ô>Ø× Ñ Ö"Ü˜D ™G¤XÔ.Ø*×2Ñ2�”ØÜ˜K¬Ô9Ø*�”ØÜ˜K¬Ô1Ø'’	äÐ 7Ó8Ð8ä�‹Y˜!‹^Ü —}‘}ˆHÜ˜$˜q™'¤F¬HÐ#5Õ6Ü˜d 1™g¬´Ð'9Ô:Ø48¸²GÓ<±G¨q¤¨¥
°G�HÐ<Ü!.£�JØ-�J×-Ñ-¨d×.BÑ.BÀ8Ñ.LÐXÈxÓXØ×)Ñ)¨*Õ5Ü  Q¡¬&´%¨Ô9¼jØ˜‘Gœc¤5˜\ô?ô $ D¨¡GÓ,�EÜ!.£�JØ×-Ñ-Ø×,Ñ,¨XÑ6¸¸1¸eôð ×)Ñ)¨*Ô5ð ×,Ñ,¬V°D¸±G«_×-DÑ-DÖEà&*Ñ#�˜VÜ$*Ü˜6“N×)Ñ)Ó+Ø×%Ñ%×,Ñ,Ó.Ø×%Ñ%×,Ñ,Ó.ó%Ð!ð
 ×+Ñ+Ð,=Ô>Ø× Ñ Ö"Ü�‹Y˜!‹^ä˜4 ™7¤V¬XÐ$6Ô7Ü˜t A™w¬´Ð(:Ô;Ü˜t A™w¬¬e¨Ô5à+/Ñ(�˜T 5Ø×%Ñ%Üœ6›8Ÿ?™?Ó,¬f°T«l×.AÑ.AÓ.CÓDÀeÌbÁjÐSXÑFXõô ˜4 ™7¤V¬XÐ$6Ô7Ü˜t A™w¬´Ð(:Ô;Ü˜t A™w¬´IÐ(>Ô?à" 1™g�Ø04°Q²Ó8±¨1œG A�J°�Ð8Ø ™7�Ü*›_�
Ø)�
×)Ñ)¨$×*>Ñ*>¸xÑ*HÐTÈ8ÓTØ×%Ñ% jÕ1äÐ IÓJÐJà×(Ñ(¬°Ó)<×)DÑ)DÔEÜ& yÓ1ˆ�ùòe  =ùòR 9s   Æ(R9Ð$R>c                ó:   — t        | j                  «       d   «      S )zjExtract Position component of self

        Returns:
          Vector: Position part of Location

        r   ©rN   r¦   rq   s    r[   rk  zLocation.position™  ó   € ô �d—m‘m“o aÑ(Ó)Ð)r]   c                ó6  — | j                   €t        d«      ‚t        «       }|j                  t	        |«      j                   «       t        «       }|j                  | j                   j                  «       j                  «       «       t        ||z  «      | _         y)zpSet the position component of this Location

        Args:
            value (VectorLike): New position
        Nz*Can't determine position of empty Location)	rB   rQ   r'   r<  rN   rC  r‚  ÚGetRotationr-   )rd   r�   Útrsf_positionÚtrsf_orientations       r[   rk  zLocation.position£  sw   € ð �<‰<ÐÜÐIÓJÐJÜ›	ˆØ×(Ñ(¬°«×)>Ñ)>Ô?Ü"›9ÐØ×$Ñ$ T§\¡\×%@Ñ%@Ó%B×%NÑ%NÓ%PÔQÜ& }Ð7GÑ'GÓHˆ�r]   c                ó:   — t        | j                  «       d   «      S )zyExtract orientation/rotation component of self

        Returns:
          Vector: orientation part of Location

        r8   rH  rq   s    r[   ÚorientationzLocation.orientation²  rI  r]   c                óþ  — t         j                  }| j                  j                  «       j	                  «       }t        «       }|j                  t        |j                  «       |j                  «       |j                  «       «      «       |D �cg c]  }t        |«      ‘Œ }}t        «       } |j                  | j                  |   g|¢­Ž  t        «       }|j                  |«       t!        ||z  «      | _        yc c}w )z‰Set the orientation component of this Location

        Args:
            rotation (VectorLike): Intrinsic XYZ angles in degrees
        N)r6   rƒ   rB   r‚  ÚTranslationPartr'   r<  r(   re   rf   rg   r   r&   rA  rB  rC  r-   )rd   r0  r2  Úposition_xyzrL  rE  rF  rM  s           r[   rO  zLocation.orientation¼  sÌ   € ô —=‘=ˆà—|‘|×2Ñ2Ó4×DÑDÓFˆÜ›	ˆØ×(Ñ(Ü�<—>‘>Ó# \§^¡^Ó%5°|·~±~Ó7GÓHô	
ñ )1Ó1© 1”G˜A•J¨ˆÐ1Ü"“_ˆ
Ø!ˆ
×!Ñ! $×"6Ñ"6°xÑ"@ÐLÀ8ÓLÜ"›9ÐØ×$Ñ$ ZÔ0Ü& }Ð7GÑ'GÓHˆ�ùò 2s   ÂC:c                óX   — t        | «      }t        |j                  |j                  «      S )z#Default X axis when used as a plane)rL   rK   rî   r>  rë   s     r[   Úx_axiszLocation.x_axisÒ  ó"   € ô �d“ˆÜ�E—L‘L %§+¡+Ó.Ð.r]   c                óX   — t        | «      }t        |j                  |j                  «      S )z#Default Y axis when used as a plane)rL   rK   rî   Úy_dirrë   s     r[   Úy_axiszLocation.y_axisØ  rU  r]   c                óX   — t        | «      }t        |j                  |j                  «      S )z#Default Z axis when used as a plane)rL   rK   rî   rï   rë   s     r[   Úz_axiszLocation.z_axisÞ  rU  r]   c                óH   — t        | j                  j                  «       «      S )zInverted location)rM   rB   ÚInvertedrq   s    r[   ÚinversezLocation.inverseä  s   € ä˜Ÿ™×-Ñ-Ó/Ó0Ð0r]   c                óH   — t        | j                  j                  «       «      S )zLib/copy.py shallow copy©rM   rB   r‚  rq   s    r[   r  zLocation.__copy__è  ó   € ä˜Ÿ™×3Ñ3Ó5Ó6Ð6r]   c                óH   — t        | j                  j                  «       «      S )zLib/copy.py deep copyr_  r  s     r[   r  zLocation.__deepcopy__ì  r`  r]   c                 ó   — y ra   rb   rü   s     r[   rÉ   zLocation.__mul__ð  s   € Ø.1r]   c                 ó   — y ra   rb   rü   s     r[   rÉ   zLocation.__mul__ó  s   € Ø47r]   c                 ó   — y ra   rb   rü   s     r[   rÉ   zLocation.__mul__ö  s   € ØDGr]   c                ó  — | j                   €t        d«      ‚t        |d«      �rct        |j                   t        «      �rHt
        j                  t        j                  t
        j                  t        j                  t
        j                  t        j                  t
        j                  t        j                  t
        j                  t        j                   t
        j"                  t        j$                  t
        j&                  t        j(                  i}|j                   €J ‚	 ||j                   j+                  «          }t/        j0                  |d«      } ||j                   j3                  | j                   «      «      |_         |S t        |t4        «      r9|j                   €t        d«      ‚t5        | j                   |j                   z  «      S t        |t6        «      rut9        |«      }t;        d„ |D «       «      st        d«      ‚t=        d„ |D «       «      rt        d	«      ‚|D �cg c]$  }t5        | j                   |j                   z  «      ‘Œ& c}S t        d
|› �«      ‚# t,        $ r}t        d|› �«      |‚d}~ww xY wc c}w )zCombine locationsNz(Cannot move a shape at an empty locationrB   úUnknown object type z Can't multiply by empty locationc              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wra   )rJ   rM   ©rx   Úos     r[   rz   z#Location.__mul__.<locals>.<genexpr>  s   è ø€ Ð?¹°1”z !¤X×.¹ùs   ‚z!other must be a list of Locationsc              3  ó8   K  — | ]  }|j                   d u –— Œ y ­wra   )rB   rh  s     r[   rz   z#Location.__mul__.<locals>.<genexpr>!  s   è ø€ Ð5©f¨�1—9‘9 Ô$©fùs   ‚z!Can't multiple by empty LocationszInvalid input )rB   rQ   rP   rJ   r1   ÚTopAbs_ShapeEnumÚTopAbs_VERTEXr.   ÚVertex_sÚTopAbs_EDGEÚEdge_sÚTopAbs_WIREÚWire_sÚTopAbs_FACEÚFace_sÚTopAbs_SHELLÚShell_sÚTopAbs_SOLIDÚSolid_sÚTopAbs_COMPOUNDÚ
Compound_sÚ	ShapeTypeÚKeyErrorÚcopy_moduleÚdeepcopyÚMovedrM   r   r�   r~   Úany)rd   rý   Údowncast_LUTÚ
f_downcastrŽ   rµ   ÚothersÚlocs           r[   rÉ   zLocation.__mul__ù  sø  € ð �<‰<ÐÜÐGÓHÐHô �5˜)Õ$¬°E·M±MÄ<Õ)Pô !×.Ñ.´·±Ü ×,Ñ,¬f¯m©mÜ ×,Ñ,¬f¯m©mÜ ×,Ñ,¬f¯m©mÜ ×-Ñ-¬v¯~©~Ü ×-Ñ-¬v¯~©~Ü ×0Ñ0´&×2CÑ2CðˆLð —=‘=Ð,Ð,Ð,ðJØ)¨%¯-©-×*AÑ*AÓ*CÑD�
ô (×0Ñ0°¸Ó=ˆFÙ'¨¯©×(;Ñ(;¸D¿L¹LÓ(IÓJˆFŒNØˆMô �eœXÔ&Ø�}‰}Ð$Ü Ð!CÓDÐDÜ˜DŸL™L¨5¯=©=Ñ8Ó9Ð9ô �eœXÔ&Ü˜%“[ˆFÜÑ?¹Ó?Ô?Ü Ð!DÓEÐEÜÑ5©fÓ5Ô5Ü Ð!DÓEÐEÙDJÓKÁF¸S”H˜TŸ\™\¨C¯K©KÑ7Õ8ÀFÑKÐKä˜>¨%¨Ð1Ó2Ð2øô- ò JÜ Ð#7¸°wÐ!?Ó@ÀcÐIûðJüò( Ls   Ä#I$ È*)JÉ$	JÉ-I<É<Jc                óJ   — t        | j                  j                  |«      «      S ra   )rM   rB   ÚPowered)rd   Úexponents     r[   Ú__pow__zLocation.__pow__'  s   € Ü˜Ÿ™×,Ñ,¨XÓ6Ó7Ð7r]   c                ó’  — t        |t        «      st        S t        «       }|j	                  t
        j                  t        | j                  j                  «      t        | j                  j                  «      t        | j                  j                  «      «       t        «       }|j	                  t
        j                  t        |j                  j                  «      t        |j                  j                  «      t        |j                  j                  «      «       | j                  |j                  k(  xr |j                  |«      S )zCompare Locations)rJ   rM   r	  r&   rA  r!   Úgp_Intrinsic_XYZr   rO  re   rf   rg   rk  r
  )rd   rý   Úquaternion1Úquaternion2s       r[   r  zLocation.__eq__*  sí   € ä˜%¤Ô*Ü!Ð!Ü#“oˆØ×"Ñ"Ü×-Ñ-Ü�D×$Ñ$×&Ñ&Ó'Ü�D×$Ñ$×&Ñ&Ó'Ü�D×$Ñ$×&Ñ&Ó'ô		
ô $“oˆØ×"Ñ"Ü×-Ñ-Ü�E×%Ñ%×'Ñ'Ó(Ü�E×%Ñ%×'Ñ'Ó(Ü�E×%Ñ%×'Ñ'Ó(ô		
ð �}‰} §¡Ñ.ÒS°;×3FÑ3FÀ{Ó3SÐSr]   c                ó,   — t        t        | «       «      S )z=Flip the orientation without changing the position operator -)rM   rL   rq   s    r[   rõ   zLocation.__neg__>  s   € äœ˜t›˜Ó%Ð%r]   c                ó$   — | j                  |«      S )zintersect axis with other &rú   rü   s     r[   rþ   zLocation.__and__B  r¥  r]   c                ó@   — t         j                  j                  | «      S )z!Convert the location into an Axis)rK   rg   r‡  rq   s    r[   Úto_axiszLocation.to_axisH  s   € ä�v‰v�~‰~˜dÓ#Ð#r]   c                ó:  — | j                   j                  «       }|j                  «       }|j                  «       }|j	                  «       |j                  «       |j                  «       f}t        d„ |j                  t        j                  «      D «       «      }||fS )z6Convert the location to a translation, rotation tuple.c              3  ó2   K  — | ]  }t        |«      –— Œ y ­wra   )r   )rx   rE  s     r[   rz   z$Location.to_tuple.<locals>.<genexpr>T  s   è ø€ ð 3
Ù U˜1ŒG�A�JÑ Uùs   ‚)rB   r‚  rQ  rK  re   rf   rg   rO   ÚGetEulerAnglesr!   r‰  )rd   ÚtransformationÚtransÚrotÚrv_transÚrv_rots         r[   r¦   zLocation.to_tupleL  s†   € ð Ÿ™×4Ñ4Ó6ˆØ×.Ñ.Ó0ˆØ×(Ñ(Ó*ˆà05·±³	¸5¿7¹7»9ÀeÇgÁgÃiÐ/PˆÜ-2ñ 3
Ø #× 2Ñ 2Ô3C×3TÑ3TÔ Uó3
ó .
ˆð ˜ÐÐr]   c                ó¸   — dj                  d„ | j                  «       d   D «       «      }dj                  d„ | j                  «       d   D «       «      }d|› d|› d�S )	úsTo String

        Convert Location to String for display

        Returns:
            Location as String
        rC   c              3  ó$   K  — | ]  }|d ›–— Œ
 y­w©z.2fNrb   ©rx   rm   s     r[   rz   z$Location.__repr__.<locals>.<genexpr>b  ó   è ø€ Ð HÑ5G° A c 7£Ñ5Gùó   ‚r   c              3  ó$   K  — | ]  }|d ›–— Œ
 y­wr›  rb   rœ  s     r[   rz   z$Location.__repr__.<locals>.<genexpr>c  ó   è ø€ Ð#KÑ8J°1 q¨ g£JÑ8Jùrž  r8   z(p=(z), o=(ú))©rS   r¦   ©rd   Úposition_strÚorientation_strs      r[   r  zLocation.__repr__Z  sX   € ð —y‘yÑ H°T·]±]³_ÀQÒ5GÓ HÓHˆØŸ)™)Ñ#K¸¿¹»ÈÒ8JÓ#KÓKˆØ�l�^ 6¨/Ð):¸"Ð=Ð=r]   c                ó¸   — dj                  d„ | j                  «       d   D «       «      }dj                  d„ | j                  «       d   D «       «      }d|› d|› d�S )	r™  rC   c              3  ó$   K  — | ]  }|d ›–— Œ
 y­wr›  rb   rœ  s     r[   rz   z#Location.__str__.<locals>.<genexpr>n  r�  rž  r   c              3  ó$   K  — | ]  }|d ›–— Œ
 y­wr›  rb   rœ  s     r[   rz   z#Location.__str__.<locals>.<genexpr>o  r   rž  r8   zLocation: (position=(z), orientation=(r¡  r¢  r£  s      r[   rO  zLocation.__str__f  sZ   € ð —y‘yÑ H°T·]±]³_ÀQÒ5GÓ HÓHˆØŸ)™)Ñ#K¸¿¹»ÈÒ8JÓ#KÓKˆØ& | nÐ4DÀ_ÐDUÐUWÐXÐXr]   c                 ó   — y)z(Find intersection of vector and locationNrb   r.  s     r[   rû   zLocation.intersectr  r/  r]   c                 ó   — y)z*Find intersection of location and locationNrb   r1  s     r[   rû   zLocation.intersectv  r/  r]   c                 ó   — y)z&Find intersection of axis and locationNrb   r3  s     r[   rû   zLocation.intersectz  r/  r]   c                 ó   — y)z'Find intersection of plane and locationNrb   rë   s     r[   rû   zLocation.intersect~  r/  r]   c                óÐ   — t        |i |¤Ž\  }}}}}|�|j                  | «      S |�|j                  | «      S |�| j                  |k(  r|S |�| |k(  r| S |�|j                  | «      S y ra   )r\   rû   rk  r6  s           r[   rû   zLocation.intersect‚  sˆ   € Ü/DÀdÐ/UÈfÑ/UÑ,ˆˆe�V˜X uàÐØ—>‘> $Ó'Ð'àÐØ—?‘? 4Ó(Ð(àÐ $§-¡-°6Ò"9ØˆMàÐ D¨HÒ$4ØˆKàÐØ—?‘? 4Ó(Ð(ð r]   ©rF   rM   )r   )r.  r<  r+  rw   ra   )r.  r<  r0  zRotationLike | None)r.  r<  r0  ÚRotationLiker2  úExtrinsic | Intrinsic)rE   rL   )rE   rL   r5  r<  )r7  r-   )r9  r'   )r.  r<  rb  r<  r+  rw   r=  )r�   r<  )r0  r<  r\  r¿  )rý   r;   r:  r;   )rý   rM   r:  rM   )rý   zIterable[Location]r:  zlist[Location])rý   z%Shape | Location | Iterable[Location]r:  z!Shape | Location | list[Location])r†  rv   r:  rM   rB  )rý   r?  r:  zVector | Location | None)r:  z=tuple[tuple[float, float, float], tuple[float, float, float]]rF  rÁ  )rD   rK   r:  rÂ  )rE   rL   r:  rÂ  )BrG  rH  rI  rJ  r6   rƒ   r!   r‰  ÚXZYÚgp_Intrinsic_XZYÚYZXÚgp_Intrinsic_YZXÚYXZÚgp_Intrinsic_YXZÚZXYÚgp_Intrinsic_ZXYÚZYXÚgp_Intrinsic_ZYXÚXYXÚgp_Intrinsic_XYXÚXZXÚgp_Intrinsic_XZXÚYZYÚgp_Intrinsic_YZYÚYXYÚgp_Intrinsic_YXYÚZXZÚgp_Intrinsic_ZXZÚZYZÚgp_Intrinsic_ZYZr7   Úgp_Extrinsic_XYZÚgp_Extrinsic_XZYÚgp_Extrinsic_YZXÚgp_Extrinsic_YXZÚgp_Extrinsic_ZXYÚgp_Extrinsic_ZYXÚgp_Extrinsic_XYXÚgp_Extrinsic_XZXÚgp_Extrinsic_YZYÚgp_Extrinsic_YXYÚgp_Extrinsic_ZXZÚgp_Extrinsic_ZYZrB  r	   rh   rM  rk  rN  rO  rT  rX  rZ  r]  r  r  rÉ   r‡  r  rõ   rþ   r�  r¦   r  rO  rû   rb   r]   r[   rM   rM   â  s   „ ñ	ðØ�‰Ð'×8Ñ8ðà�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ð	ð
 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð 	�‰Ð'×8Ñ8ðð  	�‰Ð'×8Ñ8ð!ð" 	�‰Ð'×8Ñ8ð#ð$ 	�‰Ð'×8Ñ8Ø�‰Ð'×8Ñ8Ø�‰Ð'×8Ñ8Ø�‰Ð'×8Ñ8Ø�‰Ð'×8Ñ8Ø�‰Ð'×8Ñ8Ø�‰Ð'×8Ñ8ñ1€Oð6 ñeó ðeð ò4ó ð4ð óVó ðVð àGKðØ%ðØ1Dòó ðð ð	àð	ð ð	ð (ò		ó ð	ð òCó ðCð ò%ó ð%ð òGó ðGð ò?ó ð?ð ð2Ø%ð2Ø2<ð2ØEJò2ó ð2òU2ðn ò*ó ð*ð ‡_�_òIó ðIð ò*ó ð*ð ×ÑòIó ðIð* ò/ó ð/ð
 ò/ó ð/ð
 ò/ó ð/ó
1ó7ó7ð Ú1ó Ø1àÚ7ó Ø7àÚGó ØGð,3Ø:ð,3à	*ó,3ó\8óTó(&ð%ØAð%à	!ó%ó$ó ò
>ò
Yð ò7ó ð7ð ò9ó ð9ð ò5ó ð5ð ò6ó ð6ó)r]   rM   c                  ó*   — e Zd ZdZdd„Zedd„«       Zy)ÚLocationEncoderaé  Custom JSON Encoder for Location values

    Example:

    .. code::

        data_dict = {
            "part1": {
                "joint_one": Location((1, 2, 3), (4, 5, 6)),
                "joint_two": Location((7, 8, 9), (10, 11, 12)),
            },
            "part2": {
                "joint_one": Location((13, 14, 15), (16, 17, 18)),
                "joint_two": Location((19, 20, 21), (22, 23, 24)),
            },
        }
        json_object = json.dumps(data_dict, indent=4, cls=LocationEncoder)
        with open("sample.json", "w") as outfile:
            outfile.write(json_object)
        with open("sample.json", "r") as infile:
            copy_data_dict = json.load(infile, object_hook=LocationEncoder.location_hook)

    c                ó\   — t        |t        «      st        d«      ‚d|j                  «       iS )zReturn a serializable objectz Only applies to Location objectsrM   )rJ   rM   r…   r¦   )rd   ri  s     r[   ÚdefaultzLocationEncoder.default®  s)   € ä˜!œXÔ&ÜÐ>Ó?Ð?Ø˜AŸJ™J›LÐ)Ð)r]   c                óˆ   — d| v r2t        | d   D ��cg c]  }|D �cg c]  }t        |«      ‘Œ c}‘Œ c}}Ž } | S c c}w c c}}w )z¦Convert Locations loaded from json to Location objects

        Example:
            read_json = json.load(infile, object_hook=LocationEncoder.location_hook)
        rM   )rM   rw   )rà  rm   Úfs      r[   Úlocation_hookzLocationEncoder.location_hook´  sI   € ð ˜ÑÜ¸CÀ
ºOÔL¹O°q±Ó2±¨1œe A�h°Ó2¸OÒLÐMˆCØˆ
ùò 3ùÓLs   ’	>
›9­>
¹>
N)ri  rM   r:  Údict)r:  rÚ  )rG  rH  rI  rJ  rÖ  rú  rÙ  rb   r]   r[   rÔ  rÔ  •  s    „ ñó0*ð òó ñr]   rÔ  c                  óÈ   — e Zd ZdZdd„Zedd„«       Zedd„«       Zedd„«       Zedd„«       Z	edd„«       Z
edd„«       Zedd	„«       Zedd
„«       Zdd„Zdd„Zdd„Zdd„Zy)ÚOrientedBoundBoxa}  
    An Oriented Bounding Box

    This class computes the oriented bounding box for a given build123d shape.
    It exposes properties such as the center, principal axis directions, the
    extents along these axes, and the full diagonal length of the box.

    Note: The axes of the oriented bounding box are arbitrary and may not be
    consistent across platforms or time.
    c                óœ   — t        |t        «      r
|}|| _        yt        «       }t        j                  |j                  |d«       || _        y)a5  
        Create an oriented bounding box from either a precomputed Bnd_OBB or
        a build123d Shape (which wraps a TopoDS_Shape).

        Args:
            shape (Bnd_OBB | Shape): Either a precomputed Bnd_OBB or a build123d shape
                from which to compute the oriented bounding box.
        TN)rJ   r   r   ré  rB   )rd   rH   Úobbs      r[   rh   zOrientedBoundBox.__init__Ì  sB   € ô �eœWÔ%ØˆCð
 ˆ�ô “)ˆCä×Ñ §¡¨s°DÔ9Øˆ�r]   c                ó*  — ddgddgddgg d¢g d¢g d¢t        j                  ddd«      D ���cg c]  \  }}}|||f‘Œ c}}}d	œ}| j                  d
z  }||j                  t        k  |j
                  t        k  |j                  t        k  f   }|D ���	cg c]:  \  }}}	t        ||j                  z  ||j
                  z  |	|j                  z  «      ‘Œ< }
}}}	|
D �cg c]  }| j                  j                  |«      ‘Œ }}|S c c}}}w c c}	}}w c c}w )a¼  
        Compute and return the unique corner points of the oriented bounding box
        in the coordinate system defined by the OBB's plane.

        For degenerate shapes (e.g. a line or a planar face), only the unique
        points are returned. For 2D shapes the corners are returned in an order
        that allows a polygon to be directly created from them.

        Returns:
            list[Vector]: The unique corner points.
        ©r8   r8   r8   ©r8   r8   rß   ©r8   rß   r8   ©rß   r8   r8   )rà  rá  )r8   rß   rß   râ  )rà  rá  )rß   r8   rß   rã  )rà  râ  )rß   rß   r8   rã  )rß   r8   ))TTF)TFT)FTT)TFF)FTF)FFT)FFFrÕ  )
Ú	itertoolsÚproductrÌ  re   r  rf   rg   rN   rE   Úfrom_local_coords)rd   r†   r‡   rˆ   ÚordersÚhsÚorderÚsxÚsyÚszÚlocal_cornersÚcÚcornerss                r[   rï  zOrientedBoundBox.cornersÝ  s  € ð" #,¨ZÐ!8Ø"+¨ZÐ!8Ø"+¨ZÐ!8â"RÚ"RÚ"Rô *3×):Ñ):¸7ÀGÈWÔ)Uõ$Ù)U™g˜a  A��A�q’	Ð)Uó$ñ
ˆð �Y‰Y˜‰_ˆØ˜Ÿ™œyÑ(¨"¯$©$´Ñ*:¸B¿D¹DÄ9Ñ<LÐMÑNˆáFKõ
ÙFK¹
¸¸BÀŒF�2˜Ÿ™‘9˜b 2§4¡4™i¨¨b¯d©d©Õ3Àeð 	ò 
ñ =JÓJ¹M°q�4—:‘:×/Ñ/°Õ2¸MˆÐJàˆùô$ùô
ùò Ks   ®DÂ?D	Ã"Dc                óV   — | j                   €y| j                   j                  «       dz  S )zÇ
        The full length of the body diagonal of the oriented bounding box,
        which represents the maximum size of the object.

        Returns:
            float: The diagonal length.
        r{   rÕ  rÖ  rq   s    r[   rØ  zOrientedBoundBox.diagonal  s)   € ð �<‰<ÐØØ�|‰|×(Ñ(Ó*¨cÑ1Ð1r]   c                ó,   — t        | j                  «      S )z‚
        The Location of the center of the oriented bounding box.

        Returns:
            Location: center location
        )rM   rE   rq   s    r[   rF   zOrientedBoundBox.location  s   € ô ˜Ÿ
™
Ó#Ð#r]   c                ób   — t        | j                  «       | j                  | j                  ¬«      S )zê
        The oriented coordinate system of the bounding box.

        Returns:
            Plane: The coordinate system defined by the center and primary
                   (X) and tertiary (Z) directions of the bounding box.
        ©rî   r>  rï   )rL   rØ   Úx_directionÚz_directionrq   s    r[   rE   zOrientedBoundBox.plane  s*   € ô Ø—;‘;“=¨×(8Ñ(8À×@PÑ@Pô
ð 	
r]   c                ó²   — t        | j                  j                  «       | j                  j                  «       | j                  j	                  «       «      dz  S )z¤
        The full extents of the bounding box along its primary axes.

        Returns:
            Vector: The oriented size (full dimensions) of the box.
        g       @)rN   rB   ÚXHSizeÚYHSizeÚZHSizerq   s    r[   rÌ  zOrientedBoundBox.size'  sD   € ô �4—<‘<×&Ñ&Ó(¨$¯,©,×*=Ñ*=Ó*?ÀÇÁ×ATÑATÓAVÓWØñð	
r]   c                óŒ   — | j                   j                  «       }dD �cg c]  } t        ||«      «       ‘Œ }}t        |Ž S c c}w )z‘
        The primary (X) direction of the oriented bounding box.

        Returns:
            Vector: The X direction as a unit vector.
        r¥   )rB   Ú
XDirectionÚgetattrrN   )rd   Úx_direction_xyzÚattrÚcoordss       r[   rô  zOrientedBoundBox.x_direction4  óG   € ð Ÿ,™,×1Ñ1Ó3ˆÙ?NÓO¹°tÐ0”'˜/¨4Ó0Õ2¸ˆÐOÜ�vˆÐùò Pó   ŸAc                óŒ   — | j                   j                  «       }dD �cg c]  } t        ||«      «       ‘Œ }}t        |Ž S c c}w )z“
        The secondary (Y) direction of the oriented bounding box.

        Returns:
            Vector: The Y direction as a unit vector.
        r¥   )rB   Ú
YDirectionrü  rN   )rd   Úy_direction_xyzrþ  rÿ  s       r[   Úy_directionzOrientedBoundBox.y_direction@  r   r  c                óŒ   — | j                   j                  «       }dD �cg c]  } t        ||«      «       ‘Œ }}t        |Ž S c c}w )z’
        The tertiary (Z) direction of the oriented bounding box.

        Returns:
            Vector: The Z direction as a unit vector.
        r¥   )rB   Ú
ZDirectionrü  rN   )rd   Úz_direction_xyzrþ  rÿ  s       r[   rõ  zOrientedBoundBox.z_directionL  r   r  c                óŒ   — | j                   j                  «       }dD �cg c]  } t        ||«      «       ‘Œ }}t        |Ž S c c}w )z–
        Compute and return the center point of the oriented bounding box.

        Returns:
            Vector: The center point of the box.
        r¥   )rB   ÚCenterrü  rN   )rd   Ú
center_xyzrþ  rÿ  s       r[   rØ   zOrientedBoundBox.centerX  sG   € ð —\‘\×(Ñ(Ó*ˆ
Ù:IÓJ¹/°$Ð+”'˜* dÓ+Õ-¸/ˆÐJÜ�vˆÐùò Kr  c                óz   — |j                   €t        d«      ‚| j                   j                  |j                   «      S )a‹  
        Determine whether the given oriented bounding box is entirely contained
        within this bounding box.

        This method checks that every point of 'other' lies strictly within the
        boundaries of this box, according to the tolerance criteria inherent to the
        underlying OCCT implementation.

        Args:
            other (OrientedBoundBox): The bounding box to test for containment.

        Raises:
            ValueError: If the 'other' bounding box has an uninitialized (null) underlying geometry.

        Returns:
            bool: True if 'other' is completely inside this bounding box; otherwise, False.
        zCan't compare to a null obb)rB   rQ   ÚIsCompletelyInsiderü   s     r[   Úis_completely_insidez%OrientedBoundBox.is_completely_insidec  s3   € ð$ �=‰=Ð ÜÐ:Ó;Ð;Ø�|‰|×.Ñ.¨u¯}©}Ó=Ð=r]   c                ó‚   — |j                   €t        d«      ‚| j                   j                  |j                  «       «      S )a  
        Determine whether a given point lies entirely outside this oriented bounding box.

        A point is considered outside if it is neither inside the box nor on its surface,
        based on the criteria defined by the OCCT implementation.

        Args:
            point (Vector): The point to test.

        Raises:
            ValueError: If the point's underlying geometry is not set (null).

        Returns:
            bool: True if the point is completely outside the bounding box; otherwise, False.
        zCan't compare to a null point)rB   rQ   ÚIsOutrê   )rd   Úpoints     r[   Ú
is_outsidezOrientedBoundBox.is_outsidey  s5   € ð  �=‰=Ð ÜÐ<Ó=Ð=Ø�|‰|×!Ñ! %§,¡,£.Ó1Ð1r]   c                ó^   — d| j                  «       › d| j                  › d| j                  › d�S )NzOrientedBoundBox(center=z, size=z, plane=r  )rØ   rÌ  rE   rq   s    r[   r  zOrientedBoundBox.__repr__�  s0   € Ø)¨$¯+©+«-¨¸ÀÇ	Á	¸{È(ÐSW×S]ÑS]ÐR^Ð^_Ð`Ð`r]   N)rH   zBnd_OBB | Shape)r:  zlist[Vector]r9  r¿  rÀ  r=  )rý   rÜ  r:  rD  )r  rN   r:  rD  r@  )rG  rH  rI  rJ  rh   rM  rï  rØ  rF   rE   rÌ  rô  r  rõ  rØ   r  r  r  rb   r]   r[   rÜ  rÜ  À  sÂ   „ ñ	óð" ò#ó ð#ðJ ò
2ó ð
2ð ò$ó ð$ð ò

ó ð

ð ò

ó ð

ð ò	ó ð	ð ò	ó ð	ð ò	ó ð	ó	ó>ó,2ô(ar]   rÜ  c                  óz   ‡ — e Zd ZdZe	 	 	 	 dd„«       Zedddej                  f	 	 	 	 	 	 	 dd„«       Zˆ fd„Zˆ xZS )ÚRotationa[  Subclass of Location used only for object rotation

    Attributes:
        X (float): rotation in degrees about X axis
        Y (float): rotation in degrees about Y axis
        Z (float): rotation in degrees about Z axis
        optionally specify rotation ordering with Intrinsic or Extrinsic enums,
            defaults to Intrinsic.XYZ

    c                 ó   — y©z}Subclass of Location used only for object rotation
        ordering is for order of rotations in Intrinsic or Extrinsic enumsNrb   )rd   r0  r2  s      r[   rh   zRotation.__init__�  r/  r]   r   c                 ó   — yr  rb   )rd   re   rf   rg   r2  s        r[   rh   zRotation.__init__¦  r/  r]   c                ó  •— t        d„ |D «       «      st        d«      ‚g d¢g g }}}|r¼t        t        d„ |«      «      }t        t        d„ |«      «      }t        t        d„ |«      «      }|rt        |Ž }|r|d   j	                  «       }t        |«      dk  r!|j                  d	gdt        |«      z
  z  «       t        t        d
„ |«      «      }t        t        d„ |«      «      }|j                  d|d   «       |j                  d|d   «       |j                  d|d   «       |j                  d|r|d   nt        j                  «       |rt        ‰| �-  |d   «       y t        ‰| �-  d|d   |d   |d   f|d   «       y )Nc              3  ó$   K  — | ]  }|d v –— Œ
 y­w))re   rf   rg   r0  r2  Nrb   )rx   Úkeys     r[   rz   z$Rotation.__init__.<locals>.<genexpr>²  s   è ø€ ÐTÉVÀc�3ÐAÔAÉVùrž  zInvalid key for RotationrS  c                ó.   — t        | t        t        f«      S ra   ru   ©Úitems    r[   Ú<lambda>z#Rotation.__init__.<locals>.<lambda>¶  s   € ¬j¸ÄÄU¸|Ô.Lr]   c                ó"   — t        | t        «      S ra   )rJ   rN   r  s    r[   r  z#Rotation.__init__.<locals>.<lambda>·  s   € ¬z¸$ÄÔ/Gr]   c                ó"   — t        | t        «      S ra   )rJ   rO   r  s    r[   r  z#Rotation.__init__.<locals>.<lambda>¸  s   € ¬j¸¼uÔ.Er]   r   r|   r{   c                ó"   — t        | t        «      S ra   )rJ   r  r  s    r[   r  z#Rotation.__init__.<locals>.<lambda>¿  s   € ´¸DÄ(Ô1Kr]   c                ó.   — t        | t        t        f«      S ra   )rJ   r7   r6   r  s    r[   r  z#Rotation.__init__.<locals>.<lambda>Á  s   € ¤J¨t´iÄÐ5KÔ$Lr]   re   rf   r8   rg   r”   r2  )r~   r…   r�   Úfilterr¦   r€   ÚextendÚ
setdefaultr6   rƒ   Úsuperrh   )	rd   rX   rY   ÚanglesÚ	rotationsÚ	orderingsÚvectorsÚtuplesÚ	__class__s	           €r[   rh   zRotation.__init__±  sk  ø€ ÜÑTÉVÓTÔTÜÐ6Ó7Ð7Ú'0°"°b˜9�	ˆÙÜœ&Ñ!LÈdÓSÓTˆFÜœ6Ñ"GÈÓNÓOˆGÜœ&Ñ!EÀtÓLÓMˆFÙÜ˜v˜�ÙØ  ™×,Ñ,Ó.�Ü�6‹{˜QŠØ—‘˜s˜e q¬3¨v«;¡Ñ7Ô8ÜœVÑ$KÈTÓRÓSˆIÜÜÑLÈdÓSóˆIð 	×Ñ˜#˜v a™yÔ)Ø×Ñ˜#˜v a™yÔ)Ø×Ñ˜#˜v a™yÔ)Ø×Ñ˜*±i i°¢lÄYÇ]Á]ÔSÙÜ‰GÑ˜Y q™\Õ*ä‰GÑØ˜F 3™K¨°©°f¸S±kÐBÀFÈ:ÑDVõr]   )r0  r¯  r2  z&Extrinsic | Intrinsic == Intrinsic.XYZ)re   rw   rf   rw   rg   rw   r2  r°  )	rG  rH  rI  rJ  r	   rh   r6   rƒ   Ú__classcell__©r-  s   @r[   r  r  ‘  sŽ   ø„ ñ	ð ðNàðNð 9òNó ðNð ð ØØØ*3¯-©-ðNàðNð ðNð ð	Nð
 (òNó ðN÷ð r]   r  r¯  c                  óZ   ‡ — e Zd ZdZedd„«       Zedd„«       Zedd	d„«       Zˆ fd„Zˆ xZS )
ÚPosz%A position only sub-class of Locationc                 ó   — y)zPosition by VectorLikeNrb   rl   s     r[   rh   zPos.__init__Ý  r/  r]   c                 ó   — y)zPosition by VertexNrb   rl   s     r[   rh   zPos.__init__á  r/  r]   c                 ó   — y)zPosition by X, Y, ZNrb   rc   s       r[   rh   zPos.__init__å  r/  r]   c                óþ  •— d\  }}}}|rQt        d„ |D «       «      rt        |«      \  }}}n/t        |«      dk(  rt        |d   «      \  }}}nt        d|› �«      ‚|j	                  d|«      }|j	                  d|«      }|j	                  d|«      }|j	                  d	t        |||«      «      }|r+t        d
dj                  |j                  «       «      › �«      ‚|�|\  }}}t        ‰| �%  t        |||«      «       y )Nrs   c              3  óH   K  — | ]  }t        |t        t        f«      –— Œ y ­wra   )rJ   rw   rv   rœ  s     r[   rz   zPos.__init__.<locals>.<genexpr>î  s   è ø€ Ð=¹°1”:˜a¤%¬ ×.¹ùs   ‚ "r8   r   zInvalid inputs to Pos re   rf   rg   rm   rf  rC   )
r~   rN   r€   r…   rg  rQ   rS   rU   r'  rh   )rd   rX   rY   r†   r‡   rˆ   rm   r-  s          €r[   rh   zPos.__init__é  sú   ø€ Ø"‰
ˆˆ1ˆa�ñ ÜÑ=¹Ó=Ô=Ü  ›,‘��1‘aÜ�T“˜a’Ü   a¡›/‘��1‘aäÐ"8¸¸Ð ?Ó@Ð@ð �J‰J�s˜AÓˆØ�J‰J�s˜AÓˆØ�J‰J�s˜AÓˆØ�J‰J�sœF 1 a¨›OÓ,ˆñ ÜÐ7¸¿	¹	À&Ç+Á+Ã-Ó8PÐ7QÐRÓSÐSàˆ=Ø‰GˆAˆq�!Ü‰Ñœ  1 a›Õ)r]   )rm   r<  )rm   r   rS  r7  )rG  rH  rI  rJ  r	   rh   r.  r/  s   @r[   r1  r1  Ú  sJ   ø„ Ù/àò%ó ð%ð ò!ó ð!ð ó"ó ð"÷*ð *r]   r1  c                  ó¬   — e Zd ZdZed„ «       Zedd„«       Zedd„«       Zd„ Zdd„Zdd„Zedd„«       Zedd	„«       Zd
„ Zdd„Z	dd„Z
dd„Zdd„Zdd„Zy)rE  a  A 3d , 4x4 transformation matrix.

    Used to move geometry in space.

    The provided "matrix" parameter may be None, a gp_GTrsf, or a nested list of
    values.

    If given a nested list, it is expected to be of the form:

        [[m11, m12, m13, m14],
         [m21, m22, m23, m24],
         [m31, m32, m33, m34]]

    A fourth row may be given, but it is expected to be: [0.0, 0.0, 0.0, 1.0]
    since this is a transform matrix.

    Attributes:
        wrapped (gp_GTrsf): the OCP transformation function
    c                 ó   — y ra   rb   rq   s    r[   rh   zMatrix.__init__  ri   r]   c                 ó   — y ra   rb   )rd   Útrsfs     r[   rh   zMatrix.__init__  ri   r]   c                 ó   — y ra   rb   )rd   Úmatrixs     r[   rh   zMatrix.__init__!  ri   r]   c                óJ  — d }t        «       }|ret        |d   t         «      r|d   }nLt        |d   t        «      rt        |d   «      }n*t        |d   t        «      r|d   }nt	        |d   › d�«      ‚|j                  d|«      }|j                  d|«      }|r+t        ddj                  |j                  «       «      › �«      ‚|�Öt        d„ |D «       «      xr t        |«      dv }|st	        d	t        |«      › �«      ‚t        |«      d
k(  r+t        |d   «      dk7  rt        dt        |d   «      › �«      ‚t        |d d «      D ]R  \  }}	t        |	«      D ]?  \  }
}t        |t        t        f«      st	        d«      ‚|j!                  |dz   |
dz   |«       ŒA ŒT || _        y )Nr   z is of an unexpected typer:  r<  rf  rC   c              3  ó\   K  — | ]$  }t        |t        «      xr t        |«      d k(  –— Œ& y­w)r  N)rJ   r   r€   )rx   Úrows     r[   rz   z"Matrix.__init__.<locals>.<genexpr>?  s+   è ø€ ð ÙKQÀC”˜C¤Ó*Ò>´°C³¸A±Ó>É6ùs   ‚*,)r|   r  z<Matrix constructor requires 2d list of 4x3 or 4x4, but got: r  r|   )r   r   r   r8   z0Expected the last row to be [0,0,0,1], but got: z)Only float or int are valid in the matrixr8   )r"   rJ   r'   r   r…   rg  rQ   rS   rU   r~   r€   ÚreprrO   Ú	enumeraterv   rw   ÚSetValuerB   )rd   rX   rY   Údefault_matrixÚdefault_trsfr:  r<  Úvalid_sizesry   r?  ÚjÚelements               r[   rh   zMatrix.__init__%  s¼  € ØˆÜ“zˆñ Ü˜$˜q™'¤8Ô,Ø# A™w‘Ü˜D ™G¤WÔ-Ü'¨¨Q©Ó0‘Ü˜D ™G¤XÔ.Ø!% a¡‘ä 4¨¡7 )Ð+DÐ EÓFÐFð �z‰z˜& ,Ó/ˆØ—‘˜H nÓ5ˆñ ÜÐ7¸¿	¹	À&Ç+Á+Ã-Ó8PÐ7QÐRÓSÐSð Ðäñ ÙKQóó ò (ä�f“+ Ð'ð ñ ÜØRÔSWÐX^ÓS_ÐR`Ðaóð ô �F“˜qÒ ¤u¨V°A©YÓ'7¸<Ò'GÜ ØFÄtÈFÐSTÉIÃÐFWÐXóð ô
 $ F¨2¨A JÖ/‘��3Ü"+¨C¦.‘J�A�wÜ% g´´U¨|Ô<Ü'Ð(SÓTÐTØ—M‘M ! a¡%¨¨Q©°Õ8ñ #1ð 0ð ˆ�r]   c                óŠ   — t        «       }|j                  |j                  |«       | j                  t        |«      z  | _        y)zGeneral rotate about axisN)r'   rC  rB   r"   )rd   rD   r+  Únews       r[   r,  zMatrix.rotateT  s/   € ä‹iˆØ�‰˜Ÿ™ eÔ,Ø—|‘|¤h¨s£mÑ3ˆ�r]   c                óH   — t        | j                  j                  «       «      S )zInvert Matrix)rE  rB   r\  rq   s    r[   r]  zMatrix.inverseZ  s   € ä�d—l‘l×+Ñ+Ó-Ó.Ð.r]   c                 ó   — y ra   rb   rü   s     r[   rÅ   zMatrix.multiply^  ri   r]   c                 ó   — y ra   rb   rü   s     r[   rÅ   zMatrix.multiplyb  ri   r]   c                ó    — t        |t        «      r|j                  | «      S t        | j                  j                  |j                  «      «      S )zMatrix multiplication)rJ   rN   r(  rE  rB   rÂ   rü   s     r[   rÅ   zMatrix.multiplyf  s9   € ä�eœVÔ$Ø—?‘? 4Ó(Ð(ä�d—l‘l×-Ñ-¨e¯m©mÓ<Ó=Ð=r]   c                ó2  — | j                   }t        dd«      D ��cg c],  }t        dd«      D �cg c]  }|j                  ||«      ‘Œ c}‘Œ. c}}g d¢gz   }t        d«      D ��cg c]  }t        d«      D ]
  }||   |   ‘Œ Œ c}}S c c}w c c}}w c c}}w )z#Needed by the cqparts gltf exporterr8   r  é   ©r{   r{   r{   rÌ   )rB   r   ÚValue)rd   r:  ry   rF  Údatas        r[   Útransposed_listzMatrix.transposed_listm  s’   € ð �|‰|ˆÜAFÀqÈ!ÄÔMÁ¸A¬5°°A¬;Ó7©; a�—‘˜A˜qÕ!¨;Ó7ÀÒMÚ ðQ
ñ 
ˆô %*¨!¤HÔ?¡H˜q´e¸A¶h°��Q‘˜“
°h�
 HÒ?Ð?ùò	 8ùÓMùó @s   œB¯BÁBÁ%BÂBc                óH   — t        | j                  j                  «       «      S r  ©rE  rB   r   rq   s    r[   r  zMatrix.__copy__w  ó   € ä�d—l‘l×'Ñ'Ó)Ó*Ð*r]   c                óH   — t        | j                  j                  «       «      S r  rU  r  s     r[   r  zMatrix.__deepcopy__{  rV  r]   c                ó&  — t        |t        «      rt        |«      dk7  rt        d«      ‚|\  }}d|cxk  rdk  rn nd|cxk  rdk  sn t        dt	        |«      › �«      ‚|dk  r$| j
                  j                  |dz   |dz   «      }|S g d¢|   }|S )zäProvide Matrix[r, c] syntax for accessing individual values. The row
        and column parameters start at zero, which is consistent with most
        python libraries, but is counter to gp_GTrsf(), which is 1-indexed.
        r”   z+Matrix subscript must provide (row, column)r   r|   z&Out of bounds access into 4x4 matrix: r8   rP  )rJ   rO   r€   Ú
IndexErrorr@  rB   rQ  )rd   Úrow_colr?  Úcolr%  s        r[   Ú__getitem__zMatrix.__getitem__  s™   € ô
 ˜'¤5Ô)¬c°'«l¸aÒ.?ÜÐJÓKÐKØ‰
ˆˆcØ�c”˜Q• Q¨#¤]°¤]ÜÐEÄdÈ7ÃmÀ_ÐUÓVÐVØ�Š7ØŸ<™<×-Ñ-¨c°A©g°s¸Q±wÓ?ˆLð
 Ðò 0°Ñ4ˆLØÐr]   c                óv   ‡— | j                  «       Šdj                  ˆfd„t        d«      D «       «      }d|› d�S )zM
        Generate a valid python expression representing this Matrix
        z
,
        c              3  ó@   •K  — | ]  }t        ‰|d d…   «      –— Œ y ­w)Nr  )rA  )rx   ry   Úmatrix_transposeds     €r[   rz   z"Matrix.__repr__.<locals>.<genexpr>–  s#   øè ø€ Ð'WÉhÈ¬Ð,=¸a¸dÀ¸dÑ,C×(DÉhùs   ƒr  zMatrix([z]))rS  rS   r   )rd   Ú
matrix_strr_  s     @r[   r  zMatrix.__repr__‘  s>   ø€ ð !×0Ñ0Ó2ÐØ"×'Ñ'Ó'WÌeÐTUÌhÓ'WÓWˆ
Ø˜*˜ RÐ(Ð(r]   N)r:  zgp_GTrsf | gp_Trsf)r<  zSequence[Sequence[float]])rD   rK   r+  rw   )r:  rE  )rý   rN   r:  rN   )rý   rE  r:  rE  )r:  r8  )rZ  ztuple[int, int]r:  rw   r@  )rG  rH  rI  rJ  r	   rh   r,  r]  rÅ   rS  r  r  r\  r  rb   r]   r[   rE  rE    sš   „ ñð( ñó ðð òó ðð òó ðò-ó^4ó/ð òó ðð òó ðò>ó@ó+ó+óô$)r]   rE  c                  óú   — e Zd ZdZedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Z	edd„«       Z
edd„«       Zedd	„«       Zedd
„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zy)Ú	PlaneMetaz+Plane meta class to enable class propertiesc                ó   — t        ddd«      S )zXY PlanerS  rT  r[  ©rL   rU  s    r[   ÚXYzPlaneMeta.XY�  ó   € ô �Y 	¨9Ó5Ð5r]   c                ó   — t        ddd«      S )zYZ PlanerS  rY  rT  rd  rU  s    r[   ÚYZzPlaneMeta.YZ¢  rf  r]   c                ó   — t        ddd«      S )zZX PlanerS  r[  rY  rd  rU  s    r[   ÚZXzPlaneMeta.ZX§  rf  r]   c                ó   — t        ddd«      S )zXZ PlanerS  rT  ©r   rß   r   rd  rU  s    r[   ÚXZzPlaneMeta.XZ¬  ó   € ô �Y 	¨:Ó6Ð6r]   c                ó   — t        ddd«      S )zYX PlanerS  rY  ©r   r   rß   rd  rU  s    r[   ÚYXzPlaneMeta.YX±  rn  r]   c                ó   — t        ddd«      S )zZY PlanerS  r[  ©rß   r   r   rd  rU  s    r[   ÚZYzPlaneMeta.ZY¶  rn  r]   c                ó   — t        ddd«      S )zFront PlanerS  rT  rl  rd  rU  s    r[   ÚfrontzPlaneMeta.front»  rn  r]   c                ó   — t        ddd«      S )z
Back PlanerS  rs  rY  rd  rU  s    r[   ÚbackzPlaneMeta.backÀ  s   € ô �Y 
¨IÓ6Ð6r]   c                ó   — t        ddd«      S )z
Left PlanerS  rl  rs  rd  rU  s    r[   ÚleftzPlaneMeta.leftÅ  s   € ô �Y 
¨JÓ7Ð7r]   c                ó   — t        ddd«      S )zRight PlanerS  rY  rT  rd  rU  s    r[   ÚrightzPlaneMeta.rightÊ  rf  r]   c                ó   — t        ddd«      S )z	Top PlanerS  rT  r[  rd  rU  s    r[   ÚtopzPlaneMeta.topÏ  rf  r]   c                ó   — t        ddd«      S )zBottom PlanerS  rT  rp  rd  rU  s    r[   ÚbottomzPlaneMeta.bottomÔ  rn  r]   c                ó   — t        ddd«      S )zIsometric PlanerS  )çÌ;fž æ?r‚  r   )ç3�E§yâ?g3�E§yâ¿rƒ  rd  rU  s    r[   Ú	isometriczPlaneMeta.isometricÙ  s   € ô ØØ'Ø1ó
ð 	
r]   NrÀ  )rG  rH  rI  rJ  rM  re  rh  rj  rm  rq  rt  rv  rx  rz  r|  r~  r€  r„  rb   r]   r[   rb  rb  š  s  „ Ù5àò6ó ð6ð ò6ó ð6ð ò6ó ð6ð ò7ó ð7ð ò7ó ð7ð ò7ó ð7ð ò7ó ð7ð ò7ó ð7ð ò8ó ð8ð ò6ó ð6ð ò6ó ð6ð ò7ó ð7ð ò
ó ñ
r]   rb  c                  óÜ  — e Zd ZdZed%d„«       Zed&d„«       Zed'd(d„«       Zed)d„«       Ze	 	 d*	 	 	 	 	 d+d„«       Zd„ Zd,d	„Zd-d
„Z	d-d„Z
d.d„Zd-d„Zd/d„Zd0d„Zd„ Zd-d„Zed1d„«       Zej&                  d„ «       Zd2d„Z	 	 d3	 	 	 	 	 d4d„Zd5d„Zd„ Zed6d„«       Zd7d„Z	 d8	 	 	 d9d„Zd:d„Zd;d„Zd<d„Zefd=d„Zed>d„«       Z ed?d „«       Z ed@d!„«       Z edAd"„«       Z edBd#„«       Z d$„ Z y)CrL   aø  Plane

    A plane is positioned in space with a coordinate system such that the plane is defined by
    the origin, x_dir (X direction), y_dir (Y direction), and z_dir (Z direction) of this coordinate
    system, which is the "local coordinate system" of the plane. The z_dir is a vector normal to the
    plane. The coordinate system is right-handed.

    A plane allows the use of local 2D coordinates, which are later converted to
    global, 3d coordinates when the operations are complete.

    Planes can be created from faces as workplanes for feature creation on objects.

    =========   ====== ======== ========
    Name        x_dir  y_dir    z_dir
    =========   ====== ======== ========
    XY           +x     +y       +z
    YZ           +y     +z       +x
    ZX           +z     +x       +y
    XZ           +x     +z       -y
    YX           +y     +x       -z
    ZY           +z     +y       -x
    front        +x     +z       -y
    back         -x     +z       +y
    left         -y     +z       -x
    right        +y     +z       +x
    top          +x     +y       +z
    bottom       +x     -y       -z
    isometric    +x+y   -x+y+z   +x+y-z
    =========   ====== ======== ========

    Args:
        gp_pln (gp_Pln): an OCCT plane object
        origin (tuple[float, float, float] | Vector): the origin in global coordinates
        x_dir (tuple[float, float, float] | Vector | None): an optional vector
            representing the X Direction. Defaults to None.
        z_dir (tuple[float, float, float] | Vector | None): the normal direction
            for the plane. Defaults to (0, 0, 1).

    Attributes:
        origin (Vector): global position of local (0,0,0) point
        x_dir (Vector): x direction
        y_dir (Vector): y direction
        z_dir (Vector): z direction
        local_coord_system (gp_Ax3): OCP coordinate system
        forward_transform (Matrix): forward location transformation matrix
        reverse_transform (Matrix): reverse location transformation matrix
        wrapped (gp_Pln): the OCP plane object

    Raises:
        ValueError: z_dir must be non null
        ValueError: x_dir must be non null
        ValueError: the specified x_dir is not orthogonal to the provided normal

    Returns:
        Plane: A plane

    c                óÞ   — t        «       }t        «       }t        |t        j                  | «      «      }|j                  «       \  }}t        | «      j                  ||||«       t        |«      S )z.Find the normal at the center of a TopoDS_Face)	r%   r(   r   r   Ú	Surface_sÚLowerDistanceParametersr   ÚNormalrN   )ÚfaceÚgp_pntrá   Ú	projectorÚu_valÚv_vals         r[   Úget_topods_face_normalzPlane.get_topods_face_normal	  s^   € ô “ˆÜ“ˆÜ.¨v´y×7JÑ7JÈ4Ó7PÓQˆ	Ø ×8Ñ8Ó:‰ˆˆuÜ�tÓ×#Ñ# E¨5°&¸&ÔAÜ�f‹~Ðr]   c                 ó   — y)z!Return a plane from a OCCT gp_plnNrb   )rd   Úgp_plns     r[   rh   zPlane.__init__)	  r/  r]   Nc                 ó   — y)zoReturn a plane extending the face.
        Note: for non planar face this will return the underlying work planeNrb   )rd   rŠ  r>  s      r[   rh   zPlane.__init__-	  r/  r]   c                 ó   — y)z,Return a plane aligned with a given locationNrb   r1  s     r[   rh   zPlane.__init__2	  r/  r]   c                 ó   — y)z1Return a new plane at origin with x_dir and z_dirNrb   )rd   rî   r>  rï   s       r[   rh   zPlane.__init__6	  r/  r]   c                óÈ  — d„ }d}d}d}d}d}d}	|r|d   nd}
d}d|v r|d   }nÓt        |
t        «      r|
}nÀd|v r|d   }|j                  dd«      }n¤t        |
d	«      r)t        |
j                  t
        «      r|
} ||d|d
|«      }nod|v r|d   }net        |
t        «      r|
}nRd|v r*|d   }|j                  d|«      }|j                  d|	«      }	n$	 t        |
«      } ||d|d
|«      } ||d|d|	«      }	|r	|| _        �n�|�ret        j                  |j                  «      }|j                  st        d«      ‚t        «       }t        j                  |j                  |«       t        |j!                  «       «      | _        t        |t$        «      r4t'        «       }t)        «       }t)        «       }|j+                  dd|||«       n|j-                  «       j/                  «       }|rt        |«      n
t        |«      | _        t        d„ | j0                  D «       «      | _        t2        j5                  |j                  «      | _        t        d„ | j6                  D «       «      | _        �n5|rýt9        t2        j:                  j                  dddd«      j=                  «       }|j?                  |j                  «       |j@                  | _        t        t        j                  |«      j-                  «       j/                  «       «      | _        t        d„ | j0                  D «       «      | _        t2        j5                  |«      | _        t        d„ | j6                  D «       «      | _        n6|r4t        |«      | _        |rt        |«      nd| _        t        |	«      | _        t        | d	«      rÌt        | j                  j                  «       «      | _        t        | j                  jC                  «       jE                  «       «      | _        t        | j                  jG                  «       jE                  «       «      | _$        t        | j                  jK                  «       jE                  «       «      | _        �n¨| j6                  jL                  dk(  rt        d«      ‚| j6                  jO                  «       | _        | j0                  sitQ        | j"                  jS                  «       | j6                  jU                  «       «      }t        |j/                  «       «      jO                  «       | _        nUt        | j0                  «      jL                  dk(  rt        d«      ‚t        | j0                  «      jO                  «       | _        | j6                  jW                  | j0                  «      jO                  «       | _$        t        tQ        | j"                  jS                  «       | j6                  jU                  «       | j0                  jU                  «       «      «      | _        d| _,        d| _-        d| _.        | j"                  | _/        y# t        $ r}t        |«      |‚d}~ww xY w)z8Create a plane from either an OCCT gp_pln or coordinatesc                ó>   — || v r| |   S t        |«      |kD  r||   S |S ra   )r€   )rY   r  rX   ÚindexrÖ  s        r[   ÚoptargzPlane.__init__.<locals>.optargC	  s.   € Ø�v‰~Ø˜d‘|Ð#Ü�4‹y˜5Ò Ø˜E‘{Ð"ØˆNr]   Nr[  r   z.Expected gp_Pln, Face, Location, or VectorLiker‘  rŠ  r>  rB   r8   rF   rî   rï   r”   z,Planes can only be created from planar facesrÕ  c              3  ó4   K  — | ]  }t        |d «      –— Œ y­w©é   N©r  ©rx   ry   s     r[   rz   z!Plane.__init__.<locals>.<genexpr>�	  ó   è ø€ ÐA±j°¤ a¨§±jùó   ‚c              3  ó4   K  — | ]  }t        |d «      –— Œ y­wrš  rœ  r�  s     r[   rz   z!Plane.__init__.<locals>.<genexpr>ƒ	  rž  rŸ  rÕ   rÌ   c              3  ó4   K  — | ]  }t        |d «      –— Œ y­wrš  rœ  r�  s     r[   rz   z!Plane.__init__.<locals>.<genexpr>‹	  rž  rŸ  c              3  ó4   K  — | ]  }t        |d «      –— Œ y­wrš  rœ  r�  s     r[   rz   z!Plane.__init__.<locals>.<genexpr>�	  rž  rŸ  r{   zz_dir must be non nullzx_dir must be non null)0rJ   r$   rW   rP   rB   r0   rM   rN   r…   r   r‡  Ú	is_planarrQ   r*   r   ÚSurfaceProperties_sÚCentreOfMassr=  r   r%   r(   rj  ÚPositionrû  r>  rL   r�  rï   r   re  r:   ÚMoverk  ÚXAxisrl  ÚYAxisrW  rK   r©   rÓ   r   rê   r  r®   Úlocal_coord_systemÚreverse_transformÚforward_transformrî   )rd   rX   rY   r˜  Ú	arg_planeÚarg_faceÚarg_locationÚ
arg_originÚ	arg_x_dirÚ	arg_z_dirÚarg0Útype_error_messagerŽ   ÚsurfaceÚ
propertiesr  Ú
face_x_dirÚ	tangent_vÚ	topo_faceÚax3s                       r[   rh   zPlane.__init__?	  s  € ò	ð ˆ	ØˆØˆØˆ
Øˆ	Øˆ	áˆt�AŠw DˆØMÐà�vÑØ˜xÑ(‰IÜ˜œfÔ%Ø‰IØ�vÑØ˜f‘~ˆHØŸ
™
 7¨DÓ1‰Iä�T˜9Ô%¬*°T·\±\Ä;Ô*OØˆHÙ˜v w°°a¸ÓC‰IØ˜6Ñ!Ø! *Ñ-‰LÜ˜œhÔ'Ø‰LØ˜ÑØ Ñ)ˆJØŸ
™
 7¨IÓ6ˆIØŸ
™
 7¨IÓ6‰Ið=Ü# D›\�
ñ ˜v w°°a¸ÓCˆIÙ˜v w°°a¸ÓCˆIáØ$ˆDŽLÚä×)Ñ)¨(×*:Ñ*:Ó;ˆGØ×%Ò%Ü Ð!OÓPÐPÜ%›ˆJÜ×)Ñ)¨(×*:Ñ*:¸JÔGÜ! *×"9Ñ"9Ó";Ó<ˆDŒLÜ˜'Ô#6Ô7Ü›�Ü#›X�
Ü"›H�	Ø—
‘
˜3  U¨J¸	ÕBà$×-Ñ-Ó/×:Ñ:Ó<�
Ù.7œ 	Ô*¼VÀJÓ=OˆDŒJÜÑA°d·j²jÓAÓAˆDŒJÜ×5Ñ5°h×6FÑ6FÓGˆDŒJÜÑA°d·j²jÓAÓAˆDŽJÙÜ/Ü—‘× Ñ  $¨¨T°3óç‰d‹fð ð �N‰N˜<×/Ñ/Ô0Ø'×0Ñ0ˆDŒLÜ¤	× 3Ñ 3°IÓ >× GÑ GÓ I× TÑ TÓ VÓWˆDŒJÜÑA°d·j²jÓAÓAˆDŒJÜ×5Ñ5°iÓ@ˆDŒJÜÑA°d·j²jÓAÓAˆD�JÙÜ! *Ó-ˆDŒLÙ.7œ 	Ô*¸TˆDŒJÜ 	Ó*ˆDŒJä�4˜Ô#Ü! $§,¡,×"7Ñ"7Ó"9Ó:ˆDŒLÜ §¡× 2Ñ 2Ó 4× >Ñ >Ó @ÓAˆDŒJÜ §¡× 2Ñ 2Ó 4× >Ñ >Ó @ÓAˆDŒJÜ §¡× 1Ñ 1Ó 3× =Ñ =Ó ?Ó@ˆDŽJà�z‰z× Ñ  CÒ'Ü Ð!9Ó:Ð:ØŸ™×.Ñ.Ó0ˆDŒJà—:’:Ü˜TŸ\™\×0Ñ0Ó2°D·J±J×4EÑ4EÓ4GÓH�Ü# C§N¡NÓ$4Ó5×@Ñ@ÓB�•
ä˜$Ÿ*™*Ó%×,Ñ,°Ò3Ü$Ð%=Ó>Ð>Ü# D§J¡JÓ/×:Ñ:Ó<�”
ØŸ™×)Ñ)¨$¯*©*Ó5×@Ñ@ÓBˆDŒJÜ!Ü�t—|‘|×*Ñ*Ó,¨d¯j©j×.?Ñ.?Ó.AÀ4Ç:Á:×CTÑCTÓCVÓWóˆDŒLð #'ˆÔØ!%ˆÔØ!%ˆÔØ—l‘lˆ�øôC ò =ÜÐ 2Ó3¸Ð<ûð=ús   ÃY Ù	Y!ÙYÙY!c                óz   — t        | j                  | j                  |z  z   | j                  | j                  ¬«      S )z2Move the Plane by amount in the direction of z_dirró  )rL   rî   rï   r>  )rd   Úamounts     r[   ÚoffsetzPlane.offset­	  s0   € äØ—;‘; §¡¨fÑ!4Ñ4¸D¿J¹JÈdÏjÉjô
ð 	
r]   c                óZ   — t        t        | j                  j                  «       «      «      S r  ©rL   r$   rB   r¦  rq   s    r[   r  zPlane.__copy__³	  ó   € ä”V˜DŸL™L×1Ñ1Ó3Ó4Ó5Ð5r]   c                óZ   — t        t        | j                  j                  «       «      «      S r  r¿  r  s     r[   r  zPlane.__deepcopy__·	  rÀ  r]   c                óX  — t        |t        «      st        S d}d}t        | j                  |j
                  z
  «      |k  xrj t        | j                  j                  |j                  «      dz
  «      |k  xr4 t        | j                  j                  |j                  «      dz
  «      |k  S )zAre planes equal operator ==r>   r8   )	rJ   rL   r	  r  r=  rî   rï   r±   r>  )rd   rý   Úeq_tolerance_originÚeq_tolerance_dots       r[   r  zPlane.__eq__»	  s˜   € ä˜%¤Ô'Ü!Ð!ð #ÐØÐô �—‘˜uŸ|™|Ñ+Ó,Ð/BÑBò Hä�D—J‘J—N‘N 5§;¡;Ó/°!Ñ3Ó4Ð7GÑGòHô �D—J‘J—N‘N 5§;¡;Ó/°!Ñ3Ó4Ð7GÑGð	
r]   c                óZ   — t        | j                  | j                  | j                   «      S )z'Reverse z direction of plane operator -)rL   rî   r>  rï   rq   s    r[   rõ   zPlane.__neg__Í	  s   € ä�T—[‘[ $§*¡*¨t¯z©z¨kÓ:Ð:r]   c           	     ó¢  — t        |t        «      rt        | j                  |z  «      S t	        |d«      rt	        |d«      s=t        |t
        t        f«      r:t        |D �cg c]  }t        |t        «      ‘Œ c}«      r|D �cg c]  }| |z  ‘Œ	 c}S t	        |d«      rt        |t        «      s| j                  |z  S t        d«      ‚c c}w c c}w )NÚlocal_locationsÚlocation_indexrB   zGPlanes can only be multiplied with Locations or Shapes to relocate them)
rJ   rM   rL   rF   rP   r�   rO   r~   rN   r…   )rd   rý   ri  rƒ  s       r[   rÉ   zPlane.__mul__Ñ	  s´   € Ü�eœXÔ&Ü˜Ÿ™¨Ñ.Ó/Ð/ä�EÐ,Ô-´'¸%ÐAQÔ2Rä�uœt¤U˜mÔ,Ü±eÓ<±e°”Z ¤8Õ,°eÑ<Ô=á*/Ó0©% 3�D˜3“J¨%Ñ0Ð0Ü�5˜)Ô$¬Z¸¼vÔ-FØ—=‘= 5Ñ(Ð(äØUó
ð 	
ùò =ùâ0s   Á CÂCc                ó$   — | j                  |«      S )zintersect plane with other &rú   rü   s     r[   rþ   zPlane.__and__â	  rÿ   r]   c                ó:  — dj                  d„ | j                  j                  «       D «       «      }dj                  d„ | j                  j                  «       D «       «      }dj                  d„ | j                  j                  «       D «       «      }d|› d|› d|› d�S )	zmTo String

        Convert Plane to String for display

        Returns:
            Plane as String
        rC   c              3  ó$   K  — | ]  }|d ›–— Œ
 y­wr›  rb   rœ  s     r[   rz   z!Plane.__repr__.<locals>.<genexpr>î	  s   è ø€ ÐKÑ3J¨a ! C ›zÑ3Jùrž  c              3  ó$   K  — | ]  }|d ›–— Œ
 y­wr›  rb   rœ  s     r[   rz   z!Plane.__repr__.<locals>.<genexpr>ï	  ó   è ø€ ÐHÑ2G¨Q  3 ›jÑ2Gùrž  c              3  ó$   K  — | ]  }|d ›–— Œ
 y­wr›  rb   rœ  s     r[   rz   z!Plane.__repr__.<locals>.<genexpr>ð	  rÍ  rž  z	Plane(o=(z), x=(z), z=(r¡  )rS   r=  r¦   r>  rï   )rd   Ú
origin_strÚ	x_dir_strÚ	z_dir_strs       r[   r  zPlane.__repr__æ	  s‚   € ð —Y‘YÑK°4·<±<×3HÑ3HÔ3JÓKÓKˆ
Ø—I‘IÑH°$·*±*×2EÑ2EÔ2GÓHÓHˆ	Ø—I‘IÑH°$·*±*×2EÑ2EÔ2GÓHÓHˆ	Ø˜:˜, f¨Y¨K°v¸i¸[ÈÐKÐKr]   c                ó   — |  S )zReverse z direction of planerb   rq   s    r[   rÖ   zPlane.reverseó	  s	   € àˆuˆr]   c                ó   — | j                   S )zGet the Plane origin)r=  rq   s    r[   rî   zPlane.origin÷	  s   € ð �|‰|Ðr]   c                ó
  — t        |«      | _        | j                  «        t        t	        | j                  j                  «       | j                  j                  «       | j                  j                  «       «      «      | _	        y)zSet the Plane originN)
rN   r=  Ú_calc_transformsr$   r   rê   rï   r  r>  rB   r–   s     r[   rî   zPlane.originü	  sZ   € ô ˜e“}ˆŒØ×ÑÔÜÜ�4—<‘<×&Ñ&Ó(¨$¯*©*×*;Ñ*;Ó*=¸t¿z¹z×?PÑ?PÓ?RÓSó
ˆ�r]   c                óô  — t        |d«      r|j                  €t        d«      ‚t        |d«      r�t        |j                  t        «      rut        j                  |j                  «      }t        |j                  «       |j                  «       |j                  «       «      }| j                  |«      s§t        |› d�«      ‚t        |t        t        f«      r*t        |«      }| j                  |«      sgt        |› d�«      ‚t        |t        «      r2| j                  |«      }t        |t        «      st        |› d�«      ‚|}nt        dt!        |«      › �«      ‚t#        || j$                  | j&                  ¬«      S )aR  shift plane origin

        Creates a new plane with the origin moved within the plane to the point of intersection
        of the axis or at the given Vertex. The plane's x_dir and z_dir are unchanged.

        Args:
            locator (Axis | VectorLike | Vertex): Either Axis that intersects the new
                plane origin or Vertex within Plane.

        Raises:
            ValueError: Vertex isn't within plane
            ValueError: Point isn't within plane
            ValueError: Axis doesn't intersect plane

        Returns:
            Plane: plane with new origin

        rB   z#Can't shift origin to empty locatorz is not located within planez doesn't intersect the planezInvalid locate type: ró  )rP   rB   rQ   rJ   r2   r   r„   rN   re   rf   rg   ÚcontainsrO   rK   rû   r…   rR   rL   r>  rï   )rd   ÚlocatorrŒ   Ú
new_originÚintersections        r[   Úshift_originzPlane.shift_origin
  s)  € ô& �7˜IÔ&¨7¯?©?Ð+BÜÐBÓCÐCÜ�7˜IÔ&¬:°g·o±oÄ}Ô+UÜ"Ÿ™¨¯©Ó9ˆJÜ 
§¡£°
·±³À
ÇÁÃÓOˆJØ—=‘= Ô,Ü  G 9Ð,HÐ!IÓJÐJÜ˜¤%¬ Ô1Ü ›ˆJØ—=‘= Ô)Ü  G 9Ð,HÐ!IÓJÐJÜ˜¤Ô&ØŸ>™>¨'Ó2ˆLÜ˜l¬FÔ3Ü  G 9Ð,HÐ!IÓJÐJØ%‰JäÐ3´D¸³M°?ÐCÓDÐDÜ˜J¨d¯j©jÀÇ
Á
ÔKÐKr]   c                ó´  — |€t         j                  }|D �cg c]  }t        |«      ‘Œ }}t        «       } |j                  t
        j                  |   g|¢­Ž  t        «       }|j                  |«       t        t        |«      «      }| j                  j                  |«      }| j                  j                  |«      }t        | j                  ||«      S c c}w )a  Returns a copy of this plane, rotated about the specified axes

        Since the z axis is always normal the plane, rotating around Z will
        always produce a plane that is parallel to this one.

        The origin of the workplane is unaffected by the rotation.

        Rotations are done in order x, y, z. If you need a different order,
        manually chain together multiple rotate() commands.

        Args:
            rotation (VectorLike, optional): (xDegrees, yDegrees, zDegrees).
                Defaults to (0, 0, 0).
            ordering (Intrinsic |  Extrinsic, optional): order of rotations in
                Intrinsic or Extrinsic rotation mode, defaults to Intrinsic.XYZ

        Returns:
            Plane: a copy of this plane rotated as requested.
        )r6   rƒ   r   r&   rA  rM   rB  r'   rC  rE  r"   r>  r(  rï   rL   r=  )	rd   r0  r2  rE  rF  Útrsf_rotationr“  Ú	new_x_dirÚ	new_z_dirs	            r[   ÚrotatedzPlane.rotated,
  sº   € ð2 ÐÜ —}‘}ˆHñ )1Ó1© 1”G˜A•J¨ˆÐ1Ü"“_ˆ
Ø!ˆ
×!Ñ!¤(×":Ñ":¸8Ñ"DÐPÀxÓPÜ›	ˆØ×!Ñ! *Ô-Ü¤¨Ó 7Ó8ˆð —J‘J×(Ñ(¨Ó8ˆ	Ø—J‘J×(Ñ(¨Ó8ˆ	ä�T—\‘\ 9¨iÓ8Ð8ùò 2s   —Cc                ó¼   — t        j                  | «      }|j                  j                  |j                  j	                  «       «       t        |j                  «      S )zÂChange the position & orientation of self by applying a relative location

        Args:
            loc (Location): relative change

        Returns:
            Plane: relocated plane
        )r|  r}  rB   Ú	Transformr‚  rL   )rd   rƒ  Ú	self_copys      r[   Úmovez
Plane.moveV
  sF   € ô  ×(Ñ(¨Ó.ˆ	Ø×Ñ×#Ñ# C§K¡K×$>Ñ$>Ó$@ÔAÜ�Y×&Ñ&Ó'Ð'r]   c                óè  — t        «       }t        «       }t        «       }t        «       }t        «       }t        t        | j                  j                  «       Ž t        | j                  j                  «       Ž t        | j                  j                  «       Ž «      }|j                  ||«       t        |«      |_        |j                  ||«       t        |«      |_        || _        || _        || _        y)zQComputes transformation matrices to convert between local and global coordinates.N)rE  r'   r   r%   r=  r¦   r    rï   r>  r?  r"   rB   rª  r«  r¬  )rd   Úforwardr]  Ú	forward_tÚ	inverse_tÚglobal_coord_systemrª  s          r[   rÕ  zPlane._calc_transformsc
  sÈ   € ô “(ˆÜ“(ˆä“Iˆ	Ü“Iˆ	ä$›hÐÜ#Ü�D—L‘L×)Ñ)Ó+Ð,Ü�D—J‘J×'Ñ'Ó)Ð*Ü�D—J‘J×'Ñ'Ó)Ð*ó
Ðð 	×#Ñ#Ð$7Ð9KÔLÜ" 9Ó-ˆŒà×#Ñ#Ð$6Ð8KÔLÜ" 9Ó-ˆŒà"4ˆÔØ!(ˆÔØ!(ˆÕr]   c                ó   — t        | «      S )z7Return Location representing the origin and z direction)rM   rq   s    r[   rF   zPlane.location€
  s   € ô ˜‹~Ðr]   c                ó  — t        «       }|j                  t        | j                  j	                  «       | j
                  j                  «       «      «       |j                  | j                  j                  «       «       |S )z"Return gp_Ax2 version of the plane)	r   ÚSetAxisr   rî   rê   rï   r  ÚSetXDirectionr>  r3  s     r[   Ú	to_gp_ax2zPlane.to_gp_ax2…
  sV   € ä‹xˆØ�‰”V˜DŸK™K×.Ñ.Ó0°$·*±*×2CÑ2CÓ2EÓFÔGØ×Ñ˜4Ÿ:™:×,Ñ,Ó.Ô/Øˆr]   c                ó`  — |r| j                   n| j                  }t        |t        t        f«      rt	        |«      j                  |«      S t        |t        «      rót	        |j                  j                  |j                  j                  |j                  j                  «      }t	        |j                  j                  |j                  j                  |j                  j                  «      }|j                  |«      }|j                  |«      }t        t        |j                  «       Ž t        |j                  «       Ž «      }t        |«      S t        |d«      r|j                   €t#        d«      ‚t        |d«      �rzt        |j                   t$        «      �r_t&        j(                  t*        j,                  t&        j.                  t*        j0                  t&        j2                  t*        j4                  t&        j6                  t*        j8                  t&        j:                  t*        j<                  t&        j>                  t*        j@                  t&        jB                  t*        jD                  i}	|j                   €J ‚	 |	|j                   jG                  «          }
tK        jL                  |d«      } |
tO        |j                   |j                   jQ                  «       «      jS                  «       «      |_        |S t#        dtU        |«      › d�«      ‚# tH        $ r}t#        d|› �«      |‚d}~ww xY w)aì  _to_from_local_coords

        Reposition the object relative to this plane

        Args:
            obj (VectorLike |  Shape |  BoundBox): an object to reposition. Note that
            type Any refers to all topological classes.
            to_from (bool, optional): direction of transformation. Defaults to True (to).

        Raises:
            ValueError: Unsupported object type

        Returns:
            an object of the same type, but repositioned to local coordinates
        rB   NzCant's reposition empty objectrf  zUnable to repositioned type z" with respect to local coordinates)+r¬  r«  rJ   rO   rN   r(  rÇ  rË  re   rf   rg   r‚   r   r%   r¦   rP   rB   rQ   r1   rk  rl  r.   rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  r}  r   r   r;   rR   )rd   rà  Úto_fromÚtransform_matrixÚglobal_bottom_leftÚglobal_top_rightÚlocal_bottom_leftÚlocal_top_rightÚ
local_bboxr€  r�  rŽ   Ú	new_shapes                r[   Ú_to_from_local_coordszPlane._to_from_local_coordsŒ
  sd  € ñ& 6=˜4×1Ò1À$×BXÑBXÐä�cœE¤6˜?Ô+Ü˜#“;×(Ñ(Ð)9Ó:Ð:Ü�cœ8Ô$Ü!'¨¯©¯	©	°3·7±7·9±9¸c¿g¹g¿i¹iÓ!HÐÜ% c§g¡g§i¡i°·±·±¸C¿G¹G¿I¹IÓFÐØ 2× <Ñ <Ð=MÓ NÐØ.×8Ñ8Ð9IÓJˆOÜ ÜÐ)×2Ñ2Ó4Ð5Ü˜×0Ñ0Ó2Ð3óˆJô ˜JÓ'Ð'Ü�3˜	Ô" s§{¡{Ð':ÜÐ=Ó>Ð>Ü�3˜	Õ"¤z°#·+±+¼|Õ'Lô !×.Ñ.´·±Ü ×,Ñ,¬f¯m©mÜ ×,Ñ,¬f¯m©mÜ ×,Ñ,¬f¯m©mÜ ×-Ñ-¬v¯~©~Ü ×-Ñ-¬v¯~©~Ü ×0Ñ0´&×2CÑ2CðˆLð —;‘;Ð*Ð*Ð*ðHØ)¨#¯+©+×*?Ñ*?Ó*AÑB�
ô  +×3Ñ3°C¸Ó>ˆIÙ *Ü(Ø—K‘KÐ!1×!9Ñ!9×!>Ñ!>Ó!@óç‘%“'ó!ˆIÔð
 ÐÜØ*¬4°«9¨+Ð5WÐXó
ð 	
øô ò HÜ Ð#7¸°uÐ!=Ó>ÀCÐGûðHús   É<L Ì	L-ÌL(Ì(L-c                ó&   — | j                  |d«      S )a1  Reposition the object relative to this plane

        Args:
            obj: VectorLike |  Shape |  BoundBox an object to reposition. Note that
            type Any refers to all topological classes.

        Returns:
            an object of the same type, but repositioned to local coordinates

        T©rø  ©rd   rà  s     r[   Úto_local_coordszPlane.to_local_coordsË
  s   € ð ×)Ñ)¨#¨tÓ4Ð4r]   c                ó&   — | j                  |d«      S )a3  Reposition the object relative from this plane

        Args:
            obj: VectorLike |  Shape |  BoundBox an object to reposition. Note that
            type Any refers to all topological classes.

        Returns:
            an object of the same type, but repositioned to world coordinates

        Frú  rû  s     r[   ræ  zPlane.from_local_coordsØ
  s   € ð ×)Ñ)¨#¨uÓ5Ð5r]   c                ó°   — t        «       }|j                  | j                  j                  «       |j                  j                  «       «       t	        |«      S )zAReturn a location representing the translation from self to other)r'   r?  rB   r¦  rM   )rd   rý   r“  s      r[   Úlocation_betweenzPlane.location_betweenå
  sE   € ô !›ˆØ×(Ñ(Ø�L‰L×!Ñ!Ó# U§]¡]×%;Ñ%;Ó%=ô	
ô ˜Ó'Ð'r]   c                ó>  — t        |t        «      rY| j                  j                  t	        |j
                  j                  «       |j                  j                  «       «      ||«      }|S | j                  j                  t        |«      j                  «       |«      }|S )a5  contains

        Is this point or Axis fully contained in this plane?

        Args:
            obj (VectorLike | Axis): point or Axis to  evaluate
            tolerance (float, optional): comparison tolerance. Defaults to TOLERANCE.

        Returns:
            bool: self contains point or Axis

        )
rJ   rK   rB   ÚContainsr#   rk  rê   rb  r  rN   )rd   rà  r›  r%  s       r[   r×  zPlane.containsî
  s   € ô �cœ4Ô ØŸ<™<×0Ñ0Ü�s—|‘|×*Ñ*Ó,¨c¯m©m×.BÑ.BÓ.DÓEØØóˆLð Ðð  Ÿ<™<×0Ñ0´¸³×1CÑ1CÓ1EÀyÓQˆLØÐr]   c                 ó   — y)z%Find intersection of vector and planeNrb   r.  s     r[   rû   zPlane.intersect  r/  r]   c                 ó   — y)z'Find intersection of location and planeNrb   r1  s     r[   rû   zPlane.intersect	  r/  r]   c                 ó   — y)z#Find intersection of axis and planeNrb   r3  s     r[   rû   zPlane.intersect  r/  r]   c                 ó   — y)z$Find intersection of plane and planeNrb   rë   s     r[   rû   zPlane.intersect  r/  r]   c                 ó   — y)z$Find intersection of plane and shapeNrb   )rd   rH   s     r[   rû   zPlane.intersect  r/  r]   c                ó,  — t        |i |¤Ž\  }}}}}|�Œ| j                  |«      r|S t        |j                  «      }t	        | j
                  «      }	t        ||	«      }
|
j                  «       r/|
j                  «       dk(  rt        |
j                  d«      «      }|S d }|S |�Št	        | j                  «      }t	        |j                  «      }t        ||t        «      }|j                  «       r?|j                  «       dkD  r,|j                  d«      }|j                  «       }t!        |«      S |�| j                  |«      r|S |�?t#        |«      }|j$                  | j$                  k(  r|j&                  | j&                  k(  r|S |�|j)                  | «      S y )Nr8   r   )r\   r×  r   rB   r   rª  r   ÚIsDoneÚNbPointsrN   ÚPointr   r  ÚNbLinesÚLiner¦  rK   rL   rî   rï   rû   )rd   rX   rY   rD   rE   rG   rF   rH   Ú	geom_lineÚ
geom_planeÚintersection_calculatorrº  Úsurface1Úsurface2ÚintersectorÚintersection_lineÚplns                    r[   rû   zPlane.intersect  s„  € ä/DÀdÐ/UÈfÑ/UÑ,ˆˆe�V˜X uàÐØ�}‰}˜TÔ"Ø�ä! $§,¡,Ó/ˆIÜ# D×$;Ñ$;Ó<ˆJä&3°I¸zÓ&JÐ#ð (×.Ñ.Ô0Ø+×4Ñ4Ó6¸!Ò;ô &,Ð,C×,IÑ,IÈ!Ó,LÓ%MÐ"ð &Ð%ð &*Ð"à%Ð%àÐÜ! $§,¡,Ó/ˆHÜ! %§-¡-Ó0ˆHÜ'¨°(¼IÓFˆKØ×!Ñ!Ô#¨×(;Ñ(;Ó(=ÀÒ(Aà$/×$4Ñ$4°QÓ$7Ð!à(×1Ñ1Ó3�Ü˜D“zÐ!àÐ $§-¡-°Ô"7ØˆMàÐÜ˜“/ˆCØ�z‰z˜TŸ[™[Ò(¨S¯Y©Y¸$¿*¹*Ò-DØ�àÐØ—?‘? 4Ó(Ð(ð r]   )rŠ  r0   r:  rN   )r‘  r$   ra   )rŠ  r:   r>  úVectorLike | Noner®  )Nr[  )rî   r<  r>  r  rï   r<  )r¼  rw   r:  rL   rÀ  )rý   rC  )rý   zLocation | Shaper:  zPlane | list[Plane] | Shape)rd   rL   rý   r?  r=  )rØ  zAxis | VectorLike | Vertexr:  rL   )rS  N)r0  r<  r2  zExtrinsic | Intrinsic | Noner:  rL   )rƒ  rM   r:  rL   r¿  )r:  r   )T)rà  úVectorLike | Any | BoundBoxrð  rD  )rà  r  )rà  ztuple | Vector | Any | BoundBox)rý   rL   r:  rM   )rà  zVectorLike | Axisr›  rw   r:  rD  rF  rÁ  )rD   rK   r:  zAxis | Vector | NonerÄ  )rH   r;   r:  zShape | None)!rG  rH  rI  rJ  rú  r�  r	   rh   r½  r  r  r  rõ   rÉ   rþ   r  rÖ   rM  rî   rN  rÛ  rà  rä  rÕ  rF   rî  rø  rü  ræ  rÿ  r  r×  rû   rb   r]   r[   rL   rL   ã  sí  „ ñ8ðv òó ðð ò0ó ð0ð óPó ðPð ò;ó ð;ð ð $(Ø%ð	@àð@ð !ð@ð ò	@ó ð@òl#ó\
ó6ó6ó
ó$;ó
ó"%òLóð òó ðð ‡]�]ñ
ó ð
ó%LðR  )Ø15ð(9àð(9ð /ð(9ð 
ó	(9óT(ò)ð: òó ðóð AEð=
Ø.ð=
Ø9=ó=
ó~5ó6ó(ð CLô ð. ò4ó ð4ð ò6ó ð6ð ò2ó ð2ð ò3ó ð3ð ò3ó ð3ó,)r]   rL   c                ó¾  — g }|€t        | «      t        |«      z   dz  }|�|t        j                  u rt        ddd«      S |t        j                  u rt        | «       S |t        j                  u rt        |«       S |t        j
                  u rt        |«       S t        t        t        |«      | ||«      D ]ž  \  }}}}|t        j                  k(  r|j                  | «       Œ.|t        j
                  k(  r|j                  | «       ŒT|t        j                  k(  r|j                  | «       Œz|t        j                  k(  sŒŽ|j                  d«       Œ  t        |Ž S )rõ  r”   r   )	rN   r3   ÚNONEÚMINÚMAXÚCENTERÚzipÚmapÚappend)	Ú	min_pointÚ	max_pointr÷  rØ   Úalign_offsetÚ	alignmentÚ	min_coordÚ	max_coordÚcenter_coords	            r[   rö  rö  H  s9  € ð €Là€~Ü˜Ó#¤f¨YÓ&7Ñ7¸1Ñ<ˆà€}˜¤§¡Ñ+Ü�a˜˜A‹ÐØ”—	‘	ÑÜ�yÓ!Ð!Ð!Ø”—	‘	ÑÜ�yÓ!Ð!Ð!Ø”—‘ÑÜ�v“ˆÐä9<ÜŒE�5ÓØØØö	:Ñ5ˆ	�9˜i¨ð œŸ	™	Ò!Ø×Ñ  
Õ+Øœ%Ÿ,™,Ò&Ø×Ñ  Õ.Øœ%Ÿ)™)Ò#Ø×Ñ  
Õ+Øœ%Ÿ*™*Ó$Ø×Ñ Õ"ð:ô �<Ð Ð r]   ra   )
r  r<  r   r<  r÷  rù  rØ   r  r:  rN   )vrJ  Ú
__future__r   Úcopyr|  rä  ÚjsonÚloggingÚnumpyr¬  Úmathr   r   r   r   Útypingr   r	   r
   r   Úcollections.abcr   r   Ú
OCP.TopAbsÚTopAbsrk  ÚOCP.Bndr   r   ÚOCP.BRepr   ÚOCP.BRepBndLibr   ÚOCP.BRepBuilderAPIr   r   ÚOCP.BRepGPropr   r   ÚOCP.BRepToolsr   ÚOCP.Geomr   r   r   ÚOCP.GeomAPIr   r   r   ÚOCP.gpr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   Ú	OCP.GPropr*   ÚOCP.Quantityr+   r,   Ú
OCP.TopLocr-   Ú
OCP.TopoDSr.   r/   r0   r1   r2   Úbuild123d.build_enumsr3   r4   r5   r6   r7   Útopologyr9   r:   r;   r<   Ú	getLoggerÚ
addHandlerÚNullHandlerÚloggerr  rÜ  ÚDEG2RADrÜ   r\   rN   rO   rw   r<  rK  rR   rQ  rK   rÇ  rý  rM   ÚJSONEncoderrÔ  rÜ  r  ÚRotr¯  r1  rE  rb  rL   rö  rb   r]   r[   Ú<module>rF     s6  ðòõ: #ó Û Û Û Û ç .Ó .ß :Ó :ç .å %ç $Ý Ý %ß Pß 3Ý #ß ?Ñ ?ß PÑ P÷÷ ÷ õ õ" #ß ;Ý &ß TÕ Tç WÕ Wáß3Ó3ð €× Ñ �+Ó × )Ñ )Ð*=¨'×*=Ñ*=Ó*?Ô @Ø	ˆ×	Ñ	˜;Ó	'€à€	Ø
€Ø
ˆu‰*€Ø
�‰(€ò0÷@\)ñ \)ð@ ˆU�5˜%�<Ñ Ñ  5¨°°uÐ)<Ñ#=Ñ=ÀÈÁÑOð ˆIó ðô)ˆtô )ô&V)�Xõ V)÷r
gPñ gP÷T]*ñ ]*÷@p)ñ p)ôf(�d×&Ñ&ô (÷VNañ Naôb;ˆxô ;ð| €à" U¨5°%¸Ð+>Ñ%?Ñ?€ˆiÓ ?ðô'*ˆ(ô '*÷TS)ñ S)ôlF
�ô F
ôRb	)�iõ b	)ðR !%ð	#!Øð#!àð#!ð %ð#!ð ð	#!ð
 ô#!r]   