In [1]:
length = 10
height = (length**2 - (length/2)**2)**0.5
x = [ 0 , length , length/2 , length/2+length ,   length  ,   2*length , (5/2)*length ,  3*length , (7/2)*length  ,  3*length , 4*length ]
y = [ 0 ,   0    , -height  ,     -height     , -2*height ,  -2*height , -height      , -2*height ,  -height      ,   0       , 0 ]
 
In [2]:
import matplotlib.pyplot as plt

plt.scatter(x, y)
Out[2]:
<matplotlib.collections.PathCollection at 0x25b5d70c5f0>
No description has been provided for this image
In [3]:
%load_ext autoreload
%autoreload 2
In [4]:
import numpy as np
from utilities import *
In [5]:
coordinates = np.array([x,y]).T
print(coordinates)
[[  0.           0.        ]
 [ 10.           0.        ]
 [  5.          -8.66025404]
 [ 15.          -8.66025404]
 [ 10.         -17.32050808]
 [ 20.         -17.32050808]
 [ 25.          -8.66025404]
 [ 30.         -17.32050808]
 [ 35.          -8.66025404]
 [ 30.           0.        ]
 [ 40.           0.        ]]
In [6]:
mesh = Mesh(coordinates, length)
mesh.define_triangles()
mesh.get_all_sides();
WARNING: You should have 10 triangles --> currently only 9
In [7]:
mesh.try_triangles()
WARNING: You should have 10 triangles --> currently only 9
All triangles seem to be defined correctly!
No description has been provided for this image
In [8]:
mesh.refine_mesh()
mesh.plot_triangles()
Refining mesh...initial status:
  refinements:  0
  points:       11
  triangles:    9
  sides:        19
  side length:  10
Refinement complete...final status:
  refinements:  1
  points:       30
  triangles:    36
  sides:        65
  side length:  5.0
Time taken for refinement: 0.394123 seconds
Out[8]:
No description has been provided for this image
No description has been provided for this image

End of notebook.

© Copyright 2024 MUDE TU Delft. This work is licensed under a CC BY 4.0 License.