How to create a triangle in mumax3 ?

335 views
Skip to first unread message

All Maths .H

unread,
Oct 14, 2023, 11:26:03 AM10/14/23
to mum...@googlegroups.com
How to create a shape such that , it has three triangles having one vertex touching all three and the shape is most likely , you have a hexagon which has 6 equilateral triangle and you want to keep three which are not neighbours of each other. Please comment. 

Антон Луценко

unread,
Oct 15, 2023, 3:49:34 AM10/15/23
to mumax2
Hi, the easiest way to do it is to use something else, e.g. Python or Wolfram, to create an image, and then load it into mumax with ImageShape. 

Josh Lauzier

unread,
Oct 15, 2023, 11:53:42 PM10/15/23
to mumax2
Hi,

There are a few different ways to do this. 

One is to build the triangle out of existing shapes that are defined in the mumax API (circles, rectangles etc). There are many ways to do that, it's just a matter of picking some geometry. Once you have the triangle you simply need to rotate it. One example of this would be something like:

SetGridsize(100, 100, 50)
SetCellsize(1e-6/100, 1e-6/100, 1e-6/50)

a:=500e-9
piece1:=circle(a)
piece2:=yrange(0,inf).transl(0, pow((pow(a/2,2)-pow(a/4,2)),0.5), 0)
piece3:=yrange(-inf,0).rotz(-60*pi/180)
piece4:=yrange(-inf,0).rotz(60*pi/180)

triangle:=((piece1.sub(piece2)).sub(piece3)).sub(piece4)
triangle2:=triangle.rotz(-120*pi/180)
triangle3:=triangle.rotz(120*pi/180)

finalgeom:=triangle.add(triangle2).add(triangle3)
setgeom(finalgeom)

Here, I started with a circle, and swept out 120 degrees to keep. That gives a sort of pie slice shape, with  2 sides of a triangle. Then one just needs to cut off the rounded top at the appropriate spot. There are probably cleaner ways to form a triangle, that is just one way that came to mind quickly.

You can also make an image and use the ImageShape() command, as previously mentioned by Anton Lutsenko. You can also use something like Python or Matlab to construct an actual OVF file, and load it using regions.loadfile(). They're all essentially equivalent, it's just a matter of personal preference.

Best,
Josh L.

Reply all
Reply to author
Forward
0 new messages