POV-Ray : Newsgroups : povray.advanced-users : Bezier spline deformation Server Time
31 Oct 2024 20:35:35 EDT (-0400)
  Bezier spline deformation (Message 1 to 10 of 23)  
Goto Latest 10 Messages Next 10 Messages >>>
From: yesbird
Subject: Bezier spline deformation
Date: 14 Mar 2023 07:01:55
Message: <64105423$1@news.povray.org>
Hi,

while working on C4D->POV converter, I've discovered a strange form
deviation of prism, extruded from bezier spline (see attachment).

I claim, that exported data is absolutely correct (checked many times),
and no any useful info found here:
https://www.povray.org/documentation/view/3.7.0/62/
https://wiki.povray.org/content/Reference:Prism

I'm not sure about collisions, but only wonder how the same data with
the algorithm can produce different results. It seams to me, that
interpretation is different or maybe some additional scaling is applied
to tangents, for example.

Code is below, any ideas ?

//----------------------------------------------------------------------------
camera{	perspective
	location  <0, 0, 0>
	angle 53.130102

   matrix
  <1.000000, -0.000000, 0.000000,
   0.000000, 0.000000, 1.000000,
   -0.000000, -1.000000, 0.000000,
   0.058724, 5.575552, -0.059483>

}

#declare Extrude = prism { linear_sweep bezier_spline 0, 1.000000, 16

   <1.500000, 0.000000>
   <1.500000, 0.450694>
   <0.450694, 1.000000>
   <0.000000, 1.000000>
   <0.000000, 1.000000>
   <-0.450694, 1.000000>
   <-1.500000, 0.450694>
   <-1.500000, 0.000000>
   <-1.500000, 0.000000>
   <-1.500000, -0.450694>
   <-0.450694, -1.000000>
   <0.000000, -1.000000>
   <0.000000, -1.000000>
   <0.450694, -1.000000>
   <1.500000, -0.450694>
   <1.500000, 0.000000>
   matrix
  <1.000000, 0.000000, 0.000000,
   0.000000, 1.000000, 0.000000,
   0.000000, 0.000000, 1.000000,
   0.000000, 0.000000, 0.000000>

   material { mat_default }
}

object{ Extrude }
//----------------------------------------------------------------------------


Post a reply to this message


Attachments:
Download 'c4d_spline.png' (60 KB) Download 'c4d_test.png' (23 KB)

Preview of image 'c4d_spline.png'
c4d_spline.png

Preview of image 'c4d_test.png'
c4d_test.png


 

From: yesbird
Subject: Re: Bezier spline deformation
Date: 14 Mar 2023 07:20:10
Message: <6410586a$1@news.povray.org>
On 14/03/2023 14:01, yesbird wrote:
> while working on C4D->POV converter, I've discovered a strange form
> deviation of prism, extruded from bezier spline (see attachment).

And I should say, that for cubic spline I have the same distortion:
> //----------------------------------------------------------------------------
camera{	perspective
	location  <0, 0, 0>
	angle 53.130102

   matrix
  <0.999944, -0.000000, -0.010610,
   0.010182, 0.281279, 0.959572,
   0.002984, -0.959626, 0.281263,
   -0.018327, 5.930451, -1.559761>

}

#declare Extrude = prism { linear_sweep cubic_spline 0, 1.000000, 7

   <0.000000, -1.000000>
   <1.500000, 0.000000>
   <0.000000, 1.000000>
   <-1.500000, 0.000000>
   <0.000000, -1.000000>
   <1.500000, 0.000000>
   <0.000000, 1.000000>
   matrix
  <1.000000, 0.000000, 0.000000,
   0.000000, 1.000000, 0.000000,
   0.000000, 0.000000, 1.000000,
   0.000000, 0.000000, 0.000000>

   material { mat_default }
}

object{ Extrude }
> //----------------------------------------------------------------------------


Post a reply to this message


Attachments:
Download 'c4d_test.png' (24 KB)

Preview of image 'c4d_test.png'
c4d_test.png


 

From: Mike Miller
Subject: Re: Bezier spline deformation
Date: 15 Mar 2023 00:15:00
Message: <web.6411456b122e7e3aa30d213ddabc9342@news.povray.org>
yesbird <sya### [at] gmailcom> wrote:
> On 14/03/2023 14:01, yesbird wrote:
> > while working on C4D->POV converter, I've discovered a strange form
> > deviation of prism, extruded from bezier spline (see attachment).
>
> And I should say, that for cubic spline I have the same distortion:
> > //----------------------------------------------------------------------------
> camera{ perspective
>  location  <0, 0, 0>
>  angle 53.130102
>
>    matrix
>   <0.999944, -0.000000, -0.010610,
>    0.010182, 0.281279, 0.959572,
>    0.002984, -0.959626, 0.281263,
>    -0.018327, 5.930451, -1.559761>
>
> }
>
> #declare Extrude = prism { linear_sweep cubic_spline 0, 1.000000, 7
>
>    <0.000000, -1.000000>
>    <1.500000, 0.000000>
>    <0.000000, 1.000000>
>    <-1.500000, 0.000000>
>    <0.000000, -1.000000>
>    <1.500000, 0.000000>
>    <0.000000, 1.000000>
>    matrix
>   <1.000000, 0.000000, 0.000000,
>    0.000000, 1.000000, 0.000000,
>    0.000000, 0.000000, 1.000000,
>    0.000000, 0.000000, 0.000000>
>
>    material { mat_default }
> }
>
> object{ Extrude }
> > //----------------------------------------------------------------------------

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.
Mike


Post a reply to this message

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


 

Goto Latest 10 Messages Next 10 Messages >>>

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