Published
Edited
Feb 22, 2021
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
scene = {
const scene = new ln.Scene();

// A "Cube" in ln is defined by the position of 2 points
// We are using vectors to store the X, Y and Z coordinates of a position in 3D space
const min = new ln.Vector(
params.get("min").x,
params.get("min").y,
params.get("min").z
);
const max = new ln.Vector(
params.get("max").x,
params.get("max").y,
params.get("max").z
);
const cube = new ln.Cube(min, max);

scene.add(cube);

const paths = scene.render(
eye,
center,
up,
width,
height,
fovy,
znear,
zfar,
step
);
return svg`${ln.toSVG(paths, width, height)}`;
}
Insert cell
Insert cell
eye = new ln.Vector(
params.get("eye").x,
params.get("eye").y,
params.get("eye").z
)
Insert cell
center = new ln.Vector(
params.get("center").x,
params.get("center").y,
params.get("center").z
)
Insert cell
up = new ln.Vector(params.get("up").x, params.get("up").y, params.get("up").z)
Insert cell
height = 500
Insert cell
fovy = params.get("fovy").x // vertical field of view, in degrees
Insert cell
znear = params.get("znear").x // near z plane
Insert cell
zfar = params.get("zfar").x // far z plane
Insert cell
step = 0.01 // how finely to chop the paths for visibility testing
Insert cell
Insert cell
ln = import('https://unpkg.com/@lnjs/core@0.5.0/es/index.js?module')
Insert cell
import { Range } from "@observablehq/inputs"
Insert cell
import { DraggableTable } from "@mkfreeman/draggable-table-input"
Insert cell
d3 = require("d3")
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