POV-Ray : Newsgroups : povray.general : 2D function to 3D tube : Re: 2D function to 3D tube Server Time
4 Feb 2023 01:08:25 EST (-0500)
  Re: 2D function to 3D tube  
From: Tor Olav Kristensen
Date: 25 Dec 2022 23:20:00
Message: <web.63a91fba560d6168d6142c8889db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Hi TOK, and Merry Christmas  :)

Thank you Bill =)

Merry Christmas to you too !


> I can follow all of your calculations, and indeed, I'm using many of the same
> methods.

Ok. That's good.


> But I'm curious if you've applied the results of the calculations to generating
> the mesh of the function's tubular envelope.

Yes, I did that. And it looks ok when I'm using my own mesh macro.
But when I use meshmaker.inc it does not look so good.


> That's where I've encountered the sticking point.  Since I'm creating vertices
> of the circles sequentially along the curve, the "ordering" of those vertices
> matter when I then loop through them to create my triangles.  When there's a
> sign change or a sudden plummet to zero, I get a severe twist in the tube at
> that point.
>
> Maybe you can render the following equations so that I can see that your methods
> work, and I indeed (as always) am making things too complicated.  You may have
> noticed that I DO have that knack.  ;)
>...

Ok, but please note that Wolfram Alpha does not agree with you on the
derivatives of the last two. Here's how I wrote them:

#declare FnX = function(u) { u };
#declare DFnX = function(u) { 1 };

#declare Fn_Y = array[5];
#declare DFn_Y = array[5];

#declare I = 0;
#declare Fn_Y[I] = function(u) { pow(u, 2) + 1 };
#declare DFn_Y[I] = function(u) { 2*u };

#declare I = I + 1;
#declare Fn_Y[I] = function(u) { 0.4*cos(u)*(-pow(u, 2) + 3) - 1 };
#declare DFn_Y[I] = function(u) { 0.4*(pow(u, 2) - 3)*sin(u) - 0.8*u*cos(u) };

#declare I = I + 1;
#declare Fn_Y[I] = function(u) { u*u*u };
#declare DFn_Y[I] = function(u) { 3*u*u };

#declare I = I + 1;
#declare Fn_Y[I] = function(u) { 4*sinh(u)/cosh(u) + 4 };
#declare DFn_Y[I] = function(u) { 16*pow(cosh(u), 2)/pow(cosh(2*u) + 1, 2) };

#declare I = I + 1;
#declare Fn_Y[I] = function(u) { 8*u/(abs(u) + 1) };
#declare DFn_Y[I] = function(u) { 8/pow(abs(u) + 1, 2) };

I ran all these through the SimpleMesh macro. See the attached image for
the results. I can post the complete source for that if you're interested.


> I came up with a bit of a hacky solution that seems to work for ALL of these.  I
> keep track of the Phi value for each circle, and if I'm at x=0, I just use the
> value from the previous circle, and I get nice, continuous results.
>
> After calculating Phi, I just invoke:
> #local Phi = (abs (UU)<E ? LastPhi : Phi);

I can not understand why that should be necessary. - But it could be that
it's me that's missing something...


> Here's hoping you prove me wrong with a super simple solution.  :)

It's not super simple, but perhaps less complicated ;)

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message


Attachments:
Download 'tube_curves.png' (121 KB)

Preview of image 'tube_curves.png'
tube_curves.png


 

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.