POV-Ray : Newsgroups : povray.general : 2D function to 3D tube : Re: 2D function to 3D tube Server Time
25 Apr 2024 12:17:07 EDT (-0400)
  Re: 2D function to 3D tube  
From: Bald Eagle
Date: 25 Dec 2022 21:15:00
Message: <web.63a9031f560d61681f9dae3025979125@news.povray.org>
Hi TOK, and Merry Christmas  :)

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

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


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.  ;)

#declare Function   = function (U) {U*U+1}
#declare Derivative = function (U) {2*U}

#declare Function   = function (U) {0.4 * cos (U) * (-pow (U, 2) + 3 ) -1}
#declare Derivative = function (U) {0.4 * (pow (U, 2) - 3 )* sin (U) - 0.8 * U *
cos (U)}

#declare Function   = function (U) {U*U*U}
#declare Derivative = function (U) {3*U*U}

hyperbolic tangent
#declare Function   = function (U) {4 * (sinh (U) / cosh (U)) + 4}
#declare Derivative = function (U) {pow (1/cosh(U), 2)}

"softsign"
#declare Function   = function (U) {8*(U/(abs(U)+1))}
#declare Derivative = function (U) {pow (1/(abs(x)+1), 2)}

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);


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

- BW


Post a reply to this message


Attachments:
Download 'tubecurves.png' (217 KB)

Preview of image 'tubecurves.png'
tubecurves.png


 

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