taichi.tools.np2ply
#
- class taichi.tools.np2ply.PLYWriter(num_vertices: int, num_faces=0, face_type='tri', comment='created by PLYWriter')#
Writes numpy.array data to ply files.
- Parameters:
num_vertices (int) – number of vertices.
num_faces (int, optional) – number of faces.
face_type (str) – tri or quad.
comment (str) – comment message.
- add_face_channel(self, key: str, data_type: str, data: numpy.array)#
- add_face_id(self)#
- add_face_piece(self, piece: numpy.array)#
- add_faces(self, indices: numpy.array)#
- add_vertex_alpha(self, alpha: numpy.array)#
Sets the alpha-channel (transparent) of the vertex colors.
- Parameters:
alpha (numpy.array(float)) – the alpha-channel (transparent) of the colors.
- add_vertex_channel(self, key: str, data_type: str, data: numpy.array)#
- add_vertex_color(self, r: numpy.array, g: numpy.array, b: numpy.array)#
Sets the (r, g, b) channels of the colors at the vertices.
The three arguments are all numpy arrays of float type and have the same length.
- Parameters:
r (numpy.array(float)) – the r-channel (red) of the colors.
g (numpy.array(float)) – the g-channel (green) of the color.
b (numpy.array(float)) – the b-channel (blue) of the colors.
- add_vertex_id(self)#
Sets the ids of the vertices.
The id of a vertex is equal to its index in the vertex array.
- add_vertex_normal(self, nx: numpy.array, ny: numpy.array, nz: numpy.array)#
Add normal vectors at the vertices.
The three arguments are all numpy arrays of float type and have the same length.
- Parameters:
nx (numpy.array(float)) – x-coordinates of the normal vectors.
ny (numpy.array(float)) – y-coordinates of the normal vectors.
nz (numpy.array(float)) – z-coordinates of the normal vectors.
- add_vertex_piece(self, piece: numpy.array)#
- add_vertex_pos(self, x: numpy.array, y: numpy.array, z: numpy.array)#
Set the (x, y, z) coordinates of the vertices.
- Parameters:
x (numpy.array(float)) – x-coordinates of the vertices.
y (numpy.array(float)) – y-coordinates of the vertices.
z (numpy.array(float)) – z-coordinates of the vertices.
- add_vertex_rgba(self, r: numpy.array, g: numpy.array, b: numpy.array, a: numpy.array)#
Sets the (r, g, b, a) channels of the colors at the vertices.
- Parameters:
r (numpy.array(float)) – the r-channel (red) of the colors.
g (numpy.array(float)) – the g-channel (green) of the color.
b (numpy.array(float)) – the b-channel (blue) of the colors.
a (numpy.array(float)) – the a-channel (alpha) of the colors.
- add_vertex_vel(self, vx: numpy.array, vy: numpy.array, vz: numpy.array)#
Add velocity vectors at the vertices.
- Parameters:
vx (numpy.array(float)) – x-coordinates of the velocity vectors.
vy (numpy.array(float)) – y-coordinates of the velocity vectors.
vz (numpy.array(float)) – z-coordinates of the velocity vectors.
- export(self, path)#
- export_ascii(self, path)#
- export_frame(self, series_num: int, path: str)#
- export_frame_ascii(self, series_num: int, path: str)#
- print_header(self, path: str, _format: str)#
- sanity_check(self)#