|
14 | 14 | class Cylinder(Manifold): |
15 | 15 | def __init__(self, resolution=100, r=1): |
16 | 16 | self.xyz = self.generate_xyz(resolution, 0.998, r_height=1) |
17 | | - self.mesh = np.array([]) |
18 | | - self.samples = np.array([]) |
19 | | - self.samples_2d = np.array([]) |
| 17 | + |
20 | 18 | self.distributions = DistributionLoader(CylinderDistribution, "model.distributions.cylinder").get_distributions() |
21 | 19 |
|
22 | 20 | self.r = r |
@@ -66,13 +64,16 @@ def update_sample(self, selected_distribution, selected_sampling_method, sample_ |
66 | 64 | new_sample = sampling_method.sample(sample_options, distribution_options) |
67 | 65 |
|
68 | 66 | if (new_sample is None) or new_sample.size == 0: |
69 | | - self.samples = np.empty((0, 3), dtype=float) |
70 | | - return |
| 67 | + samples = np.empty((0, 3), dtype=float) |
| 68 | + samples_2d = np.empty((0, 2), dtype=float) |
| 69 | + return (samples, samples_2d) |
71 | 70 |
|
72 | 71 | x, y, z = self.p_z_to_xyz(new_sample[:,0], new_sample[:,1], self.r) |
73 | 72 |
|
74 | | - self.samples = np.column_stack((x, y, z)) |
75 | | - self.samples_2d = new_sample |
| 73 | + samples = np.column_stack((x, y, z)) |
| 74 | + samples_2d = new_sample |
| 75 | + |
| 76 | + return (samples, samples_2d) |
76 | 77 |
|
77 | 78 |
|
78 | 79 | @staticmethod |
@@ -145,16 +146,6 @@ def _init_mesh(self, resolution=3000): |
145 | 146 | simplices_merged = np.vstack((simplices, simplices_2)) |
146 | 147 | simplices_merged = np.unique(simplices_merged, axis=0) |
147 | 148 |
|
148 | | - # throw away points at bottom so they dont stretch across |
149 | | - # eps = 1e-2 |
150 | | - # ok_mask_no_across = (pz[:, 1] > 0 + eps) & (pz[:, 1] < (2 * np.pi - eps)) |
151 | | - # ok_idx_no_across = np.where(ok_mask_no_across)[0] |
152 | | - # good_vertices_no_across = np.isin(simplices_merged, ok_idx_no_across) |
153 | | - # good_triangles_no_across = good_vertices_no_across.all(axis=1) |
154 | | - # simplices_merged = simplices_merged[good_triangles_no_across] |
155 | | - |
156 | | - |
157 | | - |
158 | 149 | def cf(xi, yi, zi, zmin=np.min(z), zmax=np.max(z)): |
159 | 150 | if zi > zmax: |
160 | 151 | zi = np.nextafter(zmax, zmin) |
|
0 commit comments