[Bf-committers] An easy to use damped spline

Piotr Arłukowicz piotao at inf.ug.edu.pl
Sat Dec 27 12:36:15 CET 2014


respect!

pio


Piotr Arłukowicz, PhD, BFCT
University of Gdańsk, Faculty of Mathematics, Physics and Informatics,
Dept. of AI,
Wit Stwosz 57, 80-952 Gdańsk, room 121, tel.: +48585232151,
https://inf.ug.edu.pl/~piotao
Polish Blender Course: http://polskikursblendera.pl/ [PL]

2014-12-27 11:39 GMT+01:00 Campbell Barton <ideasman42 at gmail.com>:

> Ugh, never mind, floating point splines aren't any trouble :)
>
> https://gitlab.com/ideasman42/fred-curve/blob/float_spline/pspline.c
>
>
>
> On Sat, Dec 27, 2014 at 9:23 PM, Campbell Barton <ideasman42 at gmail.com>
> wrote:
> > Heres an initial port of the PSpline.pas to C,
> > (single C file, prints 2d curve to stdout).
> >
> > https://gitlab.com/ideasman42/fred-curve/blob/HEAD/pspline.c
> >
> > This is the n-dimensional variant, but for the test it only prints 2d
> values.
> >
> > My main concern with this method of calculating splines is it relies
> > on integer values and bit-shifting. For Blender we would want it to
> > calculate floating point values, I didnt investigate yet how well this
> > method could be used with floats, would be interesting to check on
> > next.
> >
> > On Mon, Sep 29, 2014 at 3:45 AM, Fred <f.harthoorn at ziggo.nl> wrote:
> >> Hi Campbell Barton,
> >>
> >> The amount of interpolation dots is 2^i, at the start of the demo  i =
> >> 4    (16 dots)
> >> if you change i = 7 (the limit in the demo) than there are 128
> >> interpolation dots.
> >>
> >> if I had set the limit in the demo to 10 then 1024 interpolation dots
> >> was possible.
> >>
> >> If the spline is used in a 3 dimensional space,
> >> to compute an interpolated dot position takes:  dim * 10  clock cycles =
> >> 30 clock cycles.
> >> I hope that it is fast enough.
> >>
> >> If you like to have a curve to the last plotted dot you have to put two
> >> dots on each other at the end.
> >> You will see that it is symmetrical again.
> >>
> >> Please change the number to 7 in the demo and you see a curved line in
> >> stead of dots.
> >>
> >> Much more is possible with this spline because the first, second and
> >> third derivative (parameterized ) of the curve
> >> is available in real time.
> >>
> >> I think that much more can be invented with this spline technique.
> >> I think that with some research tangent handles can be constructed as
> >> well (if you like them?).
> >> What I did in the demo was the most simple way of using it.
> >>
> >> The essence is: a 3th degree curve in two (x,y) or more directions is
> >> differentiated three times, and then again integrated 3 times.
> >> With floating point this is impossible , because it is not exact, the
> >> curve runs away.
> >> But with integer computing it is exact and the spline exact a 3th degree
> >> curve.
> >>
> >> It can also be used in ten or more directions, but more then 3
> >> dimensions (x,y,z) is not  practical.
> >>
> >> Fred.
> >> --------------------------------------
> >> Fred schreef op 28-9-2014 om 18:30:
> >>> That is in the demo the case, because I programmed that  the first plot
> >>> point is actually two points.
> >>> the spline uses 4 points p0, p1, p2, p3  and the interpolation is
> >>> between p1 and p2.
> >>>
> >>> Campbell Barton schreef op 28-9-2014 om 17:42:
> >>>> Checked the test application, and not sure if this is intended but a
> >>>> simple triangle has uneven distribution.
> >>>>
> >>>> see: http://www.graphicall.org/ftp/ideasman42/fred_curve.png
> >>>>
> >>>> On Mon, Sep 29, 2014 at 1:32 AM, Dan McGrath <danmcgrath.ca at gmail.com>
> wrote:
> >>>>> Cool, got them. Will take a look later. o/
> >>>>>
> >>>>> Dan
> >>>>>
> >>>>> On Sun, Sep 28, 2014 at 11:28 AM, Fred <f.harthoorn at ziggo.nl> wrote:
> >>>>>
> >>>>>> Ok, It is uploaded to the directory incoming
> >>>>>>
> >>>>>> Dan schreef op 28-9-2014 om 17:15:
> >>>>>>> You could always upload it to our anonymous ftp via
> download.blender.org
> >>>>>>> (or ftp.blender.org) and put it into the incoming directory (use
> passive
> >>>>>>> mode). From there was can fetch the files via
> >>>>>>> http://download.blender.org/ftp/incoming/
> >>>>>>>
> >>>>>>> Dan
> >>>>>>>
> >>>>>>> On Sun, Sep 28, 2014 at 11:05 AM, Fred <f.harthoorn at ziggo.nl>
> wrote:
> >>>>>>>
> >>>>>>>> Campbell Barton
> >>>>>>>>
> >>>>>>>> I have tried to send it but it is rejected. So send me an addres
> for
> >>>>>>>> upload.
> >>>>>>>>
> >>>>>>>> fred
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Campbell Barton schreef op 28-9-2014 om 16:51:
> >>>>>>>>> Could the project files be posted to a public URL?, Id like to
> be able
> >>>>>>>>> to look into this. but probably wont have time over the coming
> weeks.
> >>>>>>>>>
> >>>>>>>>> The main source file compiles for me with minor edits on
> >>>>>>>>> Linux/FreePascal, but the demo relies on `Window` unit, which I
> assume
> >>>>>>>>> is provided by delphi/windows.
> >>>>>>>>>
> >>>>>>>>> On Mon, Sep 29, 2014 at 12:36 AM, Dan McGrath <
> danmcgrath.ca at gmail.com
> >>>>>>>> wrote:
> >>>>>>>>>> Hey,
> >>>>>>>>>>
> >>>>>>>>>> Just save out the delphi project and zip it up and email it to
> me
> >>>>>> direct
> >>>>>>>>>> via email I guess (the mailing list wouldn't allow such a large
> >>>>>>>>>> attachement). I was attempting to compile it on linux, so the
> compiled
> >>>>>>>>>> dll's wouldn't be of much use to me unfortunately.
> >>>>>>>>>>
> >>>>>>>>>> Thanks!
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Dan
> >>>>>>>>>>
> >>>>>>>>>> On Sun, Sep 28, 2014 at 10:06 AM, Fred <f.harthoorn at ziggo.nl>
> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Hi Dan,
> >>>>>>>>>>>
> >>>>>>>>>>> Of course I can  send you the project.
> >>>>>>>>>>> I have made two versions:
> >>>>>>>>>>> 1) The spline is embedded in de demo:
> >>>>>>>>>>> 2) The spline is an external .dll, de demo calls PSpline.dll
> >>>>>>>>>>>
> >>>>>>>>>>> Which one do you prefer?
> >>>>>>>>>>>
> >>>>>>>>>>> Fred.
> >>>>>>>>>>> ----------------
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> Dan McGrath schreef op 28-9-2014 om 15:42:
> >>>>>>>>>>>> So is/was Turbo Pascal (limited in features; eg: objects but
> no
> >>>>>>>> classes)
> >>>>>>>>>>>> and FreePascal+Lazarus (supports almost everything Delphi does
> >>>>>> still?
> >>>>>>>>>>>> http://wiki.freepascal.org/Lazarus_For_Delphi_Users).
> >>>>>>>>>>>>
> >>>>>>>>>>>> Anyway, just thought it was neat to see code in pascal (an
> elegant
> >>>>>>>>>>>> language, imho). Curious though, why not just give the whole
> delphi
> >>>>>>>>>>> project
> >>>>>>>>>>>> and resource files so your forms can be built etc.? The code
> seems
> >>>>>> to
> >>>>>>>>>>>> compile with some modifications here, but without the {$R
> *.DFM}
> >>>>>>>> (*.lfm
> >>>>>>>>>>> in
> >>>>>>>>>>>> fp), one would have to manually rebuild the form :(
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Sun, Sep 28, 2014 at 8:55 AM, Fred <f.harthoorn at ziggo.nl>
> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> It's true, but Delphi is object oriented.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Dan McGrath schreef op 28-9-2014 om 14:53:
> >>>>>>>>>>>>>> Standard Pascal, Turbo Pascal, Freepascal, Delphi; same
> language,
> >>>>>>>>>>>>> different
> >>>>>>>>>>>>>> dialect :)
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On Sun, Sep 28, 2014 at 8:43 AM, Fred <f.harthoorn at ziggo.nl
> >
> >>>>>> wrote:
> >>>>>>>>>>>>>>> Actually it is Delphi
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Dan McGrath schreef op 28-9-2014 om 14:35:
> >>>>>>>>>>>>>>>> Pascal, with inline assembler to boot! \o/ :)
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On Sun, Sep 28, 2014 at 6:46 AM, Ton Roosendaal <
> >>>>>> ton at blender.org>
> >>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Fred told me he's not interested in getting involved, or
> >>>>>> setting
> >>>>>>>> up
> >>>>>>>>>>> a
> >>>>>>>>>>>>>>>>> project for his work.
> >>>>>>>>>>>>>>>>> He's retired now and just thought we might be interested
> in a
> >>>>>>>>>>> research
> >>>>>>>>>>>>>>>>> topic he did.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> I've copied files he sent to me here;
> >>>>>>>>>>>>>>>>> http://download.blender.org/ftp/ton/
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> It's a Dutch pdf and two pascal files.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> -Ton-
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> --------------------------------------------------------
> >>>>>>>>>>>>>>>>> Ton Roosendaal  -  ton at blender.org   -   www.blender.org
> >>>>>>>>>>>>>>>>> Chairman Blender Foundation - Producer Blender Institute
> >>>>>>>>>>>>>>>>> Entrepotdok 57A  -  1018AD Amsterdam  -  The Netherlands
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> On 28 Sep, 2014, at 9:28, Aditia A. Pratama wrote:
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> HI Fred,
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Can you record a screencast/video demo to show how it
> works?
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Regards,
> >>>>>>>>>>>>>>>>>> On Sep 28, 2014 2:14 PM, "Fred" <f.harthoorn at ziggo.nl>
> wrote:
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> I forgot to say, I have a two dimensional demo but it
> is
> >>>>>>>> working
> >>>>>>>>>>> on
> >>>>>>>>>>>>> a
> >>>>>>>>>>>>>>>>>>> windows computer.
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> Jacob Merrill schreef op 28-9-2014 om 02:07:
> >>>>>>>>>>>>>>>>>>>> would this make it so you can record F-curves over
> time
> >>>>>>>> better?
> >>>>>>>>>>>>>>>>>>>> right now recording in the engine gets slower the
> longer it
> >>>>>>>> runs,
> >>>>>>>>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>>>>>>>>
> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>>>>>>>
> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>>
> >>>>>>>>>>>> _______________________________________________
> >>>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>>
> >>>>>>>>>>> _______________________________________________
> >>>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>>>>
> >>>>>>>>>> _______________________________________________
> >>>>>>>>>> Bf-committers mailing list
> >>>>>>>>>> Bf-committers at blender.org
> >>>>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>> _______________________________________________
> >>>>>>>> Bf-committers mailing list
> >>>>>>>> Bf-committers at blender.org
> >>>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>>
> >>>>>>> _______________________________________________
> >>>>>>> Bf-committers mailing list
> >>>>>>> Bf-committers at blender.org
> >>>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>>
> >>>>>> _______________________________________________
> >>>>>> Bf-committers mailing list
> >>>>>> Bf-committers at blender.org
> >>>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>>>
> >>>>> _______________________________________________
> >>>>> Bf-committers mailing list
> >>>>> Bf-committers at blender.org
> >>>>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>>
> >>> _______________________________________________
> >>> Bf-committers mailing list
> >>> Bf-committers at blender.org
> >>> http://lists.blender.org/mailman/listinfo/bf-committers
> >>>
> >>
> >> _______________________________________________
> >> Bf-committers mailing list
> >> Bf-committers at blender.org
> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >
> >
> >
> > --
> > - Campbell
>
>
>
> --
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list