Drawing a pair of pants using python

274 Views Asked by At

I am trying to draw a helicoidale trajectory on a pair of pants and to do this I need a parametric equation of the surface. Then I will compose $(\cos(t), \sin(t))$ with the parametrized equation.

Thus, I am trying to find the equation of a pair of pants. I found this:

https://www.quora.com/What-is-the-mathematical-expression-which-when-plotted-looks-like-a-pair-of-pants

The idea is well thought but I don't have really good results while drawing it...

Q: Do someone have any idea of the equation of a pair of pants ?

Thank you.

1

There are 1 best solutions below

10
On BEST ANSWER

Here's the equation from Quora as plotted using Maple, with the following commands:

eq:= (1-z)*((x-1)^2+y^2-1/3)*((x+1)^2+y^2-1/3) + z*(x^2+y^2-1/3):
plots:-implicitplot3d(eq, x=-1.7..1.7, y=-0.7..0.7, z=0..1, grid=[100,60,30],
  scaling=constrained, axes=none, style=patchnogrid, lightmodel=light2);

enter image description here

What don't you like about it?

EDIT: If you want a parametric curve $x = X(t), y = Y(t), z = Z(t)$ on a surface defined by the implicit equation $F(x,y,z) = 0$, you could use a system of differential equations $\dot{x} = f_1(x,y,z),\; \dot{y} = f_2(x,y,z),\; \dot{z} = f_3(x,y,z)$. What you need in order to have the curve stay on the surface is $$ \dfrac{\partial F}{\partial x} \dot{x} + \dfrac{\partial F}{\partial y} \dot{y} + \dfrac{\partial F}{\partial z} \dot{z} = 0$$ You will probably want to use numerical methods to solve the system of differential equations.

Here, for example, is a curve winding up one leg of the pants and onto the torso.

enter image description here

EDIT: The differential equation system I used was

$$ \eqalign{\dot{x} &= \partial F/\partial y - \dfrac{ (\partial F/\partial x) (\partial F/\partial z)}{10 ((\partial F/\partial x)^2 + (\partial F/\partial y)^2)}\cr \dot{y} &= - \partial F/\partial x - \dfrac{(\partial F/\partial y) (\partial F/\partial z)}{10 ((\partial F/\partial x)^2 + (\partial F/\partial y)^2)}\cr \dot{z} &= 1/10\cr} $$ where $$ F = \left( 1-z \right) \left( \left( x-1 \right) ^{2}+{y}^{2}-1/3 \right) \left( \left( x+1 \right) ^{2}+{y}^{2}-1/3 \right) +z \left( {x}^{2}+{y}^{2}-1/3 \right) $$