POV-Ray : Newsgroups : povray.object-collection : SphereSweep 1.2, with Bezier splines Server Time
21 Nov 2024 06:48:55 EST (-0500)
  SphereSweep 1.2, with Bezier splines (Message 1 to 8 of 8)  
From: Cousin Ricky
Subject: SphereSweep 1.2, with Bezier splines
Date: 11 Sep 2015 20:21:40
Message: <55f37014@news.povray.org>
In SphereSweep 1.2, the Bézier spline is implemented for all the object 
macros except SphereSweep_Native().

http://lib.povray.org/searchcollection/index2.php?objectName=SphereSweep&contributorTag=Cousin%20Ricky

In light of recent interest in Bézier sphere sweeps, here are some notes 
on the implementation in spheresweep.inc.

The new include file is nearly twice the size of the previous version. 
The actual Bézier calculation is done in macro SSwp__Bezier_calc(), and 
is remarkably simple.  But, as I have mentioned before, integrating this 
calculation into functional objects was not straightforward.  The bulk 
of the new code is for managing the different segments.  Unlike the 
curve sections of all the other spline types, Bézier segments are not 
logically tied to each other.  This necessitated handling Bézier objects 
separately from all the others, as well as writing new macros dedicated 
to negotiating the splicing of curve segments when and only when the 
segments are physically contiguous.

My calculation uses brute force rather than the single reduced formula 
with all the pow() calls.  This was because my ability to concentrate is 
so bad nowadays that I just gave up on trying to figure it out.  I 
figured that the internal math of the reduced formula would be more 
complicated anyway.  Had I known how simple the final formula was, and 
recalled Clipka's observation that the complexity of the SDL always 
trumps the math, I would have taken that route.  However, the parse time 
is so short, there would be little difference either way.

If you examine the SDL code, you will notice that all of the local 
variables are prefixed with sswp_.  This would seem redundant with the 
#local directives, and makes the code rather hard to follow.  The reason 
for this policy is to circumvent an unfortunate POV-Ray namespace scope 
leakage; it is a requirement for Object Collection compliance level 3. 
(Not all "compliant" modules follow this rule, because it wasn't 
instituted until the scope leakage was discovered, which was well after 
the creation of the Object Collection.)

I've recently discovered that the PointArrays module has Bézier sphere 
sweep capability.  Previously, I had only noticed the lathe and prism 
features.  With all the talk about sphere sweeps lately, I'm surprised 
that Matthew (a.k.a. Blue Herring) never chimed in.  (Are you still 
around, Matthew?)  There is considerable overlap between the two 
modules, including variable radius capability.  Matthew seems to have 
approached the problems similarly to the way I did, although we use 
different user interfaces.  (And, you can check out the SDL for both 
modules, to see how straightforward it was to accommodate varying 
radii.)  I have focused more on sphere sweeps, and have provided more 
options for these than PointArrays does.  PointArrays, for its part, has 
more array manipulation capability.


Post a reply to this message

From: LanuHum
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 12 Sep 2015 04:35:01
Message: <web.55f3e321b134517f7a3e03fe0@news.povray.org>
Cousin Ricky <ric### [at] yahoocom> wrote:
> In SphereSweep 1.2, the Bézier spline is implemented for all the object
> macros except SphereSweep_Native().
>
>
http://lib.povray.org/searchcollection/index2.php?objectName=SphereSweep&contributorTag=Cousin%20Ricky
>

In the Blender it is possible to scale only control points.
At you
#declare Arm_def = array[4][3]
#declare Arm_rs = array[12]
Unclear, as to control it.


Post a reply to this message

From: Cousin Ricky
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 12 Sep 2015 08:15:01
Message: <web.55f416c3b134517fdb6413070@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> In the Blender it is possible to scale only control points.
> At you
> #declare Arm_def = array[4][3]
> #declare Arm_rs = array[12]
> Unclear, as to control it.

Arm_def is not used as-is by Bezier algorithms.  It describes Bezier curves in a
format that I find easier to control.  The format is described in the user
manual.

The macro SSwp_Bezier() converts Arm_def to Arm_pts.  Arm_pts is the
one-dimensional array of control points that is in the form expected by Bezier
algorithms.  If you look at the message window from a spheresweep_cockpit.pov
render, you will see the Arm_pts array in its final form.

Arm_rs is the array of the radii that correspond to the control points.


Post a reply to this message

From: clipka
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 12 Sep 2015 09:39:32
Message: <55f42b14$1@news.povray.org>
Am 12.09.2015 um 02:21 schrieb Cousin Ricky:

