I have defined the following planar mesh:
import meshpy.triangle as triangle
point = [ (1,1), (0.5,1), (0,1), (-0.5,1), (-1,1) ,
(-1,0.5), (-1,0), (-1,-0.5), (-1,-1),
(-0.5,-1),(0,-1), (0.5,-1), (1,-1) ,
(1,-0.5), (1,0), (1,0.5) ,
(.5,.5), (0,.5), (-.5,.5), (-.5,0),
(-.5,-.5),(0,-.5), (.5,-.5), (.5,0),]
contour = [(0,1),(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(8,9),(9,10),(10,11),(11,12),(12,13),(13,14),(14,15),(15,0), (16,17),(17,18),(18,19),(19,20),(20,21),(21,22),(22,23),(23,16),]
middle = [(0,0)] #hole
info = triangle.MeshInfo()
info.set_holes(middle)
info.set_points(point)
info.set_facets(contour)
everything works fine. But how can I refine the mesh using meshpy.triangle?
something like:
triangle.refine(info, verbose=False, refinement_func=None, quality_meshing=True, min_angle=None)
Regards
Hi
Based on Triangle user guide [https://www.cs.cmu.edu/~
quake/triangle.delaunay.html#box] check this poly file [
https://www.cs.cmu.edu/~quake/box.1.node]
You may define the contour in one set of segment
contour = [(0,1),(1,2),(2,3),(3,0),(4,5),(5,6), (6,7),(7,4)]
Then after define a point located in the hole you want to defined generate
the mesh (at the middle of the square (0,0))
middle = [(0,0)]
info.set_holes(middle)
This script should provide you your mesh :
import meshpy.triangle as triangle
point = [ (1,1),(-1,1),(-1,-1),(1,-1),(.5,.5),(-.5,.5),(-.5,-.5),(.5,-.5),(0,0)
]
contour = [(0,1),(3,0),(2,3),(1,2),(4,5),(5,6), (6,7),(7,4),] #contour +
contour_2
middle = [(0,0)] #location of the holes
info = triangle.MeshInfo()
info.set_points(point)
info.set_facets(contour)
#info.set_facets(contour_2)
info.set_holes(middle)
mesh = triangle.build(info, verbose=False, refinement_func=None,
attributes=False,
volume_constraints=True, max_volume=0.01, allow_boundary_steiner=True,
allow_volume_steiner=True, quality_meshing=True,
generate_edges=None, generate_faces=True, min_angle=None,
mesh_order=None)
Respectfully
2016-11-01 17:00 GMT+01:00 <meshpy-request(a)tiker.net>:
> Send MeshPy mailing list submissions to
> meshpy(a)tiker.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.tiker.net/listinfo/meshpy
> or, via email, send a message with subject or body 'help' to
> meshpy-request(a)tiker.net
>
> You can reach the person managing the list at
> meshpy-owner(a)tiker.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of MeshPy digest..."
>
>
> Today's Topics:
>
> 1. Triangulation of a 2D point cloud (drslump scientist)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 1 Nov 2016 13:49:30 +0000
> From: drslump scientist <drslump.scientist(a)outlook.com>
> To: "meshpy(a)tiker.net" <meshpy(a)tiker.net>
> Subject: [MeshPy] Triangulation of a 2D point cloud
> Message-ID:
> <AM4PR0701MB227410785721F07B1BD2356BFBA10@AM4PR0701MB2274.
> eurprd07.prod.outlook.com>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I have to triangulate a 2D point cloud.
>
> In order to understand how meshpy.triangle works, I am using it to mesh e
> very simple geometry made of a square with a hole in the center:
>
>
> - Grometry contour points = (1,1),(-1,1),(-1,-1),(1,-1)
>
> - Hole contour points = (.5,.5),(-.5,.5),(-.5,-.5),(.5,-.5)
>
>
> Here is the code:
>
> import meshpy.triangle as triangle
>
> point = [ (1,1),(-1,1),(-1,-1),(1,-1),(.5,.5),(-.5,.5),(-.5,-.5),(.5,-.5)
> ]
> contour = [(0,1),(1,2),(2,3),(3,0),]
> contour_2 = [(4,5),(5,6), (6,7),(7,4)] #contour of the hole
>
> info = triangle.MeshInfo()
> info.set_points(point)
> info.set_facets(contour)
> info.set_holes(contour_2)
> #
> mesh = triangle.build(info, verbose=False, refinement_func=None,
> attributes=False,
> volume_constraints=True, max_volume=0.01,
> allow_boundary_steiner=True,
> allow_volume_steiner=True, quality_meshing=True,
> generate_edges=None, generate_faces=True, min_angle=None,
> mesh_order=None)
>
> Everything works properly, but I can't figure out how to define the hole
> in the mesh
>
>
> Regards
>
>
I have to triangulate a 2D point cloud.
In order to understand how meshpy.triangle works, I am using it to mesh e very simple geometry made of a square with a hole in the center:
- Grometry contour points = (1,1),(-1,1),(-1,-1),(1,-1)
- Hole contour points = (.5,.5),(-.5,.5),(-.5,-.5),(.5,-.5)
Here is the code:
import meshpy.triangle as triangle
point = [ (1,1),(-1,1),(-1,-1),(1,-1),(.5,.5),(-.5,.5),(-.5,-.5),(.5,-.5) ]
contour = [(0,1),(1,2),(2,3),(3,0),]
contour_2 = [(4,5),(5,6), (6,7),(7,4)] #contour of the hole
info = triangle.MeshInfo()
info.set_points(point)
info.set_facets(contour)
info.set_holes(contour_2)
#
mesh = triangle.build(info, verbose=False, refinement_func=None, attributes=False,
volume_constraints=True, max_volume=0.01, allow_boundary_steiner=True,
allow_volume_steiner=True, quality_meshing=True,
generate_edges=None, generate_faces=True, min_angle=None,
mesh_order=None)
Everything works properly, but I can't figure out how to define the hole in the mesh
Regards