
    Ti                     F    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	dS )    N   )util)
PointCloudc                    t          j        |                                                                           }|d|                    d                                                   }t          |                                          }|dk     rt          d          |d|v rd}||                    |d          }t          j
        |                                t          j                  }|                    d|f          }d}|ddddf         }	|d	k    rut          j
        |ddddf         t          j                  }t          j        |t          j        t          |          d
ft          j                  dz  fd
          }n2|dk    r,t          j
        |ddddf         t          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
             N/DATA/AppData/hermes/venv/lib/python3.11/site-packages/trimesh/exchange/xyz.pyload_xyzr-      s   $ 
8==??
+
+
1
1
3
3C #((4.. !''))E%++--  G{{:;;;SE\\	kk)S)) HSYY[[
333E =="g''D FAAArrE{H!||$qqq!""u+RX666RWc$ii^28<<<sBC!
 
 
 
A$qqq!A#v,bh777
MMx6::;;;M    Tc                     t          | t                    st          d          | j        }|r2t	          | 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   Nr
   )	col_delim)

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