POV-Ray : Newsgroups : povray.object-collection : 3D Loop : Re: 3D Loop Server Time10 Aug 2024 09:24:51 EDT (-0400)
 Re: 3D Loop
 From: LanuHum Date: 15 May 2015 12:40:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.55561fe6d258875a7a3e03fe0%40news.povray.org",
"dateCreated": "2015-05-15T16:40:00+00:00",
"datePublished": "2015-05-15T16:40:00+00:00",
"author": {
"@type": "Person",
"name": "LanuHum"
}
}
Lars Rohwedder <rok### [at] gmxde> wrote:
> Inspired by this object:
>
>
http://www.shutterstock.com/pic-94505617/stock-photo--d-infinity-shape-d-render-illustration.html
>

>
> I would like to change the whole object into a single "sphere_sweep" and
> I'd like to have a closed formula that calculates the positions of all
> spheres at once, with "smooth" transitions between the 3 3/4 torii, so
> no cylindrical parts between them.
>

>
> Any ideas, suggestions?

Python in the Blender creates it so:

def Torus_Knot(self):
p = self.torus_p
q = self.torus_q
w = self.torus_w
res = self.torus_res
h = self.torus_h
u = self.torus_u
v = self.torus_v
rounds = self.torus_rounds

newPoints = []
angle = 2*rounds
step = angle/(res-1)
scale = h
height = w

for i in range(res-1):
t = ( i*step*pi)

x = (2 * scale + cos((q*t)/p*v)) * cos(t * u)
y = (2 * scale + cos((q*t)/p*v)) * sin(t * u)
z = sin(q*t/p) * height

newPoints.extend([x,y,z,1])

return newPoints

From the received verts cubic_spline is created
```