Skip to content

Commit

Permalink
Fix curvatures calculation
Browse files Browse the repository at this point in the history
Christoffel symbols calculation depends on this.
  • Loading branch information
portnov committed Sep 9, 2024
1 parent 343d117 commit f72695c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions utils/surface/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1666,12 +1666,12 @@ def nurbs_surface_from_curve(curve, samples, degree_u, degree_v, num_cpts_u, num
"""

if implementation is None:
implementation = curve.get_nurbs_implementation()
implementation = SvNurbsMaths.NATIVE

t_min, t_max = curve.get_u_bounds()
ts = np.linspace(t_min, t_max, num=samples)
ts = np.linspace(t_min, t_max, num=samples, endpoint = not curve.is_closed())
points = curve.evaluate_array(ts)
surface = nurbs_surface_from_points(points, degree_u, degere_v, num_cpts_u, num_cpts_v, implementation = implementation)
surface, uv_points = nurbs_surface_from_points(points, degree_u, degree_v, num_cpts_u, num_cpts_v, implementation = implementation)
trim_curve = SvNurbsMaths.interpolate_curve(implementation, curve.get_degree(), uv_points)
return surface, trim_curve

8 changes: 4 additions & 4 deletions utils/surface/nurbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,15 +752,15 @@ def curvature_calculator(self, us, vs, order=True):

normal = np.cross(fu, fv)
norm = np.linalg.norm(normal, axis=1, keepdims=True)
normal = normal / norm
normal1 = normal / norm

fuu = derivatives[:,2,0]
fvv = derivatives[:,0,2]
fuv = derivatives[:,1,1]

nuu = (fuu * normal).sum(axis=1)
nvv = (fvv * normal).sum(axis=1)
nuv = (fuv * normal).sum(axis=1)
nuu = (fuu * normal1).sum(axis=1)
nvv = (fvv * normal1).sum(axis=1)
nuv = (fuv * normal1).sum(axis=1)

duu = np.linalg.norm(fu, axis=1) **2
dvv = np.linalg.norm(fv, axis=1) **2
Expand Down

0 comments on commit f72695c

Please sign in to comment.