 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2026-05-08 21:45, Bald Eagle wrote:
> The "cubic_spline" type is a Catmull-Rom spline.
> So a cubic spline sphere sweep ought to be able to be overlaid on a sor rendered
> with an orthographic camera.
>
I did that with my curve.inc from https://ingoogni.nl/download/ (curve.zip)
---%<------%<------%<---
//cmd: +w400 +h400 +am2 +a0.01
#version 3.7;
#include "curve.inc"
#global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 emission 0}}
sor {
8,
<0.0, -0.5>,
<3.0, 0.0>,
<1.0, 0.2>,
<0.5, 0.4>,
<0.5, 4.0>,
<1.0, 5.0>,
<3.0, 10.0>,
<4.0, 11.0>
open
pigment {rgb 1}
sturm
}
#declare vC = array[8]{
<0.0, -0.5, 0.0>,
<3.0, 0.0, 0.0>,
<1.0, 0.2, 0.0>,
<0.5, 0.4, 0.0>,
<0.5, 4.0, 0.0>,
<1.0, 5.0, 0.0>,
<3.0, 10.0, 0.0>,
<4.0, 11.0, 0.0>
};
#declare Test = CIcatmull(vC);
#for(T, 0, 1, 0.0015)
sphere{CIget(Test, T), 0.05 pigment{rgb <1,0,0>} translate <0.1,0,0>}
#end
camera {
orthographic angle 60
location <0, 5, -12>
right x*image_width/image_height
look_at <0, 5, 0.0>
}
light_source{<0, 10,-3000> color rgb 1}
---%<------%<------%<---
Note, the red line of the CatmullRom is slightly translated to the
right. I does not match exactly. The CatmullRom is a case of Cardinal
spline where one can set the tension. I have it implemented and a bunch
of other types in Nim. I'll try to get them in POV-Ray and test against
the SORspline.
ingo
Post a reply to this message
Attachments:
Download 'compare_sor.png' (37 KB)
Preview of image 'compare_sor.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2026-05-09 09:36, ingo wrote:
> On 2026-05-08 21:45, Bald Eagle wrote:
in addition, another interesting one to convert is a "bezier style"
version of the CatmullRom spline. The handles work just like in bezier.
The reason I thought of this is you mentioning the "natural cubic"
https://sites.millersville.edu/rbuchanan/math375/CubicSpline.pdf
This is comparable to Akime curves. A system is set up to define a the
tangents at the endpoints (tridiagonal) of a curve segment. Using these
and the Hermite curve matrix, the whole thing is resolved.
You can convert any Hermite slopes based curve (natural cubic, monotone,
Akima, etc.) to Catmull-Rom "Bezier-style" 4-point form.
I have, excusez le mot, a half arsed attempt at code for that in Nim.
Would take a lot of time to get it going and converted to an include file.
ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2026-05-09 09:36, ingo wrote:
> The CatmullRom is a case of Cardinal spline
Added Cardinal and played with tension.
---%<------cardinal for curve.inc---%<------%<---
#macro CIcardinal(CIarr, Tension)
//:Quadratic Cardinal curve
#local DimSeg = 4;
#local Step = 1;
#local Div = 1;
#local T = (1 - Tension) / 2;
#local Matrix = array[4]{
array[4]{ -T, 2.0 - T, T - 2.0, T},
array[4]{2.0 * T, T - 3.0, 3.0 - (2.0 * T), -T},
array[4]{ -T, 0.0, T, 0.0,},
array[2]{ 0.0, 1.0}
}
_CIinit(CIarr, DimSeg, Step, Matrix)
#end
---%<------%<------%<------%<---
---%<------cardinal for scene file---%<------%<---
#declare Test = CIcardinal(vC, 0.65);
#for(T, 0, 1, 0.0015)
sphere{CIget(Test, T), 0.05 pigment{rgb <1,0,0>} translate <0.1,0,0>}
#end
---%<------%<------%<------%<---
neither of both curves give the C2 continuity that a natural cubic
spline gives. The slight curvature in the glass and the stem. My guess
would be SOR is a natural cubic spline. I.i.r.c. ABX had the SOR spline
implemented as a spline in one of patched versions. SuperPov, UeberPov?
ingo
Post a reply to this message
Attachments:
Download 'compare_sor_cardinal.png' (37 KB)
Preview of image 'compare_sor_cardinal.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thank, Ingo - for this and all the other attached work.
The spline + shape from the docs is very informative.
The sor is a centripetal Catmull rom cubic Hermite spline with a tension, or
exponent of 0.5.
I'm not sure what cubic_spline is, but having played with that one in the past,
it may not be. I'm pretty sure that TOK has implemented the natural cubic
spline.
I'll have to pull up github or the 3.7 source on my local machine and hunt down
all of the implementations of spline types so that I can find out where they all
are and accurately classify them.
Thet really need to be all in one place, and not buried inside specific shapes
like CR is with sor.
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2026-05-09 13:39, Bald Eagle wrote:
> centripetal Catmull
Ah, the one that got away. Not doable with curve.inc in it's current
state. In my Nim curve lib, the same state as for natural cubic. Find
slopes and the use Hermite interpolation. So I cannot create a curve of
spheres for POV-Ray from there either.
ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> Thank, Ingo - for this and all the other attached work.
> The spline + shape from the docs is very informative.
>
> The sor is a centripetal Catmull rom cubic Hermite spline with a tension, or
> exponent of 0.5.
>
> I'm not sure what cubic_spline is, but having played with that one in the past,
> it may not be. I'm pretty sure that TOK has implemented the natural cubic
> spline.
>...
Yes, I did - some years ago ;-)
Newsgroup: povray.text.scene-files
From: Tor Olav Kristensen
Subject: Even spacing of points along natural cubic splines
Date: 2010-12-12 09:30:00
http://news.povray.org/povray.text.scene-files/thread/%3Cweb.4d04dadb31d78932c734aecd0%40news.povray.org%3E/
--
Tor Olav
http://subcube.com
https://github
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 10/05/2026 04:02, Tor Olav Kristensen wrote:
> "Bald Eagle" <cre### [at] netscape net> wrote:
>> Thank, Ingo - for this and all the other attached work.
>> The spline + shape from the docs is very informative.
>>
>> The sor is a centripetal Catmull rom cubic Hermite spline with a tension, or
>> exponent of 0.5.
>>
>> I'm not sure what cubic_spline is, but having played with that one in the past,
>> it may not be. I'm pretty sure that TOK has implemented the natural cubic
>> spline.
>> ...
>
> Yes, I did - some years ago ;-)
>
> Newsgroup: povray.text.scene-files
> From: Tor Olav Kristensen
> Subject: Even spacing of points along natural cubic splines
> Date: 2010-12-12 09:30:00
>
http://news.povray.org/povray.text.scene-files/thread/%3Cweb.4d04dadb31d78932c734aecd0%40news.povray.org%3E/
A few experiments I had also conducted, but for Bézier curves.
SDL attached.
--
kurtz le pirate
compagnie de la banquise
Post a reply to this message
Attachments:
Download 'bezier_repartition_uniforme.pov.zip' (3 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I am working on documenting and editing the source, as well as doing some work
in SDL.
Perhaps someone can help me out here.
I have some ideas about using and testing the control points of the spline.
POV-Ray complains when I have a control point with an x component that is
negative. However, the only place that I can find the error, and the conditions
that trigger it - are here:
Starting at line 1005 of sor.cpp
https://github.com/POV-Ray/povray/blob/master/source/core/shape/sor.cpp
if ((fabs(P[i+2][Y] - P[i][Y]) < EPSILON) ||
(fabs(P[i+3][Y] - P[i+1][Y]) < EPSILON))
{
throw POV_EXCEPTION_STRING("Incorrect point in surface of
revolution.");
}
But that code only uses the y-values, and only tests the size of the difference
between the y values of 2 sets of control points. It certainly does NOT include
the x-value of a control point.
So then how is the error getting triggered if there is no testing the x-value???
- BE
sor {
6
<-2.0, 0.5>,
<-1.0, 1>,
<-0.1, 2>,
<-0.2, 3>,
<-1.0, 4>,
<-2.0, 5>
pigment {rgb z}
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> POV-Ray complains when I have a control point with an x component that is
> negative.
> So then how is the error getting triggered if there is no testing the x-value???
Thanks to jr hunting this down while I was busy with other things!
parser.cpp starting at line 5665
if ((Points[i][X] < 0.0) ||
^^^^^^^^^^^^^^^^^^^ and there we go.
((i > 1 ) && (i < Object->Number - 1) && (Points[i][Y] <=
Points[i-1][Y])))
{
Error("Incorrect point in surface of revolution.");
}
The more I do this, the more I see exactly what clipka meant about the parser.
All of these tests and guards ought to be isolated in sor.cpp, not smeared all
over the source codebase.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Here's an overview of what I'm planning on doing with sor {}.
in parser.cpp, I'll be removing
if (P[i][X] < 0.0)
In part because it will allow placing the tangent-determining control points
anywhere,
and because I plan on extending the rendering of the sor to the parts that are
currently
not rendered when they cross or get interpolated across the y-axis into -x
The control points will be used to derive the cubic equation of the spline, and
then the
curve equation to will be evaluated to determine if the curve crosses the
y-axis. If so,
a warning will be issued.
Then the roots (the points where the curve crosses the y-axis) will be found.
The Catmull-Rom spline will be subdivided by creating new subsegments up to the
roots, between the roots, and beyond the roots.
The cubic equation coefficients get stored as A, B, C, and D.
In regions where the spline goes negative in X will have all of the signs of the
coefficients flipped.
That will yield a valid region of the spline segment.
The whole spline will therefore be visibly rendered.
Guard checks on the x & y values, and the height of the spline segments that
include the tangent-controlling points will be fixed to remove the unnecessary
errors.
I have plans to emit the volume of the sor object, and a way to uv-map the
curvature of the surface. (see attached)
Long-term, it would be great to allow defining the sor profile as a spline {}
object and using that spline in the sor {} block syntax.
That would allow using linear and quadratic splines in the sor as well.
The spline would allow easy graphing the cross-section of the sor if desired.
This would also create a new centripetal Catmull-Rom spline type.
Potentially, the positive and negative portions of the sor spline could be
rendered independently.
Allowing descending y-values for the sor would be nice, to allow for
conceptually modelling a sor in the opposite direction.
Post a reply to this message
Attachments:
Download 'sor_curvature_scene_2026-05-13.png' (53 KB)
Preview of image 'sor_curvature_scene_2026-05-13.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |