-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Support 3D projection onto canvas #396
Comments
I have a working implementation of this in code but it is really dirty because I customized it to my needs. :) I should be able to write a more generalized version of this using vsketch's conventions though. Here's an example of the plot in both orthographic and perspective projections: |
Cool! 🤩 A good was to go about this would be to discuss the APIs before spending too much time fine-tuning the implementation. That can be done here or in a draft PR. |
@abey79 Yep, I definitely will do a draft PR and then can adjust from there based on any feedback! |
Well, vsketch is based on and uses vpype, so yes, anything that's in vpype can be used in vsketch. This can happen in two ways:
BTW, if you haven't yet, you might take a look at https://github.com/abey79/vpype-perspective and https://github.com/abey79/lines. There is an alternative avenue that you might consider that would arguably be more practical. You could work on a standalone python package, publish it, and use it in vsketch sketches. If your package produces a bunch of numpy arrays of complexes, then it's a matter of calling |
I often initially create designs in Processing, and then rewrite the code in Python using vsketch if I want to plot it with fills. One of the convenient aspects of Processing is that it supports a 3D renderer that can do both orthographic and perspective projections. When I try to adapt the digital design for a plot in vsketch (fills are not supported in Processing's SVG renderer), it is difficult to achieve the same appearance since vsketch does not support 3 dimensions.
While it is trivial to do orthographic projection from 3D points in vsketch, perspective projection is a bit trickier unless you're already familiar with how to do this. Having a method that accepts x/y/z coordinates and a field of view and then returns the point's projection onto the 2D surface formed by the canvas would open up interesting possibilities for plots without having to support full 3D rendering across vsketch's entire suite of methods.
The text was updated successfully, but these errors were encountered: