11import argparse
22
33import numpy as np
4- import matplotlib .pyplot as plt
5-
6- # isort: off
7- # import open3d as o3d
84import torch
9- # isort: on
10-
11- import numpy as np
125import matplotlib .pyplot as plt
136from matplotlib .collections import PolyCollection
147
@@ -68,6 +61,11 @@ def yrotate(theta):
6861
6962
7063def visualize (V , F , C ):
64+ """
65+ This function is inspired by the following URL:
66+ https://blog.scientific-python.org/matplotlib/custom-3d-engine/
67+ """
68+
7169 V = (V - (V .max (0 ) + V .min (0 )) / 2 ) / max (V .max (0 ) - V .min (0 ))
7270 MVP = perspective (40 , 1 , 1 , 100 ) @ \
7371 translate (0 , 0 , - 2.5 ) @ \
@@ -94,7 +92,7 @@ def visualize(V, F, C):
9492 frameon = False ,
9593 )
9694
97- collection = PolyCollection (T , closed = True , linewidth = 0.1 , facecolor = C , edgecolor = " black" )
95+ collection = PolyCollection (T , closed = True , linewidth = 0.1 , facecolor = C , edgecolor = ' black' )
9896 ax .add_collection (collection )
9997
10098 plt .show ()
@@ -107,7 +105,7 @@ def main():
107105 args = parser .parse_args ()
108106
109107 # Grid data
110- N = 512
108+ N = 128
111109 Nx , Ny , Nz = N - 8 , N , N + 8
112110 x , y , z = np .mgrid [:Nx , :Ny , :Nz ]
113111 x = (x / N ).astype ('float32' )
0 commit comments