18 KiB
18 KiB
In [1]:
import numpy as np
import sys
print(sys.executable)
import meshplot as mp
sys.path.append('../src/')
from smooth_surfaces import *
from utils import */opt/conda/bin/python
In [2]:
u_interval = [-1, 1]
v_interval = [-1, 1]
u_sampling = 21
v_sampling = 21In [3]:
P, F = uv_grid(u_interval, v_interval, u_sampling, v_sampling)In [164]:
a = 0.2
b = 0.2
c = -0.2
d = -0.2
e = 0In [165]:
x = compute_paraboloid_points(P, a, b, c, d, e)
x_u, x_v = compute_paraboloid_first_derivatives(P, a, b, c, d, e)
x_uu, x_uv, x_vv = compute_paraboloid_second_derivatives(P, a, b, c, d, e)In [166]:
def principal_curvatures(x_u, x_v, x_uu, x_uv, x_vv):
n = compute_surface_normal(x_u, x_v)
I = compute_first_fundamental_form(x_u, x_v)
II = compute_second_fundamental_form(x_uu, x_uv, x_vv, n)
S = compute_shape_operator(I, II)
return compute_principal_curvatures(S, x_u, x_v)In [167]:
k_1, k_2, e_1, e_2 = principal_curvatures(x_u, x_v, x_uu, x_uv, x_vv)In [168]:
K = k_1 * k_2
H = (k_1 + k_2)/2In [169]:
def plot_curvature(x, F, values):
color = bgr_color(values)
shading_options = {
"flat":False,
"wireframe":False,
"metalness": 0,
}
mp.plot(x, F, c=color, shading=shading_options)In [170]:
plot_curvature(x, F, K)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(3.1415927…
In [171]:
plot_curvature(x, F, H)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(3.1415927…
In [172]:
def plot_directions(x, F, d_1, d_2, scale=0.1):
color = np.ones((len(x), 3))
shading_options = {
"flat": False,
"wireframe":False,
"metalness": 0.05,
}
p = mp.plot(x, F, c=color, shading=shading_options)
p.add_lines(x+d_1*scale, x-d_1*scale, shading={"line_color": "red"})
p.add_lines(x+d_2*scale, x-d_2*scale, shading={"line_color": "blue"})
p.update_object()In [173]:
plot_directions(x, F, e_1, e_2, scale=0.08)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(3.1415927…
In [174]:
a_1, a_2 = compute_asymptotic_directions(k_1, k_2, e_1, e_2)In [175]:
plot_directions(x, F, a_1, a_2, scale=0.08)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(3.1415927…
In [16]:
u_interval = [0, 2*np.pi]
v_interval = [0, 2*np.pi]
u_sampling = 33
v_sampling = 33In [17]:
P, F = uv_grid(u_interval, v_interval, u_sampling, v_sampling)In [18]:
R = 2
r = 1In [19]:
x = compute_torus_points(P, R, r)
x_u, x_v = compute_torus_first_derivatives(P, R, r)
x_uu, x_uv, x_vv = compute_torus_second_derivatives(P, R, r)In [20]:
k_1, k_2, e_1, e_2 = principal_curvatures(x_u, x_v, x_uu, x_uv, x_vv)In [21]:
K = k_1 * k_2
H = (k_1 + k_2)/2In [22]:
plot_curvature(x, F, K)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0,…
In [23]:
plot_curvature(x, F, H)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0,…
In [24]:
plot_directions(x, F, e_1, e_2, scale=0.12)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0,…
In [25]:
a_1, a_2 = compute_asymptotic_directions(k_1, k_2, e_1, e_2)../src/smooth_surfaces.py:418: RuntimeWarning: invalid value encountered in sqrt sinT = np.sqrt(f)
In [26]:
plot_directions(x, F, a_1, a_2, scale=0.12)Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0,…
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: