This is AI time! AI crosses various human languages and crosses different programming languages. It is helpful for both beginners and experts: saving a lot of code-writing time. Even we can ask AI to give a LaTeX file with detail calculations (see this overleaf link). You can ask AI for any language: Asymptote , POV-Ray, Python, manim, ...
Below are the code I ask Gemini Pro with minor modifications.
1. Manim Here is my first Manim on GanJingWorld.

2. Asymptote: simple and an improvement


3. POV-Ray: This is nearly the first time I run POV-Ray; the code is mainly from AI, of course.

Manim code:
from manim import *
import numpy as np
# Class must inherit from ThreeDScene
class SphereEllipsoidIntersection(ThreeDScene):
def construct(self):
# 1. Setup Camera and Axes
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
axes = ThreeDAxes()
# self.add(axes) # Optional: Uncomment to see axes
# 2. Define Sphere (Radius = 3)
# Using Parametric Surface for smooth rendering
sphere = Surface(
lambda u, v: np.array([
3 * np.cos(u) * np.sin(v),
3 * np.sin(u) * np.sin(v),
3 * np.cos(v)
]),
u_range=[0, 2 * PI],
v_range=[0, PI],
checkerboard_colors=[YELLOW_D, YELLOW_E],
resolution=(24, 12), # Higher resolution = smoother
fill_opacity=0.3
)
# 3. Define Ellipsoid (Semi-axes: 2, 3, 4)
ellipsoid = Surface(
lambda u, v: np.array([
2 * np.cos(u) * np.sin(v),
3 * np.sin(u) * np.sin(v),
4 * np.cos(v)
]),
u_range=[0, 2 * PI],
v_range=[0, PI],
checkerboard_colors=[BLUE_D, BLUE_E],
resolution=(24, 12),
fill_opacity=0.3
)
# 4. Define Intersection Curves (ParametricFunction)
# x = sqrt(7/3)sin(t), y=3cos(t), z=+/- sqrt(20/3)sin(t)
a = np.sqrt(7/3)
b = np.sqrt(20/3)
# Curve 1 (z > 0)
curve1 = ParametricFunction(
lambda t: np.array([
a * np.sin(t),
3 * np.cos(t),
b * np.sin(t)
]),
t_range=[0, 2 * PI],
color=RED, stroke_width=6
)
# Curve 2 (z < 0)
curve2 = ParametricFunction(
lambda t: np.array([
a * np.sin(t),
3 * np.cos(t),
-b * np.sin(t)
]),
t_range=[0, 2 * PI],
color=RED, stroke_width=6
)
# 5. Animation Sequence
self.begin_ambient_camera_rotation(rate=0.1) # Slowly rotate camera
# Draw Sphere
self.play(Create(sphere), run_time=2)
self.wait(0.5)
# Draw Ellipsoid
self.play(Create(ellipsoid), run_time=2)
self.wait(0.5)
# Trace Intersection Curves
self.play(Create(curve1), Create(curve2), run_time=3)
self.wait(3)
# --- THONNY RUNNER CONFIGURATION ---
if __name__ == "__main__":
from manim import config
# Configure output settings specifically for direct run
config.media_width = "75%"
config.verbosity = "WARNING"
config.preview = True # Automatically open the video file
config.quality = "high_quality" # Use "medium_quality" or "high_quality" for final render
# Run the scene
scene = SphereEllipsoidIntersection()
scene.render()
The first Asymptote code:
// https://asymptote.ualberta.ca/
import solids;
import graph3;
settings.render=8; // anti-aliasing (ví dụ: 8, 16)
settings.prc=false; // usually improve image's quality
size(300);
currentprojection=orthographic(5,4,2);
// the sphere
draw(scale3(3)*unitsphere, yellow+opacity(.2));
// Ellipsoid
draw(scale(2,3,4)*unitsphere, blue+opacity(.2));
// intersections
real a = sqrt(7/3);
real b = sqrt(20/3);
path3 p1 = graph(new triple(real t) {
return (a*sin(t), 3*cos(t), b*sin(t));
}, 0, 2*pi, operator ..);
path3 p2 = graph(new triple(real t) {
return (a*sin(t), 3*cos(t), -b*sin(t));
}, 0, 2*pi, operator ..);
draw(p1, red+linewidth(2));
draw(p2, red+linewidth(2));
The second Asymptote code: for anti-aliasing.
// https://asymptote.ualberta.ca/
import solids;
import graph3;
// HIGH QUALITY RENDER SETTINGS
settings.render = 16; // Increase anti-aliasing level (higher is smoother but slower)
settings.prc = false; // Disable PRC to focus on high-quality raster/vector image
size(300);
// Lighting: Adds depth and shine to 3D objects
currentlight = light(white, (5, 5, 10), specularfactor=3.0);
currentprojection = orthographic(5, 4, 2);
// 1. DEFINE PARAMETRIC FUNCTIONS FOR SPHERE AND ELLIPSOID
// This allows better control over mesh smoothness compared to the built-in unitsphere
// Sphere with radius 3
triple sphere_param(pair p) {
real u = p.x;
real v = p.y;
return (3*cos(u)*sin(v), 3*sin(u)*sin(v), 3*cos(v));
}
// Ellipsoid with semi-axes (2, 3, 4)
triple ellipsoid_param(pair p) {
real u = p.x;
real v = p.y;
return (2*cos(u)*sin(v), 3*sin(u)*sin(v), 4*cos(v));
}
// 2. DRAW SURFACES WITH HIGH RESOLUTION
// nu=60, nv=30: Increase mesh count for an extremely smooth surface (removes jagged edges)
surface s_sphere = surface(sphere_param, (0,0), (2*pi, pi), 60, 30, Spline);
surface s_ellipsoid = surface(ellipsoid_param, (0,0), (2*pi, pi), 60, 30, Spline);
// Draw with material: adds shininess and transparency
// Opacity should be < 1 to see internal intersections and create a "glass" effect
draw(s_sphere, material(yellow + opacity(1), shininess=0.5));
draw(s_ellipsoid, material(blue + opacity(1), shininess=0.5));
// 3. DRAW SMOOTH INTERSECTION CURVES
real a = sqrt(7/3);
real b = sqrt(20/3);
// Increase sample points (n=200) for smoother curves
path3 p1 = graph(new triple(real t) {
return (a*sin(t), 3*cos(t), b*sin(t));
}, 0, 2*pi, n=200, operator ..);
path3 p2 = graph(new triple(real t) {
return (a*sin(t), 3*cos(t), -b*sin(t));
}, 0, 2*pi, n=200, operator ..);
// Draw thicker intersection lines
draw(p1, red + linewidth(2.5));
draw(p2, red + linewidth(2.5));
POV-Ray code
#version 3.7;
#include "colors.inc"
#include "textures.inc"
global_settings { assumed_gamma 1.0 }
// --- NEW SETTING: Background Color ---
//background { color White } // Change to White (default is Black)
// 1. Camera Settings
camera {
// Moved closer to <0,0,0> to reduce empty space (Zoom in)
location <2, 8, 3>
look_at <0, 0, 0> // Look at origin
right x*image_width/image_height
}
// 2. Light Sources
light_source { <10, 10, -10> color White }
light_source { <-10, 5, -5> color White shadowless} // Fill light
// 3. Material Definitions (Transparent Glass)
#declare MatSphere = texture {
// Adjusted filter to 0.8 for real 80% transparency
pigment { color Yellow filter 0.8 }
finish { phong 1 reflection 0.2 } // Reduced reflection slightly for white background
}
#declare MatEllipsoid = texture {
pigment { color Blue filter 0.8 }
finish { phong 1 reflection 0.2 }
}
// 4. Draw Sphere (R=3)
sphere {
<0, 0, 0>, 1
scale <3, 3, 3>
texture { MatSphere }
}
// 5. Draw Ellipsoid (2, 3, 4)
sphere {
<0, 0, 0>, 1
scale <2, 3, 4>
texture { MatEllipsoid }
}
// 6. Draw Intersection Curves (Parametric Curves)
// Parameters from the problem:
// x = sqrt(7/3)*sin(t)
// y = 3*cos(t)
// z = +/- sqrt(20/3)*sin(t)
#declare A = sqrt(7/3);
#declare B = sqrt(20/3);
#declare LineRadius = 0.04; // Slightly thicker for better visibility
#declare Step = 0.002; // Smaller step for smoother curves
#declare T = 0;
union {
#while (T < 2*pi)
// Current point coordinates
#local Px = A * sin(T);
#local Py = 3 * cos(T);
#local Pz = B * sin(T);
// Draw point (small sphere) at curve 1 (positive Z)
sphere { <Px, Py, Pz>, LineRadius pigment { Red } }
// Draw point at curve 2 (negative Z)
sphere { <Px, Py, -Pz>, LineRadius pigment { Red } }
#declare T = T + Step;
#end
no_shadow // No shadow casting for cleaner look
}
3d/screen coordshas already switched you from 3D to 2D. As a result,xscaleandyscalescale the screen coordinates, whilezscalehas no meaning at all in this context. See page 8 of the 3D Tools manual. To get an answer to your question, you need to describe more precisely what you want to obtain.