def main(): outie = dc.make_out(dc.outies.Rhino, "wayout") epw = fake_epw_data() minHr = 0 maxHr = 8760 origin = Point(10.0, 10.0, 0.0) recWidth = 10 recHeight = 50 for h in range(minHr, maxHr): db = epw[h]["DryBulbTemp"] rh = epw[h]["RelHumid"] recColor = Color.RGB(mapVal(db,0,365,0,1), mapVal(rh, 0,365, 0,1), .5) outie.put(rec(origin, recWidth, recHeight, recColor)) origin=origin+Vec(0, recHeight) if h%24 ==0: origin=origin+Vec(recWidth, recHeight*-24) outie.draw()
import decodes.core as dc from decodes.core import * import math, copy outie = dc.make_out(dc.outies.Rhino, "basistest") outie_red = dc.make_out(dc.outies.Rhino, "redstuff") outie_red.set_color(1.0, 0, 0) print "CS basis" cs = CS(Point(5, 5), Vec(1, -1)) pts = [Point(t, math.sin(t), 0, basis=cs) for t in drange(0, math.pi * 2, 5)] outie.put([cs, pts]) print "here are the points defined relative to their base:" for p in pts: print p print "here they are in world coords:" for p in pts: print p.basis_applied() print "you can also access point coords as you would expect, using the _x,_y, and _z attributes" print "%s,%s,%s" % (pts[2]._x, pts[2]._y, pts[2]._z) print "using the x,y and z attributes returns world coords" print "%s,%s,%s" % (pts[2].x, pts[2].y, pts[2].z) print "if we strip the basis off, points will default to the basis of R3:" pts = [p.basis_stripped() for p in pts] outie.put(pts) print "CylCS basis" print "let's plot the same points in two different bases..." cylindrical_cs = CylCS(Point(-4, 0))
import decodes.core as dc from decodes.core import * import math, copy outie = dc.make_out(dc.outies.Rhino, "basistest") outie_red = dc.make_out(dc.outies.Rhino, "redstuff") outie_red.set_color(1.0,0,0) print "CS basis" cs = CS(Point(5,5),Vec(1,-1)) pts = [Point(t,math.sin(t),0,basis=cs) for t in drange(0,math.pi*2,5)] outie.put([cs,pts]) print "here are the points defined relative to their base:" for p in pts : print p print "here they are in world coords:" for p in pts : print p.basis_applied() print "you can also access point coords as you would expect, using the _x,_y, and _z attributes" print "%s,%s,%s" %(pts[2]._x,pts[2]._y,pts[2]._z) print "using the x,y and z attributes returns world coords" print "%s,%s,%s" %(pts[2].x,pts[2].y,pts[2].z) print "if we strip the basis off, points will default to the basis of R3:" pts = [p.basis_stripped() for p in pts] outie.put(pts) print "CylCS basis" print "let's plot the same points in two different bases..." cylindrical_cs = CylCS(Point(-4,0))
import decodes.core as dc from decodes.core import * outie = dc.make_out(dc.outies.Rhino, "wayout") o = Point(0,0,10) vx = Vec(0,0,10) vy = Vec(0,10,0) cs1 = CS(o,vx,vy) cs2 = CS(Point(),Vec(1,0),Vec(0,1)) for g in [cs1,cs2] : outie.put(g) pa = Point(2,1,10) pb = Point(2,1,11) pc = Point(2,1,12) cs3 = CS(pc+Vec(0,0,1)) for g in [pa,pb,pc,cs3] : outie.put(g) xf = Xform.change_basis(cs1,cs2) csx = cs3*xf pax,pbx,pcx = map(lambda pt:pt*xf,[pa,pb,pc]) for g in [pax,pbx,pcx,csx] : outie.put(g) # for g in parr : outie.put(g) outie.draw()
import decodes.core as dc from decodes.core import * outie = dc.make_out(dc.outies.Rhino, "wayout") o = Point(0, 0, 10) vx = Vec(0, 0, 10) vy = Vec(0, 10, 0) cs1 = CS(o, vx, vy) cs2 = CS(Point(), Vec(1, 0), Vec(0, 1)) for g in [cs1, cs2]: outie.put(g) pa = Point(2, 1, 10) pb = Point(2, 1, 11) pc = Point(2, 1, 12) cs3 = CS(pc + Vec(0, 0, 1)) for g in [pa, pb, pc, cs3]: outie.put(g) xf = Xform.change_basis(cs1, cs2) csx = cs3 * xf pax, pbx, pcx = map(lambda pt: pt * xf, [pa, pb, pc]) for g in [pax, pbx, pcx, csx]: outie.put(g) # for g in parr : outie.put(g) outie.draw()