POV-Ray : Newsgroups : povray.object-collection : Rope_Sys issue Server Time
7 Nov 2025 19:14:55 EST (-0500)
  Rope_Sys issue (Message 1 to 2 of 2)  
From: Chris R
Subject: Rope_Sys issue
Date: 6 Nov 2025 15:55:00
Message: <web.690d0b1a85e8f37cbdf5e0875cc1b6e@news.povray.org>
I have used Chris Bartlett's rope_sys.inc object collection for several years,
and just discovered a subtle bug in the code.

I usually create ropes using the Rope_Array related macros, and then call
Rope_ArrayToSpline or Rope_ArrayToRope.  I was playing with the Rope_BreakSpline
macro so I could have a linear section of the rope followed by a natural spline
section.

The first thing I realized was that calling Rope_BreakSpline() sets the spline
type for the segment of the rope following that call.  You can get around this
to set the spline type of the first segment by calling Rope_BreakSpline
immediately after calling the first Rope_AddPoint()

In my test, I just did that:

Rope_AddPoint(MyPoint1)
Rope_BreakSpline("linear_spline")
Rope_AddPoint(MyPoint2)
Rope_AddPoint(MyPoint3)
Rope_ArrayToRope("")

However, the resulting rope used a natural spline.  I looked at the code for
Rope_ArrayToRope and discovered that there is a check for the number of spline
breaks found to be < 2.  If so, it calls Rope_ArrayToSpline("") which uses the
default natural spline, and then calls Rope() on the resulting single spline,
completely ignoring my first Rope_BreakSpline("linear_spline")

I edited my code to make the check < 1, forcing it to look at that first
Rope_BreakSpline and create a spline using that spline type and now it works.

If I had actually added some additional points and called Rope_BreakSpline() a
second time, the code would have worked as written.

I don't know if this code is being maintained in GitHub or if the library comes
back alive if there is a way to patch it.  It's not a huge deal, it just always
bothered me that I couldn't use Rope_ArrayToRope if I wanted anything other than
a natural spline.
-- Chris R.


Post a reply to this message

From: jr
Subject: Re: Rope_Sys issue
Date: 6 Nov 2025 17:20:00
Message: <web.690d1e7ca89778de475fba6a6cde94f1@news.povray.org>
hi,

"Chris R" <car### [at] comcastnet> wrote:
> I have used Chris Bartlett's rope_sys.inc object collection for several years,
> and just discovered a subtle bug in the code.
> ...
> I don't know if this code is being maintained in GitHub or if the library comes
> back alive if there is a way to patch it.

no idea re "github".  the object collection work has been sidelined this year,
due to (quoting Churchill) "events dear boy, events".  a (corrected) version 1.1
(?) could be one of the first to add when it (OC) gets finished.  (tia :-))


regards, jr.


Post a reply to this message

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