Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyhedra Viewer V4 #171

Draft
wants to merge 437 commits into
base: canon
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
437 commits
Select commit Hold shift + click to select a range
4729c3d
rename the old Facet into FacetType
tesseralis Aug 9, 2020
5c72f0c
only get the right cap types
tesseralis Aug 9, 2020
a269e9e
make getCaps a generator
tesseralis Aug 9, 2020
c44a564
ElementaryForme
tesseralis Aug 9, 2020
5804f34
more restrictions on polyhedron specs
tesseralis Aug 9, 2020
941ec71
tidy up forme stuff
tesseralis Aug 9, 2020
bf15e6d
Damn this is cool
tesseralis Aug 9, 2020
e04d1ca
get rid of an as any
tesseralis Aug 9, 2020
f9e597d
cleanup
tesseralis Aug 9, 2020
ae9d5c6
fromSpecs function
tesseralis Aug 9, 2020
abfac45
adjust orientation
tesseralis Aug 9, 2020
a554ab8
orientations for elementary solids
tesseralis Aug 9, 2020
a429d17
make adjacentFaces a facet function
tesseralis Aug 9, 2020
9aa632d
get rid of validity condition in getting caps
tesseralis Aug 9, 2020
41cf7a5
tighen up cap logic and get rid of planar check
tesseralis Aug 10, 2020
30a0695
get rid of face configuration check in favor of more explicit checks
tesseralis Aug 10, 2020
d297191
switch to using drei
tesseralis Aug 11, 2020
cbda8c4
dark mode on viewer baby
tesseralis Aug 11, 2020
1db547f
make lighting more controllable
tesseralis Aug 11, 2020
59367cb
lkajsldkfjasdf
tesseralis Aug 11, 2020
8e5ce7b
correctly implement colors for formes
tesseralis Aug 11, 2020
d9cb8ad
Forme-based polyhedra appearances that work with animations (#184)
tesseralis Sep 2, 2020
7eeb6fd
remove old color picker
tesseralis Sep 2, 2020
99160d0
whoops
tesseralis Sep 2, 2020
ff1ead5
whoops
tesseralis Sep 3, 2020
1a104a7
what the heck
tesseralis Sep 3, 2020
de53193
lkasjdflkajsdf
tesseralis Sep 3, 2020
e40776b
add comment
tesseralis Sep 3, 2020
f4e038f
adjust table a bit
tesseralis Sep 5, 2020
1a37073
more adjustments
tesseralis Sep 5, 2020
32d88e6
rearrange
tesseralis Sep 5, 2020
4a0255f
can diminish octahedron
tesseralis Sep 5, 2020
29ff479
diminished polyhedra
tesseralis Sep 5, 2020
f2ff41d
simplify modification code
tesseralis Sep 5, 2020
6a12721
prepare for thing
tesseralis Sep 5, 2020
d9515ac
add more alternate names
tesseralis Sep 5, 2020
d09545a
prepare the forme
tesseralis Sep 5, 2020
8285916
more prep
tesseralis Sep 5, 2020
5391f7d
get it to render
tesseralis Sep 5, 2020
9a11810
disable for now to fix
tesseralis Sep 5, 2020
7d8ec89
distinct colors for gyrate
tesseralis Sep 6, 2020
9f7b1fc
add stub tests for gyrate stuff
tesseralis Sep 6, 2020
1e87f0e
fill in some methods
tesseralis Sep 7, 2020
fdf3e0a
implement caps method
tesseralis Sep 7, 2020
95a1ef3
get all the new tests working
tesseralis Sep 7, 2020
951d220
rely on getFacet for gyrate colors
tesseralis Sep 7, 2020
62d2112
fix the table display
tesseralis Sep 7, 2020
12ca860
fix one of the operation errors
tesseralis Sep 7, 2020
8c83a94
fix one of the errors
tesseralis Sep 13, 2020
8d10165
thing
tesseralis Sep 14, 2020
a2f39e6
get face appearance (working for tetrahedral
tesseralis Sep 14, 2020
263d0f1
add preliminary cuboctahedral tests
tesseralis Sep 15, 2020
e511e51
WIP double and halve operations
tesseralis Jun 3, 2021
73856e8
change camera on the table view
tesseralis Sep 27, 2021
7ce2695
fuck you
tesseralis Sep 30, 2021
c5fc9ca
Implement NextJS (#197)
tesseralis Oct 25, 2021
47a9328
???
tesseralis Oct 25, 2021
f345364
Merge branch 'v4' of github.com:tesseralis/polyhedra-viewer into v4
tesseralis Oct 25, 2021
40b6eb1
add individual pages for groups
tesseralis Nov 1, 2021
8d08b1e
update typescript
tesseralis Dec 13, 2021
0cb9672
update nextjs stuff
tesseralis Dec 13, 2021
14fb38a
update react-three stuff
tesseralis Dec 13, 2021
e2514d5
colors are back! (though brighter than i remembered
tesseralis Dec 14, 2021
1adb520
fix relative colors
tesseralis Dec 14, 2021
0d8ca7d
adjust section spacing
tesseralis Dec 14, 2021
ab99ef3
rudimentary index page
tesseralis Dec 14, 2021
ce00a15
rearrange group layout for later
tesseralis Dec 14, 2021
edbce77
make edges thicker
tesseralis Dec 14, 2021
87d407f
split up individual pages
tesseralis Dec 14, 2021
aa611b4
remove aphrodite
tesseralis Dec 14, 2021
20a2e20
align stuff better
tesseralis Dec 14, 2021
4cdf49e
add text back into the new pages
tesseralis Dec 14, 2021
26e6018
clean up polyhedron model
tesseralis Dec 14, 2021
8007136
more cleanup
tesseralis Dec 14, 2021
b7a305e
convert edges to declarative
tesseralis Dec 14, 2021
878638d
simplify edges
tesseralis Dec 14, 2021
d6e0fcc
clean up more
tesseralis Dec 14, 2021
948ab59
fix animations
tesseralis Dec 14, 2021
ad9cfd0
increase the vertex count
tesseralis Dec 14, 2021
d10e72b
lol just make everything really big
tesseralis Dec 14, 2021
e756f07
one final thing
tesseralis Dec 15, 2021
402123a
???
tesseralis Dec 15, 2021
4dcf90b
Merge branch 'v4' into double-halve
tesseralis Dec 15, 2021
9fa0dce
get rid of weird husky lfs thing
tesseralis Dec 15, 2021
8d81935
got it to work!
tesseralis Dec 15, 2021
2cd4f42
get aligned end in the result argument
tesseralis Dec 15, 2021
40b9c1d
template for pyramid resize
tesseralis Dec 15, 2021
234ac15
get the framework for everything set up
tesseralis Dec 16, 2021
283f34f
well at least the triangular works
tesseralis Dec 16, 2021
7570760
expansion works!
tesseralis Dec 16, 2021
42e2ec4
it workssss
tesseralis Dec 16, 2021
7285290
WIP on twist
tesseralis Dec 16, 2021
a58a3db
digonal works
tesseralis Dec 16, 2021
bb4f795
it works!
tesseralis Dec 16, 2021
5fe6f18
simplify stuff
tesseralis Dec 16, 2021
b92c375
remove react import
tesseralis Dec 16, 2021
e39c840
get typecheck working on truncateOps
tesseralis Dec 16, 2021
33b31ab
simplify combineOps arguments
tesseralis Dec 16, 2021
553f09d
:shrug:
tesseralis Dec 16, 2021
f65dacb
cleanup
tesseralis Dec 16, 2021
8ec1482
convert resizeClassical to be vertex map based
tesseralis Dec 16, 2021
113d6e9
convert resizePrism
tesseralis Dec 16, 2021
c2c0fa1
resize utils
tesseralis Dec 16, 2021
5cfd957
simplify API
tesseralis Dec 16, 2021
82ad8ac
move resizeClassical to utils
tesseralis Dec 16, 2021
2175f80
move dual
tesseralis Dec 16, 2021
d78ebe5
fix semi-expand
tesseralis Dec 16, 2021
efdf21d
reorder toLeft/toRight args
tesseralis Dec 16, 2021
ddfd52d
use resize utils for double/halve
tesseralis Dec 16, 2021
5141e25
increment decrement operations
tesseralis Dec 17, 2021
f5a23a4
simplify code for picking faces
tesseralis Dec 18, 2021
e1426fa
clarify something
tesseralis Dec 18, 2021
2786723
remove
tesseralis Dec 18, 2021
61fc1dd
get gyros to work
tesseralis Dec 18, 2021
1491763
finish implementing for digonal
tesseralis Dec 18, 2021
95d95aa
rename
tesseralis Dec 18, 2021
fe0fe12
whoops, fixed
tesseralis Dec 18, 2021
3e9335d
WIP inc/dec antiprisms
tesseralis Dec 18, 2021
8ff73c9
add a TODO
tesseralis Dec 18, 2021
86ea120
rename morph
tesseralis Dec 18, 2021
82004e5
SEMISNUB WORKS MUAHAHAHA
tesseralis Dec 18, 2021
37d933f
add cotruncate operations back in
tesseralis Dec 18, 2021
6d96933
fake out icons
tesseralis Dec 18, 2021
51be642
why does it keep doing this
tesseralis Dec 18, 2021
4105c9a
WIP get it set up
tesseralis Dec 18, 2021
5d9662e
get the graph working
tesseralis Dec 18, 2021
7aae1ce
I AM A GENIUS
tesseralis Dec 18, 2021
d3469ce
convert prism operations to morph
tesseralis Dec 18, 2021
ec57222
cleanup
tesseralis Dec 18, 2021
e478d64
WIP fix orientation of antiprisms
tesseralis Dec 19, 2021
919b02c
add a comment about the copied code
tesseralis Dec 19, 2021
18c39fb
fix increment/decrement for gyroelongated
tesseralis Dec 19, 2021
bd522f3
fix decrement to digonal antiprism
tesseralis Dec 19, 2021
4d5beed
fix double/halve for digonal antiprism
tesseralis Dec 19, 2021
4c599f7
es-ka-pe the pa-ka-gay
tesseralis Dec 19, 2021
084d890
adjust animation
tesseralis Dec 19, 2021
566642c
adjust gradient
tesseralis Dec 20, 2021
9499c3a
adjust green color
tesseralis Dec 20, 2021
ebab980
center capstones on triangular faces
tesseralis Dec 20, 2021
524a99b
center stuff correctly
tesseralis Dec 20, 2021
6d131a3
forgotten key
tesseralis Dec 20, 2021
c9fbbf4
fix a thing for now
tesseralis Dec 20, 2021
fb15462
console.log
tesseralis Dec 20, 2021
68b6150
fix existing tests
tesseralis Dec 20, 2021
1071a2f
fix cartesian function
tesseralis Dec 20, 2021
7cd410c
fix allOptionCombos function (as in make it fail when its supposed to…
tesseralis Dec 20, 2021
fbb1ff9
make a naughty list for the tests to pass for now
tesseralis Dec 20, 2021
768e27e
add a naughty list to skip failing tests I dont want to deal with for…
tesseralis Dec 20, 2021
3743202
inset: 0 for life!
tesseralis Dec 20, 2021
081b668
textuuuuuuures
tesseralis Dec 20, 2021
10b0deb
gah operations are so fucked up
tesseralis Dec 20, 2021
fab9371
adjust sizes for convenience and get rid of sidebar for now
tesseralis Dec 21, 2021
a95d7a3
switch to dark mode
tesseralis Dec 21, 2021
8cd241a
disable materials for now
tesseralis Dec 21, 2021
59465ab
rename and add icons for new archimedean operations
tesseralis Dec 21, 2021
7b6a879
adjust positions of buttons again
tesseralis Dec 21, 2021
441e585
rename chained operations
tesseralis Dec 21, 2021
ba0222f
support vertices in morph function
tesseralis Dec 22, 2021
524fe6d
switch truncateRegular to morph functions
tesseralis Dec 22, 2021
b88f9ba
convert the rest of the truncate ops
tesseralis Dec 22, 2021
7e1c9b8
some cleanup
tesseralis Dec 22, 2021
6093a81
rename buff -> pare
tesseralis Dec 22, 2021
f84a908
rename everything AGAIN
tesseralis Dec 23, 2021
3cbaeb3
simplify resizeClassical.ts
tesseralis Dec 23, 2021
454f3ee
update resizePrism and resizePyramid
tesseralis Dec 23, 2021
320a4e0
add some tests for double/halve
tesseralis Dec 23, 2021
8a4d0e6
flatten the graph list for doubleHalve
tesseralis Dec 23, 2021
b4ae3ac
rename pare
tesseralis Dec 23, 2021
c13bc05
whoops
tesseralis Dec 23, 2021
209549f
ignore wrapper
tesseralis Dec 23, 2021
1ff8bd1
add some documentation to operation pairs
tesseralis Dec 23, 2021
38988f8
restyle aug/dim functions
tesseralis Dec 23, 2021
135d4c1
rearrange gyrate
tesseralis Dec 23, 2021
2c6f437
rearrange some stuff I guess?
tesseralis Dec 23, 2021
ee91647
pyramid dual
tesseralis Dec 23, 2021
4311c90
WIP rectify pyramids
tesseralis Dec 23, 2021
382c625
leave it off somewhere idk its hard
tesseralis Dec 23, 2021
7246b4e
convert some stuff away from useStyles
tesseralis Dec 23, 2021
9e9540e
god theres so much
tesseralis Dec 23, 2021
a43cf59
get rid of unused react imports
tesseralis Dec 23, 2021
31ab684
experiment with Pose
tesseralis Dec 23, 2021
2fa0cb3
normalize based on circumsphere instead
tesseralis Dec 23, 2021
8c09f38
change the mark for a duplicate
tesseralis Dec 23, 2021
e146a43
use standardized names of digonal stuff
tesseralis Dec 23, 2021
57faa6a
better colors for snub antiprisms
tesseralis Dec 23, 2021
282b5e3
add placeholder orienting returned models
tesseralis Dec 23, 2021
53798b8
map controls?
tesseralis Dec 24, 2021
01cf473
add text descriptions
tesseralis Dec 24, 2021
6e2923e
text adjustment
tesseralis Dec 24, 2021
f2dbdb5
adjust again
tesseralis Dec 24, 2021
10c32db
comment out broken colors for now
tesseralis Dec 25, 2021
0195330
integrate morphing more into operation pairs
tesseralis Dec 25, 2021
0679189
move morph to operationPairs
tesseralis Dec 25, 2021
64b3832
get inermediary morph function ready
tesseralis Dec 27, 2021
4f21dd2
queee??
tesseralis Dec 27, 2021
c5964f4
no more morph; rearrange capstone stuff
tesseralis Dec 27, 2021
400c109
i guess its mostly fixed
tesseralis Dec 27, 2021
4ac52d5
dual colors
tesseralis Dec 27, 2021
3aede79
snub antiprism appearance
tesseralis Dec 27, 2021
3d6bfed
material animations!
tesseralis Dec 27, 2021
581a065
fix
tesseralis Dec 27, 2021
fe089f6
truncate function works
tesseralis Dec 27, 2021
cddf055
get rid of forme normalize function
tesseralis Dec 27, 2021
e63a6fe
clean
tesseralis Dec 27, 2021
fb0e9ac
make it a new thing
tesseralis Dec 27, 2021
1d75a44
Merge branch 'v4' into alternate
tesseralis Dec 27, 2021
ca41742
I have no idea how my thing works
tesseralis Dec 27, 2021
44082d8
capstones should be right
tesseralis Dec 27, 2021
da2b12f
remove last trace of normalize()
tesseralis Dec 27, 2021
37b911d
make some utility methods
tesseralis Dec 27, 2021
cd41388
Merge branch 'v4' into alternate
tesseralis Dec 27, 2021
e035d47
well, almost got it working
tesseralis Dec 27, 2021
79fba6b
pick the right faces
tesseralis Dec 27, 2021
269efb4
it works! (kind of)
tesseralis Dec 27, 2021
d380def
at least it builds
tesseralis Dec 28, 2021
cf82270
FINALLY IT WORKS
tesseralis Dec 28, 2021
10fbbf1
console log
tesseralis Dec 28, 2021
b81165f
adjust scale
tesseralis Dec 28, 2021
a5603a3
try to add alternate prism
tesseralis Dec 28, 2021
ce65b2b
get everything except digonal
tesseralis Dec 28, 2021
cc797ba
everything works except digonal
tesseralis Dec 28, 2021
e0e3739
snub antiprisms
tesseralis Dec 28, 2021
027ad55
set up alt bevelled
tesseralis Dec 28, 2021
e3b0677
set stuff up
tesseralis Dec 28, 2021
c0bc4c8
switch left and right
tesseralis Dec 28, 2021
197b3cd
maxRadius function
tesseralis Dec 28, 2021
f823b5b
Merge branch 'v4' into alternate-bevelled
tesseralis Dec 29, 2021
37ef437
kinda fix tetrahedral
tesseralis Dec 29, 2021
8690c74
increase vertex tolerance
tesseralis Dec 29, 2021
3566a75
fix crinkle cuts
tesseralis Dec 29, 2021
a3e7e7a
capstone end and typecheck
tesseralis Dec 29, 2021
bed890c
opgrid
tesseralis Dec 29, 2021
caa7192
get rid of some unused functions
tesseralis Dec 31, 2021
58cb2fd
clean
tesseralis Dec 31, 2021
a0087bf
facet face geometry
tesseralis Dec 31, 2021
b781ee7
use lib method
tesseralis Dec 31, 2021
7130fda
clean up some stuff
tesseralis Dec 31, 2021
e7d23c7
comment update
tesseralis Jan 1, 2022
073ac56
WIP rectify antiprism
tesseralis Jan 1, 2022
ccf0edc
align cross axis correctly in prisms
tesseralis Jan 1, 2022
b809290
Merge branch 'v4' into rectify-antiprism
tesseralis Jan 1, 2022
f3e5aba
square and triangle work
tesseralis Jan 1, 2022
34207e9
fix pentagonal
tesseralis Jan 3, 2022
d596346
comment out digonal for now
tesseralis Jan 3, 2022
2e6b9a4
fix edge boundary behavior
tesseralis Jan 3, 2022
8617571
fix edge orientation
tesseralis Jan 3, 2022
503e24f
better query specs for truncated antiprism forme
tesseralis Jan 3, 2022
371c345
fix rectify antiprism
tesseralis Jan 3, 2022
f26ac24
digonal semisnub fixed
tesseralis Jan 3, 2022
3b7eedc
alternation
tesseralis Jan 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
[
"next/babel",
{
"preset-react": {
"runtime": "automatic",
"importSource": "@emotion/react"
}
}
]
],
"plugins": ["@emotion/babel-plugin"]
}
15 changes: 8 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ commands:
- node/install-packages:
pkg-manager: yarn
jobs:
lint:
executor:
name: node/default
steps:
- init
- run: yarn lint
# FIXME fix linting
# lint:
# executor:
# name: node/default
# steps:
# - init
# - run: yarn lint
test:
executor:
name: node/default
Expand All @@ -29,5 +30,5 @@ jobs:
workflows:
build-and-test:
jobs:
- lint
# - lint
- test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# .next
.next
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.16.3
16.6.2
8 changes: 4 additions & 4 deletions __mocks__/react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
export { default } from 'react';
import * as React from "react"
export { default } from "react"

const memo = fn => fn;
module.exports = { ...React, memo };
const memo = (fn: any) => fn
module.exports = { ...React, memo }
File renamed without changes.
62 changes: 62 additions & 0 deletions components/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import Link from "next/link"

import { css } from "@emotion/react"
import { fonts, scales, media } from "styles"
import { usePageTitle } from "components/common"

function Title() {
return (
<h1
css={css`
color: #999;
text-align: center;
font-family: ${fonts.andaleMono};
font-size: ${scales.font[3]};
${media.mobile} {
font-size: ${scales.font[4]};
}
`}
>
Uh oh! We don't know about that polyhedron!
</h1>
)
}

function BackLink() {
return (
<Link href="/" passHref>
<a
css={css`
font-family: ${fonts.andaleMono};
font-size: ${scales.font[4]};
color: #ccc;
`}
>
Go back
</a>
</Link>
)
}

export default function ErrorPage() {
usePageTitle("Error - Polyhedra Viewer")
return (
<section
css={css`
width: 100vw;
height: 100vh;

display: grid;
gap: ${scales.spacing[2]};
align-content: center;
justify-content: center;
justify-items: center;

background-color: #111;
`}
>
<Title />
<BackLink />
</section>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The following operations are defined:
Cupolae and rotundae can be oriented two different ways: _ortho-_ means that opposite faces are aligned with each other, while _gyro-_ means that they are unaligned.
`

export const cutPaste = `
export const composite = `
The next group of Johnson solids are defined by _augmenting_, _diminishing_, and _gyrating_ uniform polyhedra.

These operations are defined:
Expand Down Expand Up @@ -112,13 +112,13 @@ Inspiration and geometric data taken from [Virtual Polyhedra] by George W. Hart.

Thank you to the countless friends and unsuspecting strangers who helped test this site and provided their feedback.

Made with [React] and [X3DOM].
Made with [react-three-fiber].

Source on [GitHub].

[Ko-fi]: https://ko-fi.com/tesseralis/
[Virtual Polyhedra]: http://www.georgehart.com/virtual-polyhedra/vp.html
[React]: https://reactjs.org/
[X3DOM]: https://www.x3dom.org/
[react-three-fiber]: https://github.com/react-spring/react-three-fiber/
[GitHub]: https://www.github.com/tesseralis/polyhedra-viewer
`
154 changes: 154 additions & 0 deletions components/MuseumPage/PolyhedronTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import { pick } from "lodash-es"
import { useRef, useState } from "react"
import { Table } from "lib/tables"
import ConfigCtx from "components/ConfigCtx"
import { fromSpecs } from "math/formes"

import { escape } from "lib/utils"
import { useFrame } from "@react-three/fiber"
import { Text } from "@react-three/drei"
// FIXME edit these imports
import getFormeColors, {
mixColor,
} from "components/ViewerPage/common/SolidScene/getFormeColors"
import PolyhedronModel from "components/ViewerPage/common/SolidScene/PolyhedronModel"

const rowSpacing = 1.75
const innerSpacing = 3

// FIXME add these typings (once we have a more concrete design)
function PolyhedronEntry({ entry, position, navigate }: any) {
const ref = useRef<any>()
const [hovered, setHovered] = useState(false)
useFrame(() => {
const rotation = ref.current?.rotation
if (rotation) {
rotation.x = 0.1
// rotation.y = 0
rotation.y += 0.0025
}
})
if (!entry || typeof entry === "string") return null
// TODO might as well make this an official method
// (it returns false for gyrobifastigium)
const isDupe = entry.name() !== entry.canonicalName()
const forme = fromSpecs(entry)
const geom = forme.orient()

const config = ConfigCtx.useState()
const faceColors = geom.faces.map((face) => {
let color = getFormeColors(forme, face)
// desaturate if it's a duplicate and decrease opacity
if (isDupe) {
color = mixColor(color, (c) => c.clone().offsetHSL(0, -0.5, -0.1))
}
if (hovered) {
color = mixColor(color, (c) => c.clone().offsetHSL(0, 0, 0.2))
}
return color
})

const textColor = isDupe ? "#444" : "#aaa"

return (
<group position={position}>
<Text
position={[0, -1.125, 0]}
fontSize={0.3}
maxWidth={2.75}
color={textColor}
textAlign="center"
anchorY="top"
>
{forme.specs.name()}
</Text>
{/* TODO duped johnson solids don't have a symbol */}
{!isDupe && (
<Text color={textColor} fontSize={0.75} position={[-1, -0.5, 1]}>
{forme.specs.conwaySymbol()}
</Text>
)}
<group ref={ref}>
<PolyhedronModel
onClick={() => navigate.push(`/${escape(entry.name())}`)}
onPointerMove={() => setHovered(true)}
onPointerOut={() => setHovered(false)}
value={geom.solidData}
appearance={faceColors}
config={pick(config, ["showFaces", "showEdges", "showInnerFaces"])}
opacity={isDupe ? 0.33 : 1}
/>
</group>
</group>
)
}

function PolyhedronEntryGroup({ entry, position, navigate }: any) {
if (!entry || typeof entry === "string") return null
if (entry instanceof Array) {
return (
<group>
{entry.map((e, i) => {
return (
<PolyhedronEntry
key={i}
entry={e}
navigate={navigate}
position={[
position[0] - innerSpacing * (0.5 - i),
position[1],
position[2],
]}
/>
)
})}
</group>
)
}
return (
<PolyhedronEntry entry={entry} navigate={navigate} position={position} />
)
}

function PolyhedronRow({ row, position, navigate, colSpacing = 7 }: any) {
return (
<group position={position}>
{row.map((entry: any, i: number) => (
<PolyhedronEntryGroup
key={i}
navigate={navigate}
entry={entry}
position={[i * colSpacing, position[1], 0]}
/>
))}
</group>
)
}

interface Props {
table: Table
// FIXME figure out how not to need to pass this all the way down
navigate: any
colSpacing?: number
}

export default function PolyhedronTable({
table,
navigate,
colSpacing,
}: Props) {
const { data } = table
return (
<group>
{data.map((row, i) => (
<PolyhedronRow
key={i}
row={row}
colSpacing={colSpacing}
navigate={navigate}
position={[-25, 5 - i * rowSpacing, 0]}
/>
))}
</group>
)
}
59 changes: 59 additions & 0 deletions components/MuseumPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { css } from "@emotion/css"
import { Canvas } from "@react-three/fiber"
import { useRouter } from "next/router"
import { tableSections } from "lib/tables"
import PolyhedronTable from "./PolyhedronTable"
import { OrthographicCamera, TrackballControls } from "@react-three/drei"

// TODO deduplicate with the controls in the other scene
const sectionSpacing = 50
const subsecSpacing = 25
// TODO why is this so slow to load??
export default function MuseumScene() {
const router = useRouter()
return (
<div
css={css`
position: absolute;
inset: 0;
background-color: #111;
`}
>
<Canvas>
<OrthographicCamera makeDefault position={[0, 0, 75]}>
{[]}
</OrthographicCamera>
<directionalLight position={[0, 0.5, 1]} />
<TrackballControls enabled noRotate panSpeed={5} />
<group>
{tableSections.map((section, i) => {
if (section.tables) {
return section.tables.map((table, j) => (
<group key={table.caption} position={[j * subsecSpacing, 0, 0]}>
<PolyhedronTable navigate={router} table={table} />
</group>
))
}
if (section.subsections) {
return section.subsections.map((subsec, j) => {
return (
<group key={j} position={[0, -(i + j) * sectionSpacing, 0]}>
{subsec.tables!.map((table, k) => (
<group
key={table.caption}
position={[k * subsecSpacing, 0, 0]}
>
<PolyhedronTable navigate={router} table={table} />
</group>
))}
</group>
)
})
}
return null
})}
</group>
</Canvas>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo } from "react"
import { memo } from "react"

import { useStyle } from "styles"
import { flexRow } from "styles/common"
Expand All @@ -20,12 +20,13 @@ function Scene({ solid, full }: Pick<Props, "solid"> & { full: boolean }) {
width: full ? "100%" : `calc(100% - ${sidebarW})`,
height: "100%",
alignSelf: "flex-start",
backgroundColor: "#111",
},
[full],
)
return (
<div {...css()}>
<SolidScene label={solid} />
<SolidScene />
<Overlay solid={solid} />
</div>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react"
import { useStyle, scales } from "styles"

import { ResizeButtons, OpGrid } from "../common"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@flow

import React from "react"
import { useStyle, scales } from "styles"

import { absolute, absoluteFull, paddingHoriz } from "styles/common"
Expand Down
Loading