
    j                     D    d dl ZddlmZ ddlmZ ddZd	dZdeiZdeiZ	y)
    N   )util)
PointCloudc                 f   t        j                  | j                               j                         }|d|j	                  d       j                         }t        |j                               }|dk  rt        d      |d|v rd}||j                  |d      }t        j                  |j                         t        j                        }|j                  d|f      }d}|ddddf   }	|d	k(  ryt        j                  |ddddf   t        j                        }t        j                  |t        j                  t        |      d
ft        j                        dz  fd
      }n3|dk\  r.t        j                  |ddddf   t        j                        }|j!                  |	|d       |S )a  
    Load an XYZ file into a PointCloud.

    Parameters
    ------------
    file_obj : an open file-like object
      Source data, ASCII XYZ
    delimiter : None or string
      Characters used to separate the columns of the file
      If not passed will use whitespace or commas

    Returns
    ----------
    kwargs : dict
      Data which can be passed to PointCloud constructor
    N
   znot enough columns in xyz file!, )dtype         )axis      )verticescolors)r   decode_textreadstripfindlensplit
ValueErrorreplacenparrayfloat64reshapeuint8concatenateonesupdate)
file_obj	delimiterkwargsrawfirstcolumnsr   datar   r   s
             A/DATA/.local/lib/python3.12/site-packages/trimesh/exchange/xyz.pyload_xyzr-      sk   $ 

8==?
+
1
1
3C #((4.!'')E%++- G{:;;SE\	kk)S) HHSYY[

3E =="g'D FArrE{H!|$q!"u+RXX6RWWc$i^288<sBC!
 
A$q!A#v,bhh7
MMx6:;M    c                     t        | t              st        d      | j                  }|r9t	        | d      r-| j
                  !t        j                  || j
                  f      }|d}t        j                  ||      }|S )aX  
    Export a PointCloud object to an XYZ format string.

    Parameters
    -------------
    cloud : trimesh.PointCloud
      Geometry in space
    write_colors : bool
      Write colors or not
    delimiter : None or str
      What to separate columns with

    Returns
    --------------
    export : str
      Pointcloud in XYZ format
    zobject must be PointCloudr   r
   )	col_delim)

isinstancer   r   r   hasattrr   r   hstackr   array_to_string)cloudwrite_colorsr&   r+   exports        r,   
export_xyzr8   B   su    $ eZ(455 >>Dx0U\\5Myy$-. 	!!$)<FMr.   xyz)N)TN)
numpyr    r   pointsr   r-   r8   _xyz_loaders_xyz_exporters r.   r,   <module>r@      s0      8v!H x $r.   