ropeypopey opened this issue on Aug 31, 2006 · 36 posts
bagginsbill posted Fri, 01 September 2006 at 2:23 PM
You can simplify the math a little.
Letting d be the desired diameter, m be the slope of the stripes, and I introduce k for the modulus subexpression:
r = d / 2
k = (V + m * U) % d
s = k - r
You use Sqrt(r * r - s * s)
but:
r * r - s * s
is
r * r - (k - r) * (k - r)
which is
r * r - (k * k - 2 * r * k + r * r)
which is
r * r - r * r + 2 * r * k - k * k
which is
k * (2 * r - k)
which is
k * (d - k)
So we don't ever need r and the solution is:
k = (V + m * U) % d
Sqrt(k * (d - k))
I made a function out of that - it's going into matmatic extras!
Been playing with the functions - renders real fast on a square. But on the cylinder it sucks.
I think its because the geometry of the sides of the cylinder - long thin rectangles must cause some issue.
I don't have time to try it now, but you might want to make a cylinder in some other tool that has no end caps and uses a lot of small polygons. Maybe triangles would be better than quads, too.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)