Skip to content

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.

gasingh/surfaceViz

Repository files navigation

surfaceViz

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.

  1. Enepper Surface
  2. Monkey Saddle
  3. Mobeus Strip
  4. Klein Bottle
  5. Egg Crate Surface
  6. Pringle Surface
  7. Dini's Surface
  8. Bump Surface
  9. Flower Surface
  10. Vault-like Surface
  11. 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} }$$

210625 18 6_ 2 0 scale 210624 87 210624 82 210624 03

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)$.

210614 01 img9 1

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)$.

210622_01

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)$.

210623 07_triColorizationRoutines 3

EGG CRATE SURFACE

$$\displaylines{ \begin{equation*} z = \sin(xh_2) \cdot \cos(yh_2) \cdot h_1 \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 &lt; x, y &lt; 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$.

210614 01_210618 01_K

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*} }$$

210623 03

DINI'S SURFACE

$$\displaylines{ \begin{aligned} \begin{equation*} f(u,v) = \left(\cos(u)\sin(v), \sin(u)\sin(v), \cos(v) + \log\left(\tan\left(\frac{v}{2}\right)\right) + a u\right), \end{equation*} \end{aligned} }$$

with

$$\displaylines{ \begin{aligned} 0 \leq u \leq 2\pi \\ 0 < v < \pi \end{aligned} }$$

210623 06

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 &lt; x, y &lt; 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$.

210616 09

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 &lt; x, y &lt; 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$.

210614 01 img10 1

VAULT-LIKE SURFACE

$$\displaylines{ \begin{equation*} z = h_1 - (x^2 + y^2) \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 &lt; x, y &lt; 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$.

210616 31

SUPER FORMULA SURFACES

$$\displaylines{ r(\varphi) = (|\frac{cos(\frac{m\varphi}{4})}{a}|^{n_2} + |\frac{sin(\frac{m\varphi}{4})}{b}|^{n_3})^{-\frac{1}{n_1}} }$$

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 \\\ }$$

where

$$\displaylines{ -\frac{\pi}{2} > {\phi} > \frac{\pi}{2} \\\ -{\pi} > {\theta} > {\pi} \\\ }$$

__210714 04_typeD __210714 04_typeB

210714 28_msh-colored_1

210714 11_msh-colored

View in 3D! (shape transitions)

210715 01_transparentPlasticSurface

210714 04

View in 3D!

210715 04_colorRange

210714 01

View in 3D!

Capture_GH1

Source: Math Equations on my GitLab Repo

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages