003_ICurve

create NURBS curves

import processing.opengl.*;
import igeo.*;

size(960,720,IG.GL);

// controlPoints as CP

// make list and ceate curve
// new ICurve(point list,degree)
double[][] CP1 = {{0,0,0}, {20,20,20}, {-20,20,0}};
new ICurve(CP1, 2).clr(1.0); // white

// to put number inside
new ICurve(new double[][]{{0,15,0}, {20,35,20}, {-20,35,0}}, 2).clr(1.,0,0);  // red




// degree 1 curve (polyline)

double[][] CP2 = {{-60,-30,0}, {-60,-10,0}, {-40,-30,0}, {-40,-10,0}};
new ICurve(CP2, 1).clr(0,0,1.); // blue

// or you can omit the degree argument for polyline
double[][] CP3 = {{-30,-30,0}, {-30,-10,0}, {-10,-30,0}, {-10,-10,0}};
new ICurve(CP3).clr(1.0,0,1.0); //purple



// degree 2 curve

double[][] CP4 = {{0,-30,0}, {0,-10,0}, {20,-30,0}, {20,-10,0}};
new ICurve(CP4,2).clr(1.0,1.0,0); // yellow



// degree 3 curve

double[][] CP5 = {{30,-30,0}, {30,-10,0}, {50,-30,0}, {50,-10,0}};
new ICurve(CP5,3).clr(0,0.5,0); // green