[][src]Static p5_sys::global::ellipsoid

pub static ellipsoid: EllipsoidInternalType

Draw an ellipsoid with given radius

DetailX and detailY determine the number of subdivisions in the x-dimension and the y-dimension of a cone. More subdivisions make the ellipsoid appear to be smoother. Avoid detail number above 150, it may crash the browser.

Examples

// draw an ellipsoid
// with radius 30, 40 and 40.
function setup() {
  createCanvas(100, 100, WEBGL);
}

function draw() {
  background(205, 105, 94);
  ellipsoid(30, 40, 40);
}
// slide to see how detailX works
let detailX;
function setup() {
  createCanvas(100, 100, WEBGL);
  detailX = createSlider(2, 24, 12);
  detailX.position(10, height + 5);
  detailX.style('width', '80px');
}

function draw() {
  background(205, 105, 94);
  rotateY(millis() / 1000);
  ellipsoid(30, 40, 40, detailX.value(), 8);
}
// slide to see how detailY works
let detailY;
function setup() {
  createCanvas(100, 100, WEBGL);
  detailY = createSlider(2, 24, 6);
  detailY.position(10, height + 5);
  detailY.style('width', '80px');
}

function draw() {
  background(205, 105, 9);
  rotateY(millis() / 1000);
  ellipsoid(30, 40, 40, 12, detailY.value());
}

Parameters

radiusx? x-radius of ellipsoid

radiusy? y-radius of ellipsoid

radiusz? z-radius of ellipsoid

detailX? number of segments, the more segments the smoother geometry default is 24. Avoid detail number above 150, it may crash the browser.

detailY? number of segments, the more segments the smoother geometry default is 16. Avoid detail number above 150, it may crash the browser.