A repo to showcase some surface visualization experiments in Rhino/IronPython. This is owing to the absence of support for standard Python libraries like Numpy, etc in Rhino3D.
A repo to showcase 3d surface plot experiments inside Rhino/IronPython.
Note: we don't employ any standard Python libraries like Numpy, Matplotlib, etc; as they are not compatible with the IronPython which is as .NET port of Python.
We mimiced the standard generation functions to build a set of visualization methods in RhinoCommon instead.
The system can produce Point Clouds, Meshes, and Surface representations.
Additional colorization routines are also encoded, which include a height-based colorizer, and an internal generation sequence visualizer, and various color gradients.
The repository currently hosts 10 general parametric surface equations, and the Super Formula equation.
Enepper Surface
Monkey Saddle
Mobeus Strip
Klein Bottle
Egg Crate Surface
Pringle Surface
Dini's Surface
Bump Surface
Flower Surface
Vault-like Surface
Super Formula Surfaces
ENEPPER SURFACE
$$\displaylines{
\begin{aligned}
x &= u\cos(v) - \frac{u^b \cos(bv)}{b} \\
y &= u\sin(v) + \frac{u^b \sin(bv)}{b} \\
z &= 2u^a \frac{\cos(av)}{a}
\end{aligned}
}$$
with
$$\displaylines{
\begin{aligned}
0 < u < 1.2 \\
-\pi < v < \pi
\end{aligned}
}$$
View in 3D!
MONKEY SADDLE
$$\displaylines{
\begin{equation*}
z = x^3 - 3xy^2
\end{equation*}
}$$
This equation defines a surface in three dimensions where $z$ is a function of $x$ and $y$, with the height of the surface at any point $(x,y)$ determined by the expression $x^3 - 3xy^2$. The Monkey Saddle is a saddle-shaped surface, with two saddle points at $(0,0)$ and $(\pm\sqrt{3/2},0)$.
MOBEUS STRIP
$$\displaylines{
\begin{align*}
x &= (1 + \frac{v}{2}\cos(\frac{1}{2}u))\cos(u) \\
y &= (1 + \frac{v}{2}\cos(\frac{1}{2}u))\sin(u) \\
z &= \frac{v}{2}\sin(\frac{1}{2}u)
\end{align*}
}$$
This defines the three-dimensional function $(x, y, z)$, which is a parametric surface defined over the ranges $u \in (0, 2\pi)$ and $v \in (-1, 1)$.
KLEIN BOTTLE
$$\displaylines{
\begin{align*}
x &= aa + \cos\left(\frac{v}{2}\right)\sin u - \sin\left(\frac{v}{2}\right)\sin(2u)\cos v \\
y &= aa + \cos\left(\frac{v}{2}\right)\sin u - \sin\left(\frac{v}{2}\right)\sin(2u)\sin v \\
z &= \sin\left(\frac{v}{2}\right)\sin u + \cos\left(\frac{v}{2}\right)\sin(2u)
\end{align*}
}$$
This defines the three-dimensional function $(x, y, z)$, which is a parametric surface defined over the ranges $u \in (0, 2\pi)$ and $v \in (0, 6)$.
$$\displaylines{
\begin{equation*}
x = \begin{cases}
-v, & -v < x < v \\
v, & \text{otherwise}
\end{cases} \quad \text{and} \quad
y = \begin{cases}
-v, & -v < y < v \\
v, & \text{otherwise}
\end{cases}
\end{equation*}
}$$
This defines a surface in three dimensions where $z$ is a function of $x$ and $y$, with $x$ and $y$ constrained to the square region $-v < x, y < v$. The height of the surface at any point $(x,y)$ is proportional to $\sin(xh_2)\cos(yh_2)$ and scaled by the constant $h_1$.
PRINGLE SURFACE
$$\displaylines{
\begin{equation*}
z = \begin{cases}
\sin(x^4) + \cos(y^4), & 0 < x < u \sin(v) \text{ and } 0 < y < u \sin(v) \\
0, & \text{otherwise}
\end{cases}
\end{equation*}
}$$
$$\displaylines{
\begin{aligned}
0 \leq u \leq 2\pi \\
0 < v < \pi
\end{aligned}
}$$
BUMP SURFACE
$$\displaylines{
\begin{equation*}
z = e^{-(x^2+y^2)}h
\end{equation*}
}$$
where $x$ and $y$ are defined as follows:
$$\displaylines{
\begin{equation*}
x = \begin{cases}
-v, & -v < x < v \\
v, & \text{otherwise}
\end{cases} \quad \text{and} \quad
y = \begin{cases}
-v, & -v < y < v \\
v, & \text{otherwise}
\end{cases}
\end{equation*}
}$$
This defines a surface in three dimensions where $z$ is a function of $x$ and $y$, with $x$ and $y$ constrained to the square region $-v < x, y < v$. The height of the surface at any point $(x,y)$ is proportional to $e^{-(x^2+y^2)}$ and scaled by the constant $h$.
FLOWER SURFACE
$$\displaylines{
\begin{equation*}
z = \sin(\sqrt{x^2+y^2}) \cdot h
\end{equation*}
}$$
where $x$ and $y$ are defined as follows:
$$\displaylines{
\begin{equation*}
x = \begin{cases}
-v, & -v < x < v \\
v, & \text{otherwise}
\end{cases} \quad \text{and} \quad
y = \begin{cases}
-v, & -v < y < v \\
v, & \text{otherwise}
\end{cases}
\end{equation*}
}$$
This defines a surface in three dimensions where $z$ is a function of $x$ and $y$, with $x$ and $y$ constrained to the square region $-v < x, y < v$. The height of the surface at any point $(x,y)$ is proportional to $\sin(\sqrt{x^2+y^2})$ and scaled by the constant $h$.
$$\displaylines{
\begin{equation*}
x = \begin{cases}
-v, & -v < x < v \\
v, & \text{otherwise}
\end{cases} \quad \text{and} \quad
y = \begin{cases}
-v, & -v < y < v \\
v, & \text{otherwise}
\end{cases}
\end{equation*}
}$$
This defines a surface in three dimensions where $z$ is a function of $x$ and $y$, with $x$ and $y$ constrained to the square region $-v < x, y < v$. The height of the surface at any point $(x,y)$ is proportional to the difference between a constant value $h_1$ and the sum of the squares of $x$ and $y$.
by choosing different values for the parameters a,b,m,n_1,n_2,n_3, different shapes can be generated.
It is possible to extend the formula to 3,4, n dimensions, by means of the spherical product of superformulas.
The parametric equations are as follows:
$$\displaylines{
x = r_1(\theta)cos\theta \cdot r_2(\phi)cos\phi \\\
y = r_1(\theta)sin\theta \cdot r_2(\phi)cos\phi \\\
z = r_2(\phi)sin\phi \\\
}$$