POV-Ray : Newsgroups : povray.binaries.images : Chain library : Chain library Server Time
30 Mar 2025 23:08:09 EDT (-0400)
  Chain library  
From: Chris R
Date: 25 Mar 2025 12:50:00
Message: <web.67e2ddadccfeb8f1a40969eb5cc1b6e@news.povray.org>
In a continued spate of library development, I took a bunch of disparate code I
had written for chains used in other scenes and consolidated it into a library I
call libchain.inc.

The new library provides a number of macros for describing links, chains
consisting of one or more types of links, and chain layouts consisting of a set
of connected links.

I have provided a sample chain definition in library/chains/samples.inc that is
used in the demo scene Examples/chain_test.pov.

The chain layout macros borrowed from rope_sys.inc but I had to modify the
overall approach because chain links don't behave the way small segments of rope
do.  But, the library contains macros for adding single links, straight segments
of links, slack segments of links, catenaries, splines, and spirals.  They are
also written to allow specifying optional modifications to the positions of
individual chain links and their rotation.  There are still some bugs I haven't
chased down when using some of these offset functions for the coil, for example.
 TBD.

The image below creates a chain that begins with a straight segment from the
floor to a point near the cylinder, then wraps around the cylinder N+0.5 times,
and then drops straight to the floor again.  There is then a spline segment for
the chain on the floor where I changed the default link rotation function to
something that a chain resting on a flat surface would fall into.  There is then
a straight link to the top of the first pole, (no attempt to avoid intersecting
with the poles), a slack segment to the second pole, and a catenary to the last
pole.

Other work to come; code to drape a chain over an object, more tests and fixes
to the layouts with variations in the link offsets, more chain link examples,
including chains with multiple types of links.

As usual, the code can be pulled from my GitHub repository:
https://github.com/carath63/povlibrary.

-- Chris R


Post a reply to this message


Attachments:
Download 'chain_test.png' (802 KB)

Preview of image 'chain_test.png'
chain_test.png


 

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