Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix in regular_circle_polyline documentation #130

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
python -m pip install "numpy<=1.96.0"
python -m pip install scipy
python -m pip install scikit-image
python -m pip install scikit-image==0.24.0
sudo apt-get install \
libmpfr-dev \
libgmp-dev \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
${{ steps.installpython.outputs.python-path }} -m pip install "numpy<=1.96.0"
${{ steps.installpython.outputs.python-path }} -m pip install scipy
${{ steps.installpython.outputs.python-path }} -m pip install scikit-image
${{ steps.installpython.outputs.python-path }} -m pip install scikit-image==0.24.0

- name: Install c++ bindings
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
python -m pip install "numpy<=1.96.0"
python -m pip install scipy
python -m pip install scikit-image
python -m pip install scikit-image==0.24.0

# - name: Install dependencies (Windows)
# shell: bash -l {0}
Expand Down
4 changes: 2 additions & 2 deletions src/gpytoolbox/approximate_hausdorff_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def approximate_hausdorff_distance(v1,f1,v2,f2,use_cpp=True):
current_best_guess_hd = 0.0
for i in range(v1.shape[0]):
# print("Vertex %d of %d" % (i+1,v1.shape[0]))
current_best_guess_dviB = np.Inf # current best guess for d(vi,B)
current_best_guess_dviB = np.inf # current best guess for d(vi,B)

queue = [0]
while (len(queue)>0 and current_best_guess_dviB>current_best_guess_hd):
Expand Down Expand Up @@ -108,7 +108,7 @@ def approximate_hausdorff_distance(v1,f1,v2,f2,use_cpp=True):
# Now we do the other side, i.e., max(d(vB,A))
for i in range(v2.shape[0]):
# print("Vertex %d of %d" % (i+1,v2.shape[0]))
current_best_guess_dviA = np.Inf
current_best_guess_dviA = np.inf
queue = [0]
while (len(queue)>0 and current_best_guess_dviA>current_best_guess_hd):
q2 = queue.pop()
Expand Down
2 changes: 1 addition & 1 deletion src/gpytoolbox/minimum_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def minimum_distance(v1,f1,v2,f2):

