POV-Ray : Newsgroups : povray.general : 2D function to 3D tube : Re: 2D function to 3D tube Server Time
23 Apr 2024 18:02:42 EDT (-0400)
  Re: 2D function to 3D tube  
From: Bald Eagle
Date: 21 Dec 2022 19:55:00
Message: <web.63a3aa5d560d61681f9dae3025979125@news.povray.org>
> 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


Post a reply to this message

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