Public
Edited
Aug 28, 2018
1 fork
35 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
uv = {
// Compute vectors
const c = sub(C, A)
const b = sub(B, A)
const p = sub(P, A)

// Compute dot products
const cc = dot(c, c)
const bc = dot(b, c)
const pc = dot(c, p)
const bb = dot(b, b)
const pb = dot(b, p)

// Compute barycentric coordinates
const denom = cc*bb - bc*bc
const u = (bb*pc - bc*pb) / denom
const v = (cc*pb - bc*pc) / denom
return [u, v]
}
Insert cell
Insert cell
intriangle = {
const [u,v] = uv
return (u >= 0) && (v >= 0) && (u + v < 1)
}
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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