On Sep 24, 2008, at 12:54 AM, adrian wrote:
I am trying to use the direction of the axis of the block to
construct the hexagonal shape. But I noticed the shape doesn't show
the hexagonal structure with 120 degree for each angle.
This is just a matter of doing the trigonometry carefully.
Here is a subroutine that I've used in the past to create hexagons (in
either Meep or MPB), given a "radius" r (the radius of an inscribed
circle), a center c, and a material m:
(define C->L (compose cartesian->lattice vector3))
(define (hexagon r c m)
(list
(make block (center c) (material m) (size (* r (sqrt 4/3)) (* 2 r))
(e1 (C->L 1 0)) (e2 (C->L 0 1)))
(make block (center c) (material m) (size (* r (sqrt 4/3)) (* 2 r))
(e2 (C->L (/ (sqrt 3) 2) 0.5)) (e1 (C->L -0.5 (/ (sqrt 3)
2))))
(make block (center c) (material m) (size (* r (sqrt 4/3)) (* 2 r))
(e2 (C->L (/ (sqrt 3) 2) -0.5)) (e1 (C->L 0.5 (/ (sqrt 3)
2))))
))
It uses the cartesian->lattice function because I typically use this
in MPB with a triangular lattice, in which case it is easier to
specify e1/e2/e3 in Cartesian coordinates. In Meep the coordinates
are always Cartesian, so this is harmless.
Steven
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss