[racket] Crowdsourcing Pict3D's design
On Mar 8, 2015, at 10:53 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
> If you've ever had the slightest hankering to do some real 3D but avoided it because of the pain that usually goes with it, try Pict3D. (If it fails to work, please submit a bug report on the GitHub page.) Got a visualization project? Try Pict3D. Want to make a game? Try Pict3D's version of Big Bang. Want to just fool around in 3D space for a bit? Try Pict3D, and report back on how it goes.
I made a version of the game unpossible using pict3d:
https://github.com/AlexKnauth/my-unpossible
It’s a bit slow and jerky, but that’s probably entirely because I didn’t try too hard to make my end of it fast.
If you have any suggestions that would be great.
On Mar 9, 2015, at 5:58 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
> On 03/09/2015 03:37 PM, Alexander D. Knauth wrote:
>> Is there a good way to draw a smooth curved cylinder?
> Sure! You could assemble it yourself out of triangles and quads. :)
>
> OK, maybe that's not "good". It's a fun problem, though, so I gave it a shot. I've attached my solution. The `parametric-cylinder` function accepts a function that takes a "time" parameter `t` and returns four values: the center of the cylinder at time `t`, the first derivative of the function from `t` to center, the second derivative, and a radius. It should work on any parametric function that doesn't have any collinear segments.
>
> You probably want something like the `helix` example.
>
> An easier-to-use solution would probably derive the first and second derivatives from samples of the center position.
>
> Neil ⊥
Thanks!
And by the way, for my use case, it was good that I could provide the derivative myself.
I ended up using it like this:
(parametric-cylinder
#:samples 1
(match-lambda
[0.0 (values pos dir (dir- new-dir dir) 1/2)]
[1.0 (values new-pos new-dir (dir- new-dir dir) 1/2)])
0.0 1.0)