bcs for rectangle

This commit is contained in:
Joachim Schöberl 2015-11-11 18:44:05 +01:00
parent 546cf02dbe
commit 4176c41670

View File

@ -21,14 +21,16 @@ for l1,l2,bc in lines:
unit_square.Append( ["line", pnums[l1], pnums[l2]], bc=bc) unit_square.Append( ["line", pnums[l1], pnums[l2]], bc=bc)
def MakeRectangle (geo, p1, p2, **args): def MakeRectangle (geo, p1, p2, bc=None, bcs=None, **args):
p1x, p1y = p1 p1x, p1y = p1
p2x, p2y = p2 p2x, p2y = p2
p1x,p2x = min(p1x,p2x), max(p1x, p2x) p1x,p2x = min(p1x,p2x), max(p1x, p2x)
p1y,p2y = min(p1y,p2y), max(p1y, p2y) p1y,p2y = min(p1y,p2y), max(p1y, p2y)
if not bcs: bcs=4*[bc]
print ("bcs = ", bcs)
pts = [geo.AppendPoint(*p) for p in [(p1x,p1y), (p2x, p1y), (p2x, p2y), (p1x, p2y)]] pts = [geo.AppendPoint(*p) for p in [(p1x,p1y), (p2x, p1y), (p2x, p2y), (p1x, p2y)]]
for p1,p2 in [(0,1), (1, 2), (2, 3), (3, 0)]: for p1,p2,bc in [(0,1,bcs[0]), (1, 2, bcs[1]), (2, 3, bcs[2]), (3, 0, bcs[3])]:
geo.Append( ["line", pts[p1], pts[p2]], **args) geo.Append( ["line", pts[p1], pts[p2]], bc=bc, **args)
def MakeCircle (geo, c, r, **args): def MakeCircle (geo, c, r, **args):
cx,cy = c cx,cy = c