# Revision history [back]

### Parametric plot doesn't work as expected

Hello!

I'm working on some visualizations. In fact, I'd like to vizualize lines and curves on projective plane. I started with something very easy. I'd like to draw a line on sphere. I figured out something like this:

x,y,z=var('x y z')
sol = solve([x+y+z==0.0, x^2+y^2+z^2 == 1.0], y, z);
print(sol)
p = implicit_plot3d(x+y+z, (x,-5,5), (y,-5,5), (z,-5,5), color="blue", opacity=0.2)
p += implicit_plot3d(x^2+y^2+z^2 - 1,(x,-5,5), (y,-5,5), (z,-5,5), color="red", opacity=0.4)
for s in sol:
p += parametric_plot3d([x,y.subs(s), z.subs(s)], (x,-5.0,5.0), color="green")
show(p)


The output of this program is:

[
[y == -1/2*x - 1/2*sqrt(-3*x^2 + 2), z == -1/2*x + 1/2*sqrt(-3*x^2 + 2)],
[y == -1/2*x + 1/2*sqrt(-3*x^2 + 2), z == -1/2*x - 1/2*sqrt(-3*x^2 + 2)]
]


I believe it's correct.

However I'm not satsified about the resulting plot. Unfortunately I don't have enough karma points to show you the result. Instead of smooth line (like equator) I have strange "triangles" on the poles of the sphere.

What can I do about it? 2 None

### Parametric plot doesn't work as expected

Hello!

I'm working on some visualizations. In fact, I'd like to vizualize lines lines and curves on the projective plane. I started with something very easy. I'd like to easy: draw a line on sphere. I figured out something like this:the following.

Compute intersection of a plane with the unit sphere:

x,y,z=var('x sage: x, y, z = var('x y z')
sage: sol = solve([x+y+z==0.0, x^2+y^2+z^2 solve([x + y + z == 0.0, x^2 + y^2 + z^2 == 1.0], y, z);
print(sol)
z)
sage: sol
[[y == -1/2*x - 1/2*sqrt(-3*x^2 + 2), z == -1/2*x + 1/2*sqrt(-3*x^2 + 2)],
[y == -1/2*x + 1/2*sqrt(-3*x^2 + 2), z == -1/2*x - 1/2*sqrt(-3*x^2 + 2)]]


Draw the plane, the sphere, and their intersection:

sage: p = implicit_plot3d(x+y+z, (x,-5,5), (y,-5,5), (z,-5,5), implicit_plot3d(x + y + z, (x, -5, 5), (y, -5, 5), (z, -5, 5), color="blue", opacity=0.2)
sage: p += implicit_plot3d(x^2+y^2+z^2 implicit_plot3d(x^2 + y^2 + z^2 - 1,(x,-5,5), (y,-5,5), (z,-5,5), 1, (x, -5, 5), (y, -5, 5), (z, -5, 5), color="red", opacity=0.4)
sage: for s in sol:
....:     p += parametric_plot3d([x,y.subs(s), parametric_plot3d([x, y.subs(s), z.subs(s)], (x,-5.0,5.0), (x, -5.0, 5.0), color="green")
sage: show(p)


The output of this program is:

[
[y == -1/2*x - 1/2*sqrt(-3*x^2 + 2), z == -1/2*x + 1/2*sqrt(-3*x^2 + 2)],
[y == -1/2*x + 1/2*sqrt(-3*x^2 + 2), z == -1/2*x - 1/2*sqrt(-3*x^2 + 2)]
] I believe it's correct. the computation is correct.

However I'm not satsified about satisfied with the resulting plot. Unfortunately I don't have enough karma points to show you the result. plot. Instead of a smooth line (like equator) a tilted equator) I have strange "triangles" on the poles of at opposite points of the sphere.

What can I do about it?