first_queue_pair = [0,0]
queue = [first_queue_pair]
current_best_guess = np.Inf
current_best_guess = np.inf
while len(queue)>0:
q1, q2 = queue.pop()
# print("-----------")
Expand Down
4 changes: 2 additions & 2 deletions src/gpytoolbox/ray_polyline_intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def ray_polyline_intersect(position, direction, polyline_vertices, max_distance
Returns
-------
x : numpy double array
Vector of intersection point coordinates (np.Inf if no intersection)
Vector of intersection point coordinates (np.inf if no intersection)
n : numpy double array
Vector of polyline normal at intersection (zeros if no intersection)
ind : int
Expand Down Expand Up @@ -53,7 +53,7 @@ def ray_polyline_intersect(position, direction, polyline_vertices, max_distance
if (EC is None):
EC = edge_indices(polyline_vertices.shape[0],closed=True)
ind = -1
x = np.array([np.Inf, np.Inf])
x = np.array([np.inf, np.inf])
n = np.array([0.0, 0.0])
distance_to_hit = max_distance
for i in range(0,EC.shape[0]):
Expand Down
16 changes: 8 additions & 8 deletions src/gpytoolbox/ray_triangle_intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def ray_triangle_intersect(origin,dir, v0, v1, v2, return_negative=False):
det = np.dot(v0v1,pvec)

if (np.abs(det) < 1e-6):
t = np.Inf
hit = np.Inf*np.ones(3)
t = np.inf
hit = np.inf*np.ones(3)
is_hit = False
return t,is_hit, hit

Expand All @@ -70,17 +70,17 @@ def ray_triangle_intersect(origin,dir, v0, v1, v2, return_negative=False):
u = np.dot(tvec,pvec) * invDet

if (u < 0 or u > 1):
t = np.Inf
hit = np.Inf*np.ones(3)
t = np.inf
hit = np.inf*np.ones(3)
is_hit = False
return t,is_hit, hit

qvec = np.cross(tvec,v0v1)
v = np.dot(dir,qvec)*invDet

if ((v < 0) or ((u + v) > 1)):
t = np.Inf
hit = np.Inf*np.ones(3)
t = np.inf
hit = np.inf*np.ones(3)
is_hit = False
return t,is_hit, hit

Expand All @@ -89,8 +89,8 @@ def ray_triangle_intersect(origin,dir, v0, v1, v2, return_negative=False):
is_hit = True
if (not return_negative):
if(t<0):
t = np.Inf
hit = np.Inf*np.ones(3)
t = np.inf
hit = np.inf*np.ones(3)
is_hit = False
return t,is_hit, hit

Expand Down
16 changes: 8 additions & 8 deletions src/gpytoolbox/reach_for_the_arcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def reach_for_the_arcs(U, S,
local_search_iters=20,
local_search_t=0.01,
tol=1e-4,
clamp_value=np.Inf,
clamp_value=np.inf,
force_cpu=False,
parallel=False,
verbose=False):
Expand Down Expand Up @@ -68,7 +68,7 @@ def reach_for_the_arcs(U, S,
locally make feasible step
tol : float, optional (default 1e-4)
tolerance for determining whether a point is inside a sphere
clamp_value : float, optional (default np.Inf)
clamp_value : float, optional (default np.inf)
value to which the SDF is clamped for clamped SDF reconstruction
force_cpu : bool, optional (default False)
whether to force rasterization onto the CPU
Expand Down Expand Up @@ -259,7 +259,7 @@ def _sdf_to_point_cloud(U, S,
batch_size=10000,
num_rasterization_spheres=0,
tol=1e-4,
clamp_value=np.Inf,
clamp_value=np.inf,
force_cpu=False,
parallel=False,
verbose=False):
Expand Down Expand Up @@ -291,7 +291,7 @@ def _sdf_to_point_cloud(U, S,
Set to zero to use all spheres.
tol : float, optional (default 1e-4)
tolerance for determining whether a point is inside a sphere
clamp_value : float, optional (default np.Inf)
clamp_value : float, optional (default np.inf)
value to which the SDF is clamped for clamped SDF reconstruction
parallel : bool, optional (default False)
whether to parallelize the algorithm or not
Expand Down Expand Up @@ -461,7 +461,7 @@ def _locally_make_feasible(U, S, P,
local_search_iters=20,
batch_size=10000,
tol=1e-4,
clamp_value=np.Inf,
clamp_value=np.inf,
parallel=False,
verbose=False):
"""Given a number of SDF samples and points, tries to make each point
Expand All @@ -488,7 +488,7 @@ def _locally_make_feasible(U, S, P,
how many points in one batch. Set to 0 to disable batching.
tol : float, optional (default 1e-4)
tolerance for determining whether a point is inside a sphere
clamp_value : float, optional (default np.Inf)
clamp_value : float, optional (default np.inf)
value to which the SDF is clamped for clamped SDF reconstruction
parallel : bool, optional (default False)
whether to parallelize the algorithm or not
Expand Down Expand Up @@ -557,7 +557,7 @@ def _fine_tune_point_cloud(U, S, P, N, f,
local_search_iters=20,
local_search_t=0.01,
tol=1e-4,
clamp_value=np.Inf,
clamp_value=np.inf,
parallel=False,
verbose=False):
"""Improve the point cloud with respect to the SDF such that the
Expand Down Expand Up @@ -602,7 +602,7 @@ def _fine_tune_point_cloud(U, S, P, N, f,
locally make feasible step
tol : float, optional (default 1e-4)
tolerance for determining whether a point is inside a sphere
clamp_value : float, optional (default np.Inf)
clamp_value : float, optional (default np.inf)
value to which the SDF is clamped for clamped SDF reconstruction
parallel : bool, optional (default False)
whether to parallelize the algorithm or not
Expand Down
14 changes: 7 additions & 7 deletions src/gpytoolbox/reach_for_the_spheres.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def reach_for_the_spheres_iteration(state,
'remesh_iterations':1,
'batch_size':20000,
'fix_boundary':False,
'clamp':np.Inf, 'pseudosdf_interior':False},
'clamp':np.inf, 'pseudosdf_interior':False},
3: {'max_iter':20000, 'tol':1e-2, 'h':0.2,
'linesearch':True, 'min_t':1e-6, 'max_t':50.,
'dt':10.,
Expand All @@ -507,7 +507,7 @@ def reach_for_the_spheres_iteration(state,
'visualize':False,
'batch_size':20000,
'fix_boundary':False,
'clamp':np.Inf, 'pseudosdf_interior':False}
'clamp':np.inf, 'pseudosdf_interior':False}
}
if max_iter is None:
max_iter = default_params[dim]['max_iter']
Expand Down Expand Up @@ -566,11 +566,11 @@ def reach_for_the_spheres_iteration(state,
if state.its is None:
state.its = 0
if state.best_performance is None:
state.best_performance = np.Inf
state.best_performance = np.inf
if state.convergence_counter is None:
state.convergence_counter = 0
if state.best_avg_error is None:
state.best_avg_error = np.Inf
state.best_avg_error = np.inf
# if state.use_features is None:
# state.use_features = False
if state.V_last_converged is None:
Expand Down Expand Up @@ -687,7 +687,7 @@ def reach_for_the_spheres_iteration(state,
if state.h>state.min_h:
state.V_last_converged = state.V.copy()
state.F_last_converged = state.F.copy()
state.best_avg_error = np.Inf
state.best_avg_error = np.inf
state.convergence_counter = 0
state.h = np.maximum(state.h/2,state.min_h)
if state.convergence_counter > 100 or F_invalid.shape[0] == 0:
Expand All @@ -701,9 +701,9 @@ def reach_for_the_spheres_iteration(state,
state.U_batch = state.U.copy()
state.S_batch = state.S.copy()
state.resample_counter += 1
state.best_performance = np.Inf
state.best_performance = np.inf
state.convergence_counter = 0
state.best_avg_error = np.Inf
state.best_avg_error = np.inf
if verbose:
print(f"Resampled, I now have {state.U.shape[0]} sample points.")
else:
Expand Down
2 changes: 1 addition & 1 deletion src/gpytoolbox/regular_circle_polyline.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

def regular_circle_polyline(n):
"""Triangle mesh of a square
"""Create a circle polyline

Generates a regular polyline of a circle with radius 1 centered at the origin.

Expand Down
6 changes: 3 additions & 3 deletions src/gpytoolbox/squared_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ def __init__(self,V,F,ptest):
self.F = F
self.dim = V.shape[1]
self.ptest = ptest
self.current_best_guess = np.Inf
self.current_best_guess = np.inf
self.current_best_element = -1
self.others = []
self.num_traversal = 0
self.traversed = []
# Auxiliary function which finds the distance of point to rectangle
def sdBox(self,p,center,width):
q = np.abs(p - center) - 0.5*width
maxval = -np.Inf
maxval = -np.inf
for i in range(self.dim):
maxval = np.maximum(maxval,q[i])
return np.linalg.norm((np.maximum(q,0.0))) + np.minimum(maxval,0.0)
Expand Down Expand Up @@ -183,7 +183,7 @@ def squared_distance(P,V,F=None,use_cpp=False,use_aabb=False,C=None,W=None,CH=No
# Loop over every element
t = None
for j in range(P.shape[0]):
min_sqrd_dist = np.Inf
min_sqrd_dist = np.inf
ind = -1
best_lmb = []
for i in range(F.shape[0]):
Expand Down
2 changes: 1 addition & 1 deletion test/test_minimum_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_cube(self):
U2[:,j] += random_displacements[i]
dist = gpytoolbox.minimum_distance(V,F,U2,G)
# self.assertTrue(np.isclose(dist,0.0,atol=1e-2))
dist_gt = np.clip(random_displacements[i]-1,0,np.Inf)
dist_gt = np.clip(random_displacements[i]-1,0,np.inf)
# print(dist_gt,dist)
self.assertTrue(np.isclose(dist,dist_gt,atol=1e-4))
def test_bunny_faces(self):
Expand Down
2 changes: 1 addition & 1 deletion test/test_ray_polyline_intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_rays_against_square_2d(self):
# There should be no intersection
x, n, ind = gpytoolbox.ray_polyline_intersect(cam_pos,cam_dir,V)
# if no intersection, x is infinity and n is zero
self.assertTrue((np.isclose(x,np.array([np.Inf,np.Inf]))).all())
self.assertTrue((np.isclose(x,np.array([np.inf,np.inf]))).all())
self.assertTrue((np.isclose(n,np.array([0.0, 0.0]))).all())
# Index is -1
self.assertTrue(ind==-1)
Expand Down
Loading