Published
Edited
Jan 10, 2019
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const [[p0_x, p0_y], [p1_x, p1_y]] = ctrlpts;
drawPlot3(Object.assign(
{p0_x, p0_y, p1_x, p1_y},
domainColoringParameters))
}
Insert cell
drawPlot3 = plot3.createDrawFunction(`
uniform float p0_x;
uniform float p0_y;
uniform float p1_x;
uniform float p1_y;

vec2 f (vec2 z) {
vec2 p0 = vec2(0,0);
vec2 p0_ = vec2(p0_x, p0_y);
vec2 p1_ = vec2(p1_x,p1_y);
vec2 p1 = vec2(1,0);
vec2 a0 = cmul(vec2(3,0), p0_);
vec2 a1 = cmul(vec2(3,0), p1_);

vec2 c0 = cmul(vec2(3,0), p0_ - p0);
vec2 c1 = cmul(vec2(6,0), p1_ - p0_);
vec2 c2 = cmul(vec2(3,0), p1 - p1_);

z = cmul(vec2(.25,0), z) + vec2(.5, 0);
vec2 z_ = vec2(1,0) - z;
vec2 z_z_ = cmul(z_, z_);
vec2 z_z = cmul(z_, z);
vec2 zz = cmul(z, z);

vec2 dx = cmul(vec2(c0.x, 0), z_z_) + cmul(vec2(c1.x, 0), z_z) + cmul(vec2(c2.x, 0), zz);
vec2 dy = cmul(vec2(c0.y, 0), z_z_) + cmul(vec2(c1.y, 0), z_z) + cmul(vec2(c2.y, 0), zz);

return csqrt(cmul(dx,dx) + cmul(dy,dy));
}
`)



Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof bez = new View([[255,299],[636,205],[218,25],[576,297]])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {cadd, csub, cmul, cdiv, cinv} from '@jrus/complex'
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more