Platform
Resources
Pricing
Sign in
Get started
Saneef H. Ansari
Consultant Designer & Developer
Workspace
Fork
Published
Utilities & Helpers
By
Saneef H. Ansari
Edited
May 27, 2022
Importers
Utilities & Helpers
Tailwind CSS
Utils: Arrays
Rams Palette
Mindfully curated color palettes by mymind
CORS Proxy using CorsProxy.io
Download HTML as Image
Print HTML Element
Substratum
Clearable Store
Change Case
Whitespace characters
Pretty Tables
Utils: Object
Notebook URL
Seed Button
Helper functions: 3D Geometry
μ Lodash
Generate a color palette
Poisson Sampling
Timer
Ratios
Helper functions: Geometry
Fit ‘N’ number of squares in a rectangle
PDF View
Feather Icons
Use Tachyons CSS in Observable
Generate a Contrasting Random Color
canvas-sketch-util
p5.js Kit for Observable
SVG.js Wrapper
Insert cell
Insert cell
projectPointOnPlane
(
[
2.5
,
1.5
,
1
]
,
[
[
0
,
0
,
4
]
,
[
1
,
1
,
4
]
,
[
2
,
1
,
4
]
]
)
Insert cell
// Formula from https://math.stackexchange.com/a/100766
function
projectPointOnPlane
(
pt
,
plane
)
{
const
[
x
,
y
,
z
]
=
pt
;
const
[
a
,
b
,
c
]
=
planeNormal
(
[
]
,
...
plane
)
;
const
[
d
,
e
,
f
]
=
plane
[
0
]
;
const
t
=
(
a
*
d
-
a
*
x
+
b
*
e
-
b
*
y
+
c
*
f
-
c
*
z
)
/
(
a
*
a
+
b
*
b
+
c
*
c
)
;
return
[
x
+
t
*
a
,
y
+
t
*
b
,
z
+
t
*
c
]
;
}
Insert cell
distance
(
[
0
,
0
,
0
]
,
[
0
,
0
,
2
]
)
Insert cell
distance
=
GLVec3
.
distance
Insert cell
// Based on @mattdesl's get-plane-normal NPM package
// https://github.com/mattdesl/get-plane-normal/blob/master/index.js
function
planeNormal
(
out
,
point1
,
point2
,
point3
)
{
let
tmp
=
[
0
,
0
,
0
]
;
GLVec3
.
sub
(
out
,
point1
,
point2
)
;
GLVec3
.
sub
(
tmp
,
point2
,
point3
)
;
GLVec3
.
cross
(
out
,
out
,
tmp
)
;
return
GLVec3
.
normalize
(
out
,
out
)
;
}
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
projectPointOnPlane
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
distance
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
planeNormal
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
GLVec3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML