Public
Edited
Mar 15, 2023
2 stars
Also listed in…
Math
Teaching
PlotX3D
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {
create_surface,
show_x3d,
create_indexedFaceSet,
style
} from "@mcmcclur/plotx3d"
Insert cell
style
Insert cell
sin = Math.sin
Insert cell
cos = Math.cos
Insert cell
pi = Math.PI
Insert cell
sqrt = Math.sqrt
Insert cell
MathJax = require("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js").catch(
() => window["MathJax"]
)
Insert cell
half_moon = show_x3d(
[
create_surface(
(r, t) => [
r * cos(t),
r * sin(t),
(1 - (2 * r * cos(t) + r * sin(t))) / 4
],
[0, 2],
[0, pi],
{ color: d3.color(d3.schemeCategory10[1]).brighter(), show_mesh: false }
),
create_surface(
(z, t) => [
2 * cos(t),
2 * sin(t),
(z * (1 - (2 * 2 * cos(t) + 2 * sin(t)))) / 4
],
[0, 1],
[0, pi],
{ show_mesh: false, transparency: 0.6, color: "gray" }
),
create_indexedFaceSet(
[
[
[-2, -1, 0],
[2, -1, 0],
[2, 2, 0],
[-2, 2, 0]
]
],
{ transparency: 0.5 }
)
],
{ width: 800 }
)
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