[colug-432] fixed it

Vince Herried Vince at PlanetVince.com
Mon Dec 22 21:50:05 EST 2014


    35      start=0.0
    36      end=pi*2
    37
    38      samples = 35
    39      size=(end-start)/samples
    40
    41
    42      #print("samples=",samples)
    43      #print("start=",start)
    44      #print("end=",end);
    45
    46
    47          # create the vertices and edge loops for cosine
    48      for t in range (samples+1):
    49          j=t*size
    50          x = sin(j) + 2*sin(2*j)
    51          y = cos(j) - 2*cos(2*j)
    52          z = -sin(3*j)
    53          #print("x=",x,"y=",y,"z=",z)
    54          v=[Vector(((x * scale_x), (y * scale_y), (z * scale_z)))]
    55          #print("length of v=",len(v))
    56          #verts+=v
    57          verts.append((Vector(((x * scale_x), (y * scale_y), (z
* scale_z)))))
    58          if t>0:
    59                  edges+=[[t-1,t]]

the scaling just didn't seem correct  The scale_  values come from the
user interface
but the jumps between the vertices looked all wrong  so added stmt 49
and changed the trig functions to use the new variable  j.

Now the edges are correctly connected.

This code creates string of connected vertices.
To make it look anything like the wikipedia page, I change the verts
into a curve

create a cylinder
then apply the curve to the cylinder and poof it makes a very nicely
connected tube (knot )
well that is the plan at least :)

Back to silence mode
-----------------
Vince


More information about the colug-432 mailing list