Platform
Solutions
Resources
Pricing
Sign in
Sign up
Kenton
Workspace
Fork
Published
AR
By
Kenton
Edited
Mar 28, 2021
Insert cell
md
`# AR planes`
Insert cell
renderScene
(
scene
)
Insert cell
Insert cell
Insert cell
data
=
getStates
(
)
;
Insert cell
elements
=
{
const
planes
=
data
.
map
(
plane
=>
{
const
p
=
getPosition
(
plane
)
;
return
getPoint
(
p
.
x
,
p
.
y
,
p
.
z
,
0.05
)
;
}
)
;
const
label
=
getLabel
(
"These are some planes"
,
48
,
0
,
.5
,
0
,
.075
)
;
// const label = getLabel("planes", 0, 0, 0);
return
[
...
planes
]
;
}
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.
Insert cell
function
getPosition
(
plane
)
{
const
lat
=
plane
.
latitude
;
const
lon
=
plane
.
longitude
;
// const radius = 6378.137;
const
radius
=
1
;
const
x
=
radius
*
Math
.
cos
(
lat
)
*
Math
.
cos
(
lon
)
;
const
y
=
radius
*
Math
.
cos
(
lat
)
*
Math
.
sin
(
lon
)
;
const
z
=
radius
*
Math
.
sin
(
lat
)
;
return
{
x
,
y
,
z
}
}
Insert cell
scene
=
createScene
(
elements
)
Insert cell
createExportLink
(
scene
)
Insert cell
import
{
getBox
,
getLabel
,
getLine
,
getPoint
,
createExportLink
,
createScene
,
renderScene
}
from
"@kentonpowell/ar"
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.
Try it for free
Learn more
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getStates
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
translate
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
elements
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getPosition
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
scene
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML