MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / simple_write_obj

Function simple_write_obj

eval_code/recons/models/moge/utils3d/io/obj.py:127–146  ·  view source on GitHub ↗

Write wavefront .obj file, without preprocessing. Args: vertices (np.ndarray): [N, 3] faces (np.ndarray): [T, 3] file (Any): filepath encoding (str, optional):

(
        file: Union[str, Path],
        vertices: np.ndarray,
        faces: np.ndarray,
        encoding: Union[str, None] = None
    )

Source from the content-addressed store, hash-verified

125
126
127def simple_write_obj(
128 file: Union[str, Path],
129 vertices: np.ndarray,
130 faces: np.ndarray,
131 encoding: Union[str, None] = None
132 ):
133 """
134 Write wavefront .obj file, without preprocessing.
135
136 Args:
137 vertices (np.ndarray): [N, 3]
138 faces (np.ndarray): [T, 3]
139 file (Any): filepath
140 encoding (str, optional):
141 """
142 with open(file, 'w', encoding=encoding) as fp:
143 for v in vertices:
144 print('v', *map(float, v), file=fp)
145 for f in faces:
146 print('f', *map(int, f + 1), file=fp)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected