Bagel

Bagel #

Bagel or “figure 8” is an immersion of the Klein bottle. This figure can be done by joining two Möbius strips.

Params #

NamePropTypedescription
mayorDetailnumberMayor radius detail.
minorDetailnumberMinor radius detail.
mayorRadiusnumberRadius from the hollow center of the bagel to the center of any “pipe”.
minorDetailnumberRadius from any “pipe’s” center to it’s external surface.

Showcase #

Click and drag to move the camera arround!

code #

sketch.js
// gui params
var mayorRadius = 140;
var minorRadius = 100;
var mayorDetail = 16;
var minorDetail = 16;

var gui;

function setup() {
	createCanvas(450, 450, WEBGL);
	setAttributes('antialias', true);

	easycam = createEasyCam();
	easycam.setZoomScale(false);
	
	gui = createGui('Double click to close');
	gui.addGlobals('mayorRadius', 'minorRadius', 'mayorDetail', 'minorDetail');
}

function draw() {
	background(255);
	stroke(0);
	strokeWeight(1);
	fill(0, 0, 255);

	push();
	bagel({mayorRadius, minorRadius, mayorDetail, minorDetail});
	pop();
}