I’ve adapted a LatheGeometry pen (Pot Maker, by Don Pinkus, which fills the frame) to load in a div, here: https://www.intmath.com/math-art-code/solid-revolution-maker.php
The result is blurry, as follows:
The relevant function is as follows:
function addLathe(points = []) {
let normalizedPoints = [];
for (let i = 0; i < points.length; i++) {
let scale = globals.cameraDimensions.frustrumSize;
let absDistanceFromCenter = Math.abs(-canvasFromLeft + points[i].x - canvasWidth / 2);
let nWidth = absDistanceFromCenter / (canvasWidth / 2);
let nHeight = (-canvasFromTop + points[i].y) * -1 / canvasHeight;
normalizedPoints.push(
new THREE.Vector2(
nWidth * globals.cameraDimensions.right,
nHeight * scale + globals.cameraDimensions.top
)
);
}
var geometry = new THREE.LatheGeometry(normalizedPoints, 60 );
geometry.mergeVertices();
var material = new THREE.MeshNormalMaterial({
side: THREE.DoubleSide
});
//material.magFilter = THREE.NearestFilter;
//material.minFilter = THREE.LinearMipMapLinearFilter;
var lathe = new THREE.Mesh(geometry, material);
if (globals.objects.lathe) {
scene.remove(globals.objects.lathe);
}
globals.objects.lathe = lathe;
scene.add(globals.objects.lathe);
}
I experimented with magFilter
and minFilter
on the material, but it didn’t make a difference.
I suspect it’s a problem with the normalizing and/or scaling, but couldn’t fix it.
Also, on updating to r97, I"m now seeing “Faceless geometries are not supported.” I couldn’t figure out how to fix that.