Tutorials | (back to the list of tutorials) |
import processing.opengl.*; import igeo.*; size( 480, 360, IG.GL ); new IPoint(0,0,0); new IPoint(20,0,0); new IPoint(20,20,0); new IPoint(0,20,0);
import processing.opengl.*; import igeo.*; size( 480, 360, IG.GL ); new IPoint(0,0,0).clr(255,0,0); // RGB in int new IPoint(20,0,0).clr(0,0.3,0.9); // RGB in float or double new IPoint(20,20,0).hsb(0.5,1.0,0.9); // HSB in float or double new IPoint(0,20,0).clr(255); // grayscale in int, float or double
import processing.opengl.*; import igeo.*; size( 480, 360, IG.GL ); new ICurve(0,0,0, 30,30,30); new ICurve(0,-10,0, 30,10,20).clr(0.5,0,0); new ICurve(0,-20,0, 30,-10,10).clr(1.0,0,0); // NOTE: float is put in clr() new 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
import processing.opengl.*; import igeo.*; size( 480, 360, IG.GL ); double[][] controlPoints1 = {{0,0,0}, {20,20,20}, {-20,20,0}}; new ICurve(controlPoints1, 2); // degree = 2 // to put number inside new ICurve(new double[][]{{0,15,0}, {20,35,20}, {-20,35,0}}, 2).clr(1.,0,0); // degree 1 curve (polyline) double[][] controlPoints2 = {{-60,-30,0}, {-60,-10,0}, {-40,-30,0}, {-40,-10,0}}; new ICurve(controlPoints2, 1).clr(0,1.,1.); // or you can omit the degree argument for polyline double[][] controlPoints3 = {{-30,-30,0}, {-30,-10,0}, {-10,-30,0}, {-10,-10,0}}; new ICurve(controlPoints3).clr(0,0.5,1.); // degree 2 curve double[][] controlPoints4 = {{0,-30,0}, {0,-10,0}, {20,-30,0}, {20,-10,0}}; new ICurve(controlPoints4,2).clr(.5,0,1.); // degree 3 curve double[][] controlPoints5 = {{30,-30,0}, {30,-10,0}, {50,-30,0}, {50,-10,0}}; new ICurve(controlPoints5,3).clr(1.,0,1.);
import processing.opengl.*; import igeo.*; size( 480, 360, IG.GL ); new ISurface(0,0,0, 40,40,40, 80,0,0, 40,-40,40); // 3 corner points (triangle) new ISurface(-50,40,0, -10,40,0, -50,0,0).clr(0,0,1.); // rectangle new ISurface(-50,-10,0, -10,-10,0, -10,-40,0, -50,-40,0).clr(0,1.,1.);
import processing.opengl.*; import igeo.*; size( 480, 360, IG.GL ); // 4 points in u direction, 3 points in v direction double[][][] 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 new ISurface(controlPoints, 3, 2).clr(1,.8,0);