<% 'This is an asp version of Phineus's Perl Online Tiremaker.
'# web based tiremaker program '# requires parameters '# 0. step '# 1. number of circles '# 2. number of points on each circles '# 3. array of pos '# 4. array of radii 'use CGI qw(:standard); step = Request.QueryString("step") numCir = Request.QueryString("circles") numPnt = Request.QueryString("points") '# ---------- Program Flow ---------- If Step = 1 Then DoStep1 ElseIf Step = 2 Then DoStep2 ElseIf Step = 3 Then 'FileSystemObject.OpenTextFile(fname,mode,create,format) 'Modes: ForReading = 1 ForWriting = 2 ForAppending = 8 'recreation of m2kcounter.asp pgeNme = Request.ServerVariables("PATH_INFO") 'response.write("

pgeNme: " & pgeNme & "

") 'pgeNme = Replace(pgeNme,"/","_") 'pgeNme = Replace(pgeNme,"\","_") LogTo = left(pgeNme,len(pgeNme)-7) & "ObjCounter.txt" CounterFile = Server.MapPath(LogTo) 'response.write("

CounterFile: " & CounterFile & "

") Set xFS = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set xMC = xFS.OpenTextFile(CounterFile, 1, 0, 0) usercnt = xMC.Readline set xFS = Nothing usercnt = FormatNumber(usercnt + 1,0) Set xFS = CreateObject("Scripting.FileSystemObject") set xRC = xFS.CreateTextFile (CounterFile, 1, 0) xRC.WriteLine usercnt Set xRC = Nothing showHitCnt = usercnt response.write("

") DoStep3 %><% Else DoStep1 End If Sub DoStep1 %> On-line TireMaker
On-line TireMaker

This does the same thing as BinMasta's TireMaker program but runs as a web page. Follow the prompts, then copy and paste the results into a text document using an .obj extension.

How many circles?

<% End Sub Sub DoStep2 %> On-line TireMaker
On-line TireMaker

This does the same thing as BinMasta's TireMaker program but runs as a web page. Follow the prompts, then copy and paste the results into a text document using an .obj extension.

> <% For i = 1 to numCir %> <%=i%>. Axis radius
<% Next %>

Points per circle

Make *.OBJ file

<% End Sub Sub DoStep3 set fso=Server.CreateObject("Scripting.FileSystemObject") set objFile=fso.OpenTextFile(Server.MapPath(left(pgeNme,len(pgeNme)-7) & showHitCnt & ".obj"),ForWriting,true) pi = 3.1415926535897932384626433832795 'angleShift = 360 / numPnt Use this for Degrees angleShift = 2 * pi / numPnt 'ignore the three lines below this, it's irrelivent. 'Gotta load the Arrays somwhere here! ARUGH! Or just pop them l8r. array of pos - array of radii 'radius = Request.QueryString("r") 'zPos = Request.QueryString("p") '# Verticies objFile.WriteLine("v 0 0 " & 10000*Request.QueryString("p1")) 'Response.Write("v 0 0 " & 10000*Request.QueryString("p1") & "
") For i = 0 to numCir-1 For j = 1 to numPnt xPos = int(10000*(Request.QueryString("r" & i+1) * sin(angleShift * j ))) yPos = int(10000*(Request.QueryString("r" & i+1) * cos(angleShift * j ))) objFile.WriteLine("v " & xPos & " " & yPos & " " & 10000 * Request.QueryString("p" & i+1)) 'Response.Write("v " & xPos & " " & yPos & " " & 10000 * Request.QueryString("p" & i+1) & "
") 'Response.Write(Request.QueryString("r" & i+1)) Next Next objFile.WriteLine("v 0 0 " & 10000*Request.QueryString("p" & numCir)) 'Response.Write("v 0 0 " & 10000*Request.QueryString("p" & numCir) & "
") '# Faces Part One For i = 2 to numPnt + 1 'Response.Write(i & " " & numPnt & " ") If i <= numPnt-0 Then objFile.WriteLine("f 1 " & i & " " & i + 1) 'Response.Write("f 1 " & i & " " & i + 1 & "
") Else objFile.WriteLine("f 1 " & i & " 2") 'Response.Write("f 1 " & i & " 2" & "
") End If Next '# Faces Part two For i = 1 to numCir - 1 'For (($j = $i * $numPnt - $numPnt + 1) ; $j <= ($i * $numPnt) ; $j += 1 ) 'Thats the Perl statement for a loop. j = i * numPnt - numPnt + 1 Do While j <= (i * numPnt) If j mod numPnt = 0 Then objFile.WriteLine("f " & j+1 & " " & j+1 + numPnt & " " & j+1 + 1) objFile.WriteLine("f " & j+1 & " " & j+1 + 1 & " " & j+1 - numPnt + 1) 'Response.Write("f " & j+1 & " " & j+1 + numPnt & " " & j+1 + 1 & "
") 'Response.Write("f " & j+1 & " " & j+1 + 1 & " " & j+1 - numPnt + 1 & "
") Else objFile.WriteLine("f " & j+1 & " " & j+1 + numPnt & " " & j+1 + numPnt + 1) objFile.WriteLine("f " & j+1 & " " & j+1 + numPnt + 1 & " " & j+1 + 1) 'Response.Write("f " & j+1 & " " & j+1 + numPnt & " " & j+1 + numPnt + 1 & "
") 'Response.Write("f " & j+1 & " " & j+1 + numPnt + 1 & " " & j+1 + 1 & "
") End If j = j + 1 loop Next '# Faces Part three lastPoint = numPnt * numCir + 2 i = numPnt Do While i > 0 If i <> 1 Then objFile.WriteLine("f " & lastPoint - i & " " & lastPoint & " " & lastPoint - i + 1) 'Response.Write("f " & lastPoint - i & " " & lastPoint & " " & lastPoint - i + 1 & "
") Else objFile.WriteLine("f " & lastPoint - i & " " & lastPoint & " " & lastPoint - numPnt) 'Response.Write("f " & lastPoint - i & " " & lastPoint & " " & lastPoint - numPnt & "
") End If i = i - 1 loop set objFile=nothing set fso=nothing %>

Download your OBJ

<% End Sub '


The maths :

' NumbOfSec = N
' AngleShift = 360 / NumbOfSec

' XOffset = X
' YOffset = Y
' Raduis = R

' XPoisition = (Raduis * sin( AngleShift * n )) + XOffset
' YPosition = (Raduis * cos( AngleShift * n )) + YOffset

' Where n is the line number (0..NumbOfSec-1).

' This assumes that your sin/cos functions are working in degrees.
' If they are in radians then change:

' AngleShift = 360 / NumbOfSec

' to:
' AngleShift = 2*PI / NumbOfSec

' Note. Perl uses radians.
' So does VB ;-) %>