POV-Ray : Newsgroups : povray.advanced-users : how to create a random coil : Re: how to create a random coil Server Time
5 Jul 2024 16:03:36 EDT (-0400)
  Re: how to create a random coil  
From: zj905
Date: 19 Oct 2007 19:00:01
Message: <web.471935d2144555e34849a21c0@news.povray.org>
Thanks for your detailed help. I really appreciate that. Another reader also
mentioned spline method. http://www.geocities.com/ccolefax/spline/index.html
The question is: this method can build one random chain. If the surface were
grafted with hundreds or thousands of chains, how to do? Is there any random
function available to generate the spline path?
"Chris B" <c_b### [at] btconnectcom> wrote:
> "zj905" <zj9### [at] hotmailcom> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.