> Unlike the
> curve sections of all the other spline types, Bézier segments are not
> logically tied to each other.  This necessitated handling Bézier objects
> separately from all the others, as well as writing new macros dedicated
> to negotiating the splicing of curve segments when and only when the
> segments are physically contiguous.

Why not just require that the end point of one Bézier segment is equal
to the starting point of the next one?


Post a reply to this message

From: LanuHum
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 12 Sep 2015 11:25:01
Message: <web.55f44395b134517f7a3e03fe0@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> "LanuHum" <Lan### [at] yandexru> wrote:
> > In the Blender it is possible to scale only control points.
> > At you
> > #declare Arm_def = array[4][3]
> > #declare Arm_rs = array[12]
> > Unclear, as to control it.
>
> Arm_def is not used as-is by Bezier algorithms.  It describes Bezier curves in a
> format that I find easier to control.  The format is described in the user
> manual.
>
> The macro SSwp_Bezier() converts Arm_def to Arm_pts.  Arm_pts is the
> one-dimensional array of control points that is in the form expected by Bezier
> algorithms.  If you look at the message window from a spheresweep_cockpit.pov
> render, you will see the Arm_pts array in its final form.
>
> Arm_rs is the array of the radii that correspond to the control points.

In vector graphics all curve bezier are provided as sequence of bezier-splines
(cairo, inkscape, blender).
One spline:
move_to (x, y) - control point 0
curve_to (x0, y0, x1, y1, x2, y2)
Where
x0, y0 - right handle control point 0
x1, y1 - left handle control point 1
x2, y2 - control point 1
That the user could transfer data from the editor to your macro, it is necessary
to follow the standard.
If the end of a spline 0 is the beginning of a spline 1
move_to (x, y)
curve_to (x0, y0, x1, y1, x2, y2)
curve_to (x3, y3, x4, y4, x5, y5)
curve_to (x6, y6, x7, y7, x8, y8)
curve_to (x9, y9, x10, y10, x11, y11)
If splines are broken off,
move_to (x, y)
curve_to (x0, y0, x1, y1, x2, y2)
move_to (x3, y3)
curve_to (x4, y4, x5, y5, x6, y6)


Post a reply to this message

From: Cousin Ricky
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 12 Sep 2015 15:00:00
Message: <web.55f47575b134517f4ed434990@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Why not just require that the end point of one Bézier segment is equal
> to the starting point of the next one?

The criteria were obvious enough.  Loop control was another matter, and worse,
the solution differed depending on whether I was constructing the object out of
cones and spheres, blob components, or linear_spline sphere_sweeps.


Post a reply to this message

From: And
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 13 Sep 2015 23:50:00
Message: <web.55f64388b134517f9282c0160@news.povray.org>
Cousin Ricky <ric### [at] yahoocom> wrote:
> In SphereSweep 1.2, the Bézier spline is implemented for all the object
> macros except SphereSweep_Native().
>
>
http://lib.povray.org/searchcollection/index2.php?objectName=SphereSweep&contributorTag=Cousin%20Ricky
>

congratulations.!

>
> I've recently discovered that the PointArrays module has Bézier sphere
> sweep capability.  Previously, I had only noticed the lathe and prism
> features.  With all the talk about sphere sweeps lately, I'm surprised
> that Matthew (a.k.a. Blue Herring) never chimed in.  (Are you still
> around, Matthew?)  There is considerable overlap between the two
> modules, including variable radius capability.  Matthew seems to have
> approached the problems similarly to the way I did, although we use
> different user interfaces.  (And, you can check out the SDL for both
> modules, to see how straightforward it was to accommodate varying
> radii.)  I have focused more on sphere sweeps, and have provided more
> options for these than PointArrays does.  PointArrays, for its part, has
> more array manipulation capability.

Well, it is a good module indeed. Thanks.


Post a reply to this message

From: Cousin Ricky
Subject: Re: SphereSweep 1.2, with Bezier splines
Date: 23 Nov 2015 23:32:16
Message: <5653e850$1@news.povray.org>
On 09/12/2015 09:38 AM, clipka wrote:
> Am 12.09.2015 um 02:21 schrieb Cousin Ricky:
>
>> Unlike the
>> curve sections of all the other spline types, Bézier segments are not
>> logically tied to each other.  This necessitated handling Bézier objects
>> separately from all the others, as well as writing new macros dedicated
>> to negotiating the splicing of curve segments when and only when the
>> segments are physically contiguous.
>
> Why not just require that the end point of one Bézier segment is equal
> to the starting point of the next one?

It just occurred to me that I may have misinterpreted your question.  If 
it's why I don't disallow discontinuous segments, I just made a decision 
to allow maximum flexibility.


Post a reply to this message

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