POV-Ray : Newsgroups : povray.advanced-users : Bezier spline deformation Server Time
22 Nov 2024 00:55:41 EST (-0500)
  Bezier spline deformation (Message 4 to 13 of 23)  
<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: ingo
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 03:15:00
Message: <web.64116ff1122e7e3a17bac71e8ffb8ce3@news.povray.org>
Using my curves macro:
---%<---%<---%<---
#version 3.7;

#include "curve.inc"  //https://ingoogni.nl/download/Curve.zip

#global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 emission 0}}

#declare vT = array[2]{0, 1}

#declare vC = array[13]{
   <1.500000, 0.000000, 0>,
   <1.500000, 0.450694, 0>,
   <0.450694, 1.000000, 0>,
   <0.000000, 1.000000, 0>,
   <-0.450694, 1.000000, 0>,
   <-1.500000, 0.450694, 0>,
   <-1.500000, 0.000000, 0>,
   <-1.500000, -0.450694, 0>,
   <-0.450694, -1.000000, 0>,
   <0.000000, -1.000000, 0>,
   <0.450694, -1.000000, 0>,
   <1.500000, -0.450694, 0>,
   <1.500000, 0.000000, 0>
}
#declare Test = CIt(CIlinear(vT), CIbezier3(vC));


//get the points on the curve
#for(T, 0, 1, 0.005)
  sphere{CITget(Test, T), 0.02 pigment{rgb 1}}
#end

//control points
sphere{Test[1][1][0] 0.03 pigment{rgb <1,0,0>}}
#for(i, 1, dimension_size(Test[1][1],1) - 1)
  sphere{Test[1][1][i] 0.03 pigment{rgb <1,0,0>}}
  cylinder{Test[1][1][i-1], Test[1][1][i], 0.01 pigment{rgb <1,0,0>}}
#end

camera {
  perspective angle 45
  location  <0, 0, -6>
  right     x*image_width/image_height
  look_at   <0, 0, 0.0>
}

light_source{<0, 0,-3000> color rgb 1}

---%<---%<---%<---


Post a reply to this message

From: ingo
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 03:35:00
Message: <web.641173f2122e7e3a17bac71e8ffb8ce3@news.povray.org>
"ingo" <nomail@nomail> wrote:


Post a reply to this message


Attachments:
Download 'bez_test.png' (29 KB)

Preview of image 'bez_test.png'
bez_test.png


 

From: yesbird
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 03:47:23
Message: <736a5120-c008-974b-7783-0b76be8983fb@gmail.com>
On 15/03/2023 10:13, ingo wrote:
> Using my curves macro:

Thank you for this test, POV leads 2:0 now. It seems that C4D has some
hidden spline rendering magic. I will ask MAXON support now...
--
YB


Post a reply to this message

From: yesbird
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 04:03:48
Message: <85b87be3-7ea0-95d9-62fa-0aa3cad0a315@gmail.com>
On 15/03/2023 07:11, Mike Miller wrote:
> I'll take a look. Have you tried plotting those same points in another package?
> ...like AutoCAD or FreeCAD. Did you try adding a tolerance? I doubt it would
> matter.

No, I have no them, maybe some online tools...
Also will try to ask MAXON support - they answer very quickly.
--
YB


Post a reply to this message

From: yesbird
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 05:55:55
Message: <b44b0560-ea7d-f389-12d8-47cbc7d21017@gmail.com>
On 15/03/2023 10:47, yesbird wrote:
> It seems that C4D has some hidden spline rendering magic.

This is a Matlab version of cubic spline (attached):
------------------------------------
fnplt(cscvn( [1.5 0 -1.5 0 1.5; ...
               0 1 0 -1 0] ))
------------------------------------

details are here:
https://www.mathworks.com/help/curvefit/cscvn.html?searchHighlight=cscvn&s_tid=srchtitle_cscvn_1

Score is 2:2 now ...
--
YB


Post a reply to this message


Attachments:
Download 'c4d_spline.png' (22 KB)

Preview of image 'c4d_spline.png'
c4d_spline.png


 

From: ingo
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 07:15:00
Message: <web.6411a7b7122e7e3a17bac71e8ffb8ce3@news.povray.org>
yesbird <sya### [at] gmailcom> wrote:
> On 15/03/2023 10:47, yesbird wrote:

Cubic splines are hard to compare. What cubic is used by whom?

Inkscape bezier:


Post a reply to this message


Attachments:
Download 'inkscape_bezier.jpg' (108 KB)

Preview of image 'inkscape_bezier.jpg'
inkscape_bezier.jpg


 

From: ingo
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 07:30:00
Message: <web.6411abfd122e7e3a17bac71e8ffb8ce3@news.povray.org>
"ingo" <nomail@nomail> wrote:
> yesbird <sya### [at] gmailcom> wrote:
> > On 15/03/2023 10:47, yesbird wrote:
>
> Cubic splines are hard to compare. What cubic is used by whom?

Cubic B-spline using my curve macros

---%<------%<------%<---

#version 3.7;

#include "curve.inc"  //https://ingoogni.nl/download/Curve.zip

#global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 emission 0}}

#declare Bspl3 = CIbspline3(
    array[7]{
        <0.000000, -1.000000,0>
        <1.500000, 0.000000,0>
        <0.000000, 1.000000,0>
        <-1.500000, 0.000000,0>
        <0.000000, -1.000000,0>
        <1.500000, 0.000000,0>
        <0.000000, 1.000000,0>
    }
)

//get the points on the curve
#for(T, 0, 1, 0.005)
  sphere{CIget(Bspl3, T), 0.02 pigment{rgb 1}}
#end

//control points
sphere{Bspl3[1][0] 0.03 pigment{rgb <1,0,0>}}
#for(i, 1, dimension_size(Bspl3[1],1) - 1)
  sphere{Bspl3[1][i] 0.03 pigment{rgb <1,0,0>}}
  cylinder{Bspl3[1][i-1], Bspl3[1][i], 0.01 pigment{rgb <1,0,0>}}
#end

camera {
  perspective angle 45
  location  <0, 0, -6>
  right     x*image_width/image_height
  look_at   <0, 0, 0.0>
}

light_source{<0, 0,-3000> color rgb 1}

---%,------%<------%<---


Post a reply to this message


Attachments:
Download 'test4.png' (22 KB)

Preview of image 'test4.png'
test4.png


 

From: yesbird
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 08:24:40
Message: <5b92f96f-c8ce-6d16-3d3d-96b290d02a06@gmail.com>
On 15/03/2023 14:29, ingo wrote:
>> Cubic splines are hard to compare. What cubic is used by whom?

As I was expected, looks like the reason is default location of control
points, no any magic here.
--
YB


Post a reply to this message

From: Alain Martel
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 09:27:50
Message: <6411c7d6$1@news.povray.org>
Le 2023-03-15 à 03:30, ingo a écrit :
> "ingo" <nomail@nomail> wrote:
> 
> 
> 
I see the problem. Your spline is not «stiff» enough.
Try pushing the control points back. That'll make the spline flatter at 
the placement points.

Try this :
#declare vC = array[13]{
    <1.500000, 0.000000, 0>,//P
    <1.500000, 0.6, 0>,//C
    <0.47, 1.000000, 0>,//C
    <0.000000, 1.000000, 0>,//P
    <-0.47, 1.000000, 0>,//C
    <-1.500000, 0.6, 0>,//C
    <-1.500000, 0.000000, 0>,//P
    <-1.500000, -0.6, 0>,//C
    <-0.47, -1.000000, 0>,//C
    <0.000000, -1.000000, 0>,//P
    <0.47, -1.000000, 0>,//C
    <1.500000, -0.6, 0>,//C
    <1.500000, 0.000000, 0>//P
}


Post a reply to this message

From: ingo
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 10:50:00
Message: <web.6411da2e122e7e3a17bac71e8ffb8ce3@news.povray.org>
Alain Martel <kua### [at] videotronca> wrote:

> > "ingo" <nomail@nomail> wrote:
> >
> >
> >

> Try pushing the control points back. That'll make the spline flatter at
> the placement points.

Thanks Alain, I'm aware of that, just tried to show that the POV-Ray
implementation of the Bezier spline is not wrong using yesbird's data and
various implementations.

ingo


Post a reply to this message

<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>

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