|
1 | | -from typing import TYPE_CHECKING |
2 | | -from math import pi |
| 1 | +import math |
3 | 2 | from dataclasses import dataclass |
| 3 | +from typing import TYPE_CHECKING |
4 | 4 |
|
5 | | -import numpy as np |
6 | 5 | import gstaichi as ti |
| 6 | +import numpy as np |
7 | 7 |
|
8 | 8 | import genesis as gs |
9 | 9 | import genesis.utils.geom as gu |
@@ -36,8 +36,8 @@ def __init__(self, rigid_solver: "RigidSolver") -> None: |
36 | 36 |
|
37 | 37 | def _get_direction_grid(self): |
38 | 38 | support_res = self._support_field_static_config.support_res |
39 | | - theta = np.arange(support_res) / support_res * 2 * pi - pi |
40 | | - phi = np.arange(support_res) / support_res * pi |
| 39 | + theta = np.arange(support_res) / support_res * 2 * math.pi - math.pi |
| 40 | + phi = np.arange(support_res) / support_res * math.pi |
41 | 41 |
|
42 | 42 | spherical_coords = np.zeros([support_res, support_res, 2]) |
43 | 43 | spherical_coords[:, :, 0] = theta[:, None] |
@@ -162,8 +162,8 @@ def _func_support_mesh( |
162 | 162 | v = ti.Vector([0.0, 0.0, 0.0], dt=gs.ti_float) |
163 | 163 | vid = 0 |
164 | 164 |
|
165 | | - ii = (theta + pi) / pi / 2 * support_res |
166 | | - jj = phi / pi * support_res |
| 165 | + ii = (theta + math.pi) / math.pi / 2 * support_res |
| 166 | + jj = phi / math.pi * support_res |
167 | 167 |
|
168 | 168 | for i4 in range(4): |
169 | 169 | i, j = gs.ti_int(0), gs.ti_int(0) |
@@ -356,8 +356,8 @@ def _func_count_supports_mesh( |
356 | 356 | support_res = gs.ti_int(support_field_static_config.support_res) |
357 | 357 | dot_max = gs.ti_float(-1e20) |
358 | 358 |
|
359 | | - ii = (theta + pi) / pi / 2 * support_res |
360 | | - jj = phi / pi * support_res |
| 359 | + ii = (theta + math.pi) / math.pi / 2 * support_res |
| 360 | + jj = phi / math.pi * support_res |
361 | 361 |
|
362 | 362 | count = gs.ti_int(0) |
363 | 363 | for i4 in range(4): |
|
0 commit comments