Conversation
|
TODO:
|
|
@DoctorN would love a review on this, I'm for sure doing some things incorrectly GL-wise. In particular, I'm almost certain this is wrong in some way: homotopy-rs/homotopy-web/src/buffers.rs Lines 623 to 653 in a064c1b And the way I'm initializing the 2D Canvas context is maybe not all there (could explain why the text is so pixelated). |
|
Visit the preview URL for this PR (updated for commit 5af98eb): https://homotopy-rs--homotopy-io-debug-ek5ikvjk.web.app (expires Fri, 28 Oct 2022 12:02:37 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
|
Very interesting idea Nick. How deep will this go into the scaffold? |
|
This currently just uses the geometry you would get if you projected any diagram into 3D, but the intention is that this can be changed on the fly in order to draw any DAG representation of the fully exploded diagram. For instance, we might want to debug a 4D diagram by drawing all its 3D slices in the standard way, but in 3D space offset in the Z-axis (like the 'stack diagrams' we draw sometimes). |
|
|
||
| impl DebugScene { | ||
| pub fn new(ctx: &GlCtx, diagram: &Diagram) -> Result<Self> { | ||
| let cubical = match diagram.dimension() { |
There was a problem hiding this comment.
CubicalGeometry::new isn't really designed for this. What you want is a different constructor that makes a geometry containing all the points/lines but none of areas/volumes. That would be easy to write, and you wouldn't even need to use the Mesh, you can just use the exploded graph (and configure that to ignore the boundary).
| } | ||
|
|
||
| fn buffer(ctx: &mut BufferingCtx<Self>) -> Result<()> { | ||
| for (n, (tri, _)) in ctx.geom.areas.values().copied().enumerate() { |
There was a problem hiding this comment.
If you use a different geometry which contains all the points/lines (see my earlier comment about), you wouldn't need this horrible hack.
There was a problem hiding this comment.
The reason this is here is because in what gets drawn, for each edge, the endpoints are pushed together (to make a gap for the node label). This means that there's no longer a one-to-one correspondence between logical points in the geometry and points that get drawn by the renderer, rather each logical point spawns a cloud of rendered points, one for each edge touching it.
There was a problem hiding this comment.
Yeah I get that. What I meant is you're using the triangles to construct the points/lines (which is ugly) and you won't need to do once you do what I said in my comment above.
There was a problem hiding this comment.
Oh you were talking about the areas part rather than the enumerate part. Yeah, I see that. I think keeping these indices is probably a hack too but I'm not too sure how to fix it.
There was a problem hiding this comment.
Also the correct way to do this is to "inflate" the geometry before you pass it to the bufferer, like Nathan did for cylinders and spheres.
|
I'll take a look tomorrow! |
bf565cf to
e63d124
Compare
25c6a8d to
09c00e9
Compare
fa70da2 to
4dfe07f
Compare
8059097 to
6c94846
Compare

Far too frequently we need to get into the nitty gritty of a diagram, and this involves lots of tedious drawing by hand when we have a perfectly good 3D renderer already!
This is my attempt to add a function that can be called anywhere within homotopy-core, which when called will hijack the app and display a rotatable debug model of the diagram passed in:

It's a rough prototype, and I definitely need some help with the graphics stuff, but it's a decent way there.
Note that this is a debugging tool, so there is nothing to play with in the release version that the PR preview generates. To test it out, apply this patch:
and trigger the construction of an identity.