Python Tutorials | (back to the list of tutorials) |
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1) IPoint(pt2) IPoint(pt3) IPoint(pt4) curve1 = ICurve(pt1.dup(), pt2.dup()) curve1.mv(IVec(0,-20,30)).clr(0,0,1.) surface1 = ISurface(pt1.dup(), pt2.dup(), pt3.dup(), pt4.dup()) surface1.mv(IVec(0,0,-20)).clr(.5,0,0) surface2 = ISurface(pt1.dup(), pt2.dup(), pt3.dup(), pt4.dup()) surface2.mv(-60,0,0).clr(.5,.2,.5)
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1) IPoint(pt2) IPoint(pt3) IPoint(pt4) curve1 = ICurve(pt1.cp(), pt2.cp()) curve2 = curve1.dup() surface1 = ISurface(pt1.cp(), pt2.cp(), pt3.cp(), pt4.cp()) surface2 = surface1.dup() surface3 = surface2.cp().clr(1.0,0,0) surface4 = surface3.cp(IVec(-60, 0, 0))
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1).clr(0) IPoint(pt2).clr(0) IPoint(pt3).clr(0) IPoint(pt4).clr(0) curve1 = ICurve(pt1.cp(), pt2.cp()).clr(1.,0,0) curve1.scale(2) surface1 = ISurface(pt1.cp(),pt2.cp(),pt3.cp(),pt4.cp()).clr(1.) surface2 = surface1.dup().clr(0,0,.5) surface1.scale(2.5) surface2.scale(IVec(20,10,0), 2)
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1).clr(0) IPoint(pt2).clr(0) IPoint(pt3).clr(0) IPoint(pt4).clr(0) surface1 = ISurface(pt1.cp(),pt2.cp(),pt3.cp(),pt4.cp()).clr(1.) surface2 = surface1.dup().clr(0,0,.5) # scaling in x direction surface1.scale1d(IVec(1,0,0), 2) # scaling in vector (1,1,0) direction from center (20,10,0). surface2.scale1d(IVec(20,10,0), IVec(1,1,0), 3) # just showing the scaling direction IVec(1,1,0).show(IVec(20,10,0)).mul(50).size(10).clr(1.,0,0)
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1).clr(0) IPoint(pt2).clr(0) IPoint(pt3).clr(0) IPoint(pt4).clr(0) curve1 = ICurve(pt1.cp(), pt2.cp()).clr(1.,0,0) # rotation around y axis curve1.rot(IVec(0,1,0), PI/4) surface1 = ISurface(pt1.cp(),pt2.cp(),pt3.cp(),pt4.cp()).clr(1.) surface2 = surface1.dup().clr(0,0,.5) # rotation around z axis surface1.rot(IVec(0,0,1), PI/4) # rotation around vector (1,1,1) axis and center (20,10,0). surface2.cp().rot(IVec(20,10,0), IVec(1,1,1), PI/6) # just showing the rotation axis IVec(1,1,1).show(IVec(20,10,0)).mul(10).clr(0)
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1).clr(0) IPoint(pt2).clr(0) IPoint(pt3).clr(0) IPoint(pt4).clr(0) curve1 = ICurve(pt1.cp(), pt2.cp()).clr(1.,0,0) # reflect on a diagonal plane curve1.cp().ref(IVec(0,-10,0), IVec(0,1,0)) surface1 = ISurface(pt1.cp(),pt2.cp(),pt3.cp(),pt4.cp()).clr(1.) surface2 = surface1.dup().clr(0,0,.5) # reflect on yz-plane surface1.ref(IVec(1,0,0)) # reflect on zx-plane at (0,-20,0) surface2.ref(IVec(0,-20,0), IVec(0,1,0))
add_library('igeo') size(480,360,IG.GL) pt1 = IVec(0,0,0) pt2 = IVec(40,0,0) pt3 = IVec(40,20,0) pt4 = IVec(0,20,0) # showing original location IPoint(pt1).clr(0) IPoint(pt2).clr(0) IPoint(pt3).clr(0) IPoint(pt4).clr(0) surface1 = ISurface(pt1.cp(),pt2.cp(),pt3.cp(),pt4.cp()).clr(1.) surface2 = surface1.dup().clr(0,0,.5) # shearing in x surface1.shearXY(1, 0) # shearing in y surface2.shearXY(IVec(20,10,0), 0, -1.5)