Sweep operation only works for sketches that are symmetric to the x-axis #230
Labels
topic: core
Issues relating to core geometry, operations, algorithms
type: bug
Something isn't working
Milestone
A sketch has a defined top and bottom side. The top side points upwards, along the z-axis.
When sweeping a sketch into a 3D shape, the original sketch is re-used for the top and bottom face of the new shape:
That second part is the problem. Did you notice how I said "turned around"? That's actually wrong. It actually needs to be mirrored (to be precise, only the sketch surface needs to be mirrored; all the edges and vertices should stay the same anyways). Turning around (the x-axis) is what the code currently does though, hence this bug.
I've modified the star model to no longer being symmetric, and it shows this bug beautifully:
It might be showing other bugs too, hard to say. We'll know more, once this one is fixed.
To get this result, I've just replaced the
let radius = ...
line of the star model with this:On way to fix this bug would be to implement #101, then apply a mirror transform to the sketch surface. Another way would be to mirror using purpose-built code, not a general transform.
This might also be an opportunity to revisit the concept of surface orientation. At this point, a normal is computed for each triangle (on the CPU), depending on how it is winded, and each pixel is then shaded according to the angle between view direction and normal (on the GPU). How pixels are shaded is currently the only result of surface orientation, but I'm pretty sure that it will become more important in the future, for example to define what is inside and what is outside a body.
So instead of making the pixels look good again, it might be worth it to think how surface orientation should be represented, and implement that. That would, as a side effect, provide a much more solid way to fix this issue.
The text was updated successfully, but these errors were encountered: