POV-Ray : Newsgroups : povray.general : 2D function to 3D tube : Re: 2D function to 3D tube Server Time
19 May 2024 07:50:44 EDT (-0400)
  Re: 2D function to 3D tube  
From: Droj
Date: 22 Dec 2022 18:55:00
Message: <web.63a4ed40560d61682a0260b33b2af915@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> > The question is why are some parts of the tube flatened as indicated in the
> > image T_HeartCurve_00a1.png??
>
>
>
> Angles.
>
> A torus goes around smoothly, and the outward pointing normal is always pointing
> away from the center.
> You have a heart / cardioid, and the amount of rotation is 1.5 times that,
> because you have that dip in the top of the heart.
>
> I wasn't gonna figure all of that out, but what I did was essentially mirror the
> curve by using select, and change the signs.
>
> Try this and see if this is what you're after:  (Not sure about that dip)
>
>     #declare rr = 1.00;
>     // Parametric function sets for HeartCurve and their derivatives:
>     #declare FX  = function(u) {16*pow(sin(u),3)};
>     #declare FdX = function(u) {48*pow(sin(u),2)*cos(u)};
>
>     #declare FY  = function(u) {13*cos(u)-5*cos(2*u)-2*cos(3*u)-cos(4*u)};
>     #declare FdY = function(u) {-13*sin(u)+10*sin(2*u)+6*sin(3*u)+4*sin(4*u)};
>
>     // Cross section of tube:
>     #declare QX = function(v) {u};
>     #declare QY = function(v) {rr*cos(v)};
>     #declare QZ = function(v) {rr*sin(v)};
>
>     // Rotation angle of cross section of tube:
>     #declare PHI =
>     function(u) {
>       select (pi-u,
>
>       atan2(abs(FdX((tau-u)/2)), FdY((tau-u)/2)) - pi/2,
>       -atan2(abs(FdX(u/2)), FdY(u/2)) + pi/2
>       )
>      };
>
>     #declare F1 = function(u,v) {QY(v) * cos(PHI(u)) + FX(u)};
>     #declare F2 = function(u,v) {QY(v) * sin(PHI(u)) + FY(u)}
>
>
> - BW

My goodness! I will try this. Your heart curve loks much smoother than mine.

I already had in the back of my mind that it had to do with the atan2 but I'm
not a mathematician.

I really appreciate your help and I'll try your solution with other curves, too.

In the not too distant future I will try to produce some nice Lissajous curves.

Thanks again


Post a reply to this message

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