|
![](/i/fill.gif) |
"zj905" <zj9### [at] hotmail com> wrote in message
news:web.4716a8faa1216bf14f7090800@news.povray.org...
> how to draw some random chains grafted on the surface? Thanks.
>
I assume you mean a sort of heap on the floor or something like that.
I've seen some POV-Ray chain macros about, but a quick Google didn't lead me
to any of them.
If I were doing this from scratch I'd probably start by defining a spline,
using a sphere sweep to check that it defined a suitably random looking path
across the surface in question and building it up so that successive loops
didn't intersect each other.
Next I'd define a chain link (e.g. two half torii and two cylinders CSG'd
together) such that the centre of the metal at one end of the link is at the
origin with the link in a clearly defined orientation (e.g. standing upright
and aligned with the Z-axis).
To position each chain link you need to keep a record of where the current
link is on the spline. Retrieve the coordinates of a point further along the
spline by incrementing the spline value until the distance between the two
points equals the distance from the inner edge of one torus to the inner
edge of the other. This gives you the position of the next link. The
difference between the two coordinates gives you a vector representing the
'lateral' orientation of the current link. Now rotate the current link
(still at the origin) along its length so that it's between 30 degrees and
150 degrees off that of the previous link (you could use randomness or a
more gravity based algorithm), use Reorient_Trans to orient it to the
'lateral' orientation, then translate it to the current link position.
Now your new point becomes your current point and you repeat until you reach
the end of your chain.
Hope this helps.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |