Python Tutorials | (back to the list of tutorials) |
add_library('igeo') size( 480, 360, IG.GL ) IPoint(0,0,0) IPoint(20,0,0) IPoint(20,20,0) IPoint(0,20,0)
add_library('igeo') size( 480, 360, IG.GL ) IPoint(0,0,0).clr(255,0,0) # RGB in int IPoint(20,0,0).clr(0,0.3,0.9) # RGB in float or double IPoint(20,20,0).hsb(0.5,1.0,0.9) # HSB in float or double IPoint(0,20,0).clr(255) # grayscale in int, float or double
add_library('igeo') size( 480, 360, IG.GL ) ICurve(0,0,0, 30,30,30) ICurve(0,-10,0, 30,10,20).clr(0.5,0,0) ICurve(0,-20,0, 30,-10,10).clr(1.0,0,0) # NOTE: float is put in clr() ICurve(0,-30,0, 30,-30,0).clr(1,0,0) # NOTE: int is put in clr() and the range of int in color is 0-255
add_library('igeo') size( 480, 360, IG.GL ) controlPoints1 = [[0,0,0], [20,20,20], [-20,20,0]] ICurve(controlPoints1, 2) # degree = 2 # to put number inside ICurve([[0,15,0], [20,35,20], [-20,35,0]], 2).clr(1.,0,0) # degree 1 curve (polyline) controlPoints2 = [[-60,-30,0], [-60,-10,0], [-40,-30,0], [-40,-10,0]] ICurve(controlPoints2, 1).clr(0,1.,1.) # or you can omit the degree argument for polyline controlPoints3 = [[-30,-30,0], [-30,-10,0], [-10,-30,0], [-10,-10,0]] ICurve(controlPoints3).clr(0,0.5,1.) # degree 2 curve controlPoints4 = [[0,-30,0], [0,-10,0], [20,-30,0], [20,-10,0]] ICurve(controlPoints4,2).clr(.5,0,1.) # degree 3 curve controlPoints5 = [[30,-30,0], [30,-10,0], [50,-30,0], [50,-10,0]] ICurve(controlPoints5,3).clr(1.,0,1.)
add_library('igeo') size( 480, 360, IG.GL ) ISurface(0,0,0, 40,40,40, 80,0,0, 40,-40,40) # 3 corner points (triangle) ISurface(-50,40,0, -10,40,0, -50,0,0).clr(0,0,1.) # rectangle ISurface(-50,-10,0, -10,-10,0, -10,-40,0, -50,-40,0).clr(0,1.,1.)
add_library('igeo') size( 480, 360, IG.GL ) # 4 points in u direction, 3 points in v direction controlPoints = \ [[[-30,-30, 10], [-30, 0,-20], [-30, 30, 0]], \ [[ 0,-30,-10], [ 0, 20,-50], [ 0, 30,-20]], \ [[ 30,-30,-20], [ 30, 20, 60], [ 30, 30, 30]], \ [[ 60,-30, 0], [ 60, 0, 40], [ 60, 30, 30]]] # u degree = 3, v degree = 2 ISurface(controlPoints, 3, 2).clr(1,.8,0)