FuncViz examples
Generalized bitree/quadtree/octree library
Loading...
Searching...
No Matches
parametric_curve_3d.cpp File Reference

Parametric curve as the intersection of two parametric surfaces. More...

Go to the source code of this file.

Detailed Description

Parametric curve as the intersection of two parametric surfaces.

Author
Mitch Richling http://www.mitchr.me/
Date
2024-07-14
Standards
C++23
Details


This program produces an interesting visualization of an object known as the twisted cubic. In parametric form, the curve may be expressed as

\[ f(t)=[t, t^2, t^3] \]

Alternately the curve is also the intersection of two surfaces in \(\mathbb{R}^3\):

\[ y=f_2(x, z)=y^2 \]

\[ z=f_3(x, y)=x^3 \]

The "typical" way to graph a surface like \(f_2\) is to transform it into pseudo-parametric form. In Maple that might look like this

 plot3d([u, u^2, v], u=-1..1, v=-1..1):


We could do that with MRPTree, but it is easier to simply map the variables when we use construct_geometry_fans().

Another interesting use of MRPTree in this example is the way we have transformed each surface function into an SDF to drive up sample resolution near the surface intersection. This would allow us to use a tool like Paraview to compute an approximation to the the intersection. Just in case the reader is not using a tool that can extract a nice surface intersection, I have also dumped the curve out in a 3rd .VTU file.

Definition in file parametric_curve_3d.cpp.