Tapered Cylinder request

Blitz3D Forums/Blitz3D Programming/Tapered Cylinder request

_PJ_(Posted 2009) [#1]
Hate to ask this, but my knowledge and ability in working with verts and surfaces etc. is worse than a fish that can't swim.

Could soemone be kind enough to code out a function that creates a primitive (single surface only is fine) similar to the CreateCylinder, but with an extra parameter (or however many) to set an amount of 'tapering'.

The end result, hopefully would look like a pyramid with the top cut off.

I envisage soemthing like the following:
CreateTaperedCone(VerticalSides%,FinalXRatio#,FinalZRatio#,Solid,Parent)

The 'pyramid' stands on its base and all the vertical vertices (defined by VerticalSides) taper inwards, then perhaps a X ratio and Z ratio# of the top of the mesh compared to the magnitude of the vertices of the base?


In this way, Ratio#>0.0 means the sides taper outwards and <0.0 would taper inwards, whilst 0 would remain a regular cylinder and - 0.5 would be a Pyramid/Cone.
Values less than -0.5 would likely result in the tapered vertices crossing each other and creating a weird inverse hourglass thing or something :)

If this is too much to ask, no problem, I can';t say how difficult it might be for many of you, all I know is, it's beyond me ;)


Warner(Posted 2009) [#2]
Here, maybe you can adapt it for what you want:



_PJ_(Posted 2009) [#3]
Thanks, Warner, I'l give it a try.
-------


Oops nevermind - it works great, Warner, thanks very much.

Is there any way to remove a couple of the sides from the cylinder? As CreateCylinder has a hardocded minimum of 8 segments, but a tapered cone could have ony 5 minimum.


Stevie G(Posted 2009) [#4]

Is there any way to remove a couple of the sides from the cylinder? As CreateCylinder has a hardocded minimum of 8 segments, but a tapered cone could have ony 5 minimum.



Not so, setting the segs to 5 works just fine. The min will likley be 3.

Stevie


_PJ_(Posted 2009) [#5]
So it is :)

I misread I think, 8 is the default not he minimum. Thanks lots!


GIB3D(Posted 2009) [#6]
And the sphere's minimum is 2, which makes it look like a rotated cube/diamond/gem.


Nate the Great(Posted 2009) [#7]
be sure to add this before return:

	UpdateNormals mesh