Where did I see Tokamak Cylinders from Boxes?

Blitz3D Forums/Blitz3D Programming/Where did I see Tokamak Cylinders from Boxes?

Gabriel(Posted 2004) [#1]
I'm sure I read a thread recently which talked about making cylinders from multiple, rotated boxes. I think it was on this forum, as I rarely read the Tokamak forum, but I don't recall where exactly and I can't find it.

Just thought it might be interesting to see how it compares with the capsule & box approach I'm current using.


Picklesworth(Posted 2004) [#2]
get a bunch of boxes (I think 16 was the number), and create them in a For loop so that they are evenly distibuted. Something like this (sorry, too lazy to look up functions):
For angle = 0 To 356 Mod 22.5 
;this way it will cycle through the For loop 16 times.

;you can also make a For 0 to 15 which would cycle through
;16 times, then multiply the variable angle by 22.5 whenever you use it.

;Box creation here... using angle

Next



Gabriel(Posted 2004) [#3]
Thanks Dill, that makes sense. Was the idea to use small boxes positioned with Sin and Cos around the circumference of the cylinder's radius or to use boxes with the full diameter of the cylinder all positioned on the centre point and rotated?

EDIT: Ok, knocked up a little function which I guess is what you're describing :

; NEW CREATE REAL TOK CYLINDER ROUTINE ( FOR TESTING )

Function CreateRealTokCylinderWithCubes(depth#,height#,Divisions=16)

	rb=TOKRB_Create()

	BoxHeight#=h#
	BoxWidth#=(Pi*d#)/Divisions
	BoxDepth#=d#
		
	For acount=1 To (Divisions/2)
		Box=TOKRB_AddBox(rb,BoxWidth#,BoxHeight#,BoxDepth#)
		TOKGEOM_SetPositionAndRotation(Box,0,0,0,0,acount*(180/(Divisions/2)),0)
	Next

	Return rb
	
End Function


You'd obviously optimize it a little for use, but it's easier to read the way it is there.

It works ok, but the friction is very high compared to a capsule cylinder and it's a LOT slower, even with just 16 divisions ( eight boxes )


Rob(Posted 2004) [#4]
Hopefully sweenie will have convex hull in soon which makes this stuff redundant.


Picklesworth(Posted 2004) [#5]
yep, he'd better. Apparently v 0.6 is coming in about 2 weeks...