# Revision history [back]

### Path rendering on a Surface

I am having a discrepancy with the z-coordinates of a path on a surface.

The blue path shown below is correctly embedded in the red surface.

The z-coordinates for the green path are "almost" correct. I have gone over the math dozens of times. I need to compute rational powers of cosine and sine. Wondering if it could be a rounding issue?

The surface is parametrized in polar coordinates.

The path is parametrized in rectangular coordinates. (This is because on the full surface this portion is shifted along the x-axis. I reparametrized it polar and it seems less accurate).

What I've done is:

1. Specify the path as $(x(u), y(u))$
2. Compute the radial distance to the point $r(u) = \sqrt{x^2 + y^2}$
3. The path is then given by $(x(u), y(u), z(r(u))$

(I've used the parameter $v$ to give the paths some "thickness")

This works fine for blue, not for green.

The surface height grows linearly with the radius.

The blue path's radius decays linearly.

The green path's radius decays non-linearly. But, I don't think that should matter, as I'm simply getting a list of points and plugging them into the height function.

I am unable to post links to the rendering at the moment. I can message if needed.

### Path rendering on a Surface

I am having a discrepancy with the z-coordinates of a path on a surface.

The blue path shown below is correctly embedded in the red surface.

The z-coordinates for the green path are "almost" correct. I have gone over the math dozens of times. I need to compute rational powers of cosine and sine. Wondering if it could be a rounding issue?

The surface is parametrized in polar coordinates.

The path is parametrized in rectangular coordinates. (This is because on the full surface this portion is shifted along the x-axis. I reparametrized it polar and it seems less accurate).

What I've done is:

1. Specify the path as $(x(u), y(u))$
2. Compute the radial distance to the point $r(u) = \sqrt{x^2 + y^2}$
3. The path is then given by $(x(u), y(u), z(r(u))$

(I've used the parameter $v$ to give the paths some "thickness")

This works fine for blue, not for green.

The surface height grows linearly with the radius.

The blue path's radius decays linearly.

The green path's radius decays non-linearly. But, I don't think that should matter, as I'm simply getting a list of points and plugging them into the height function.

I am unable

u, v = var('u, v')
right_curve_u = 8+(14/pi)*(u+pi/2) #8+(14/pi)*(phi+pi/2)
f_x(u, v) = v*cos(u)
f_y(u, v) = v*sin(u)
f_z(u, v) = (((v-16)/12)*(12*cos((pi/11)*(right_curve_u - 17)) + 39.5))/12
T=parametric_plot3d([f_x, f_y, f_z], (u, -pi/2, 0), (v, 16, 28), color="red", opacity=0.5, axes=True, mesh=False)
#c=parametric_plot3d([f_x, f_y, f_z], (u, -pi/2, pi/2), (v, 21.9, 22.1), color="black", mesh=True)
#c is the curve in the first example with constant radius

#Path Equation;  Note, "u" is the parameter for the path, "v" is to post links to the rendering at the moment.  I can message if needed.

give it a bit of "thickness" right_curve_u = 8+(14/pi)*(u+pi/2) #8+(14/pi)*(phi+pi/2) right_curve_x(u,v) = v*(16*(cos(u))^(5/6)) right_curve_y(u,v) = v*(-28*(sin(-u))^(5/6)) #right_curve_path_radius(u,v) = v*(16*28)/(((28*cos(u))^(2.4)+(16*sin(-u))^2.4)^(5/12)) right_curve_path_radius(u,v) = sqrt((right_curve_x)^2+(right_curve_y)^2) right_curve_path_radius_2(u,v) = v*sqrt((16^2)*(cos(u))^(5/3)+(28^2)*(sin(-u))^(5/3)) right_curve_z(u,v) = ( ( (right_curve_path_radius - 16)/12 ) * ( 12*cos( (pi/11)*(right_curve_u - 17) ) + 39.5 ) )/12 right_curve_z_2(u,v) = ( ( (right_curve_path_radius_2 - 16)/12 ) * ( 12*cos( (pi/11)*(right_curve_u - 17) ) + 39.5 ) )/12 right_curve = parametric_plot3d([right_curve_x, right_curve_y, right_curve_z], (u, -pi/2, -0.01), (v, 0.99, 1.01), color="black") right_curve_2 = parametric_plot3d([right_curve_x, right_curve_y, right_curve_z_2], (u, -pi/2, -0.01), (v, 0.99, 1.01), color="green") g_x(u, v) = v*(16-(12*(u-pi/2)/pi))*cos(u) g_y(u, v) = v*(16-(12*(u-pi/2)/pi))*sin(u) h(u) = v*(16 - (12/pi)*(u-pi/2)) g_z(u,v) = ( ( (h - 16)/12 ) * ( 12*cos( (pi/11)*(right_curve_u - 17) ) + 39.5 ) )/12 c_xy=parametric_plot3d([g_x, g_y, g_z], (u, -pi/2, 0), (v, 0.99, 1.01), color="blue") T+c_xy+right_curve+right_curve_2