Public
Edited
Feb 14, 2023
1 star
Insert cell
Insert cell
Insert cell
// Continuously updates
{
while (true) {
group.rotation.z += 0.003;
renderer.render(scene, camera);
yield null;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
{
const a = [];

for (let x, y = 100, i = 1; i < 3; ++i) {
a.push((x = y), (y = y + i));
}
return a;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sampleGeometry = {
const vertices = [];
const tempPosition = new THREE.Vector3();

for (let i = 0; i < 30000; i++) {
sampler.sample(tempPosition);
vertices.push(tempPosition.x, tempPosition.y, tempPosition.z);
}

// sample geometry
const pointGeometry = new THREE.BufferGeometry();
pointGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(vertices, 3)
);

const pointsMaterial = new THREE.PointsMaterial({
color: "#79A6B4",
size: 0.01
});
// Shader
// const pointsMaterial = new THREE.RawShaderMaterial({
// uniforms: {
// uCanvasTexture: { value: canvasTexture },
// uSize: { value: renderer.getPixelRatio() },
// uColorInn: { value: innColor },
// uColorOut: { value: outColor }
// },
// vertexShader: VertexShader,
// fragmentShader: FragmentShader
// });

const points = new THREE.Points(pointGeometry, pointsMaterial);

return points;
}
Insert cell
group = {
const group = new THREE.Group();
scene.add(group);

group.add(landMesh);
group.add(sampleGeometry);
return group;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
a = new Float32Array(2)
Insert cell
a.flat()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more