Replies: 3 comments 1 reply
-
|
证明终于找到了 |
Beta Was this translation helpful? Give feedback.
1 reply
-
import numpy as np
from scipy.special import comb
from matplotlib import pyplot as plt
def n0(x: float, r=0) -> float:
if r != 0:
raise ValueError(f'r={r} in n0')
if 0 <= x < 1:
return 1.0
else:
return 0.0
def nr(x: float, r: int, i: int = 0):
if not isinstance(r, int) or r < 0:
raise ValueError(f'wrong r={r}')
if r == 0:
return n0(x - i)
else:
y = ((x - i) * nr(x - i, r - 1) + (r + 1 - (x - i)) * nr(x - i - 1, r - 1)) / r
return y
def main():
x = np.arange(-1, 10, 0.02)
r = 3
y1 = [nr(u, r) for u in x]
c1 = [u / r * nr(u, r - 1) for u in x]
c2 = [(r + 1 - u) / r * nr(u - 1, r - 1) for u in x]
y3 = [nr(r + 1 - u, r) for u in x]
y2 = [sum(1 / np.power(2, r) * comb(r + 1, i) * nr(2 * u - i, r) for i in range(r + 2)) for u in x]
plt.axis('equal')
plt.plot(x, y1, 'b')
plt.plot(x, c1, 'm')
plt.plot(x, c2, 'm')
plt.plot(x, y2, 'r')
plt.plot(x, y3, 'c')
for i in range(r + 2):
y = [1 / np.power(2, r) * comb(r + 1, i) * nr(2 * u - i, r) for u in x]
z = [nr(2 * u - i, r) for u in x]
plt.plot(x, y, 'g')
plt.plot(x, z, 'y')
plt.show()
if __name__ == '__main__':
main() |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment




Uh oh!
There was an error while loading. Please reload this page.
-
https://people.eecs.berkeley.edu/~sequin/CS284/LECT09/L11.html
Some Errata in C.T. Loop:
"Smooth Subdivision Surfaces based on Triangles"
Page 23, para 2:
The new vertices are NOT "the midpoints of of the line segments
connecting a faces centroid to each of its vertices (Fig.3.1)."
This would create a subdivision mask of
10 ---- 2
| |
| |
2 ---- 2
They are the centroids of the subfaces formed by the face centroid,
a corner vertex, and the two mid-edge points next to the corner.
Page 27, eqn (3.2)
The coefficient of the R-term should be 2/N.
???
In Eqn. 4.7 and 4.8 terms should be V^(l-1) instead of V^l
Beta Was this translation helpful? Give feedback.
All reactions