Skip to content

Commit 2a93cfe

Browse files
committed
added anchors for mdbook
1 parent 0ad4be4 commit 2a93cfe

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

1_mass_spring/square_mesh.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ANCHOR: generate
12
import numpy as np
23
import os
34

@@ -26,7 +27,9 @@ def generate(side_length, n_seg):
2627
e.append([(i + 1) * (n_seg + 1) + j, i * (n_seg + 1) + j + 1])
2728

2829
return [x, e]
30+
# ANCHOR_END: generate
2931

32+
# ANCHOR: write_to_file
3033
def write_to_file(frameNum, x, n_seg):
3134
# Check if 'output' directory exists; if not, create it
3235
if not os.path.exists('output'):
@@ -43,4 +46,5 @@ def write_to_file(frameNum, x, n_seg):
4346
for j in range(0, n_seg):
4447
#NOTE: each cell is exported as 2 triangles for rendering
4548
f.write(f"f {i * (n_seg+1) + j + 1} {(i+1) * (n_seg+1) + j + 1} {(i+1) * (n_seg+1) + j+1 + 1}\n")
46-
f.write(f"f {i * (n_seg+1) + j + 1} {(i+1) * (n_seg+1) + j+1 + 1} {i * (n_seg+1) + j+1 + 1}\n")
49+
f.write(f"f {i * (n_seg+1) + j + 1} {(i+1) * (n_seg+1) + j+1 + 1} {i * (n_seg+1) + j+1 + 1}\n")
50+
# ANCHOR_END: write_to_file

0 commit comments

Comments
 (0)