News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Bezier Spline - want to expand <sub> and <sup>

Started by dedndave, May 29, 2013, 08:08:07 PM

Previous topic - Next topic

Gunther

Hi Dave,

Quote from: dedndave on June 02, 2013, 08:02:13 AM
well, it's trying to work - lol
at least it doesn't crash   :biggrin:

you're in the right direction.

Gunther
You have to know the facts before you can distort them.

dedndave


dedndave

success   :biggrin:

let me do some clean-up, then i'll post a program with source   :t


dedndave

the FPU code probably isn't as efficient as it could be
for example, i may have a couple FWAIT's in there that could be eliminated   :P
but, the function works fairly well
it could be updated for SSE, too

updated the documentation for the routine

dedndave

by the way, i did a re-design on the original algorithm   :biggrin:

         // Set right hand side X values
         for (int i = 1; i < n - 1; ++i)
            rhs = 4 * knots.X + 2 * knots[i + 1].X;
         rhs[0] = knots[0].X + 2 * knots[1].X;
         rhs[n - 1] = (8 * knots[n - 1].X + knots[n].X) / 2.0;
         // Get first control points X-values

         double[] x = GetFirstControlPoints(rhs);

         // Set right hand side Y values
         for (int i = 1; i < n - 1; ++i)
            rhs = 4 * knots.Y + 2 * knots[i + 1].Y;
         rhs[0] = knots[0].Y + 2 * knots[1].Y;
         rhs[n - 1] = (8 * knots[n - 1].Y + knots[n].Y) / 2.0;
         // Get first control points Y-values

         double[] y = GetFirstControlPoints(rhs);

the part in red was incorporated into the GetFirstControlPoints function
i also added stack-probe code for the local arrays

dedndave

i updated the documentation for the routine....

a minimum of 3 knot points is required   :P

Gunther

Hi Dave,

you've made a very encouraging progress. Looks nice.  :t

Gunther
You have to know the facts before you can distort them.

dedndave


Siekmanski

Creative coders use backward thinking techniques as a strategy.

dedndave

thanks, Marinus   :biggrin:

i'll probably update it, after i've had some time to optimize it a little bit

Tedd

Potato2

jj2007

Real cute, Dave :t

By the way, why this combi instead of fstp st?
        ffree   st(0)
        fincstp


qWord

Quote from: dedndave on June 03, 2013, 02:31:19 AM
the FPU code probably isn't as efficient as it could be
for example, i may have a couple FWAIT's in there that could be eliminated   :P
FWAIT makes sure that unmasked FP exceptions are handled, but due FINIT all expectations are masked and thus there is no need to use this instruction.
MREAL macros - when you need floating point arithmetic while assembling!

daydreamer

good work Dave :t
edit:should be fun to see what happens if you feed landscaperenderer in this thread:
http://masm32.com/board/index.php?topic=1890.75
with many of your curves
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

dedndave

thanks, Tedd, Jochen, qWord, and DayDreamer   :t

i was just reviewing my use of FWAIT
it seems to work with all of them removed - lol
although, there may be one or two that are prudent
for example, i change the value of a pointer while the FPU is writing to that location
with FPU code, the CPU and FPU execute different streams, so to speak
i don't want the cart to get in front of the horse   :P
i may be able to rearrange some instructions to eliminate all of them

back in the 80's, i was fairly used to writing code for the 8087
it was a very different animal than modern FPU implementations
and - that was a while ago - my memory isn't what it used to be

Quote from: jj2007 on June 04, 2013, 01:11:38 AM
By the way, why this combi instead of fstp st?
        ffree   st(0)
        fincstp

thanks Jochen - i guess i had forgotten that little trick - i am rusty

Quote from: qWord on June 04, 2013, 01:40:01 AM
FWAIT makes sure that unmasked FP exceptions are handled, but due FINIT all expectations are masked and thus there is no need to use this instruction.

i thought the idea was to cause the CPU to wait until the FPU finishes the current instruction
as for FINIT - i put that in there as a matter of habit (i could just set precision control  :P )
but, i would like the routine to work without it, also

Quote from: daydreamer2 on June 04, 2013, 01:57:51 AM
edit:should be fun to see what happens if you feed landscaperenderer in this thread:
http://masm32.com/board/index.php?topic=1890.75
with many of your curves

yes - one of the goals is to pick colors, rather than X,Y points, by using a bezier (or similar) interpolation
but, the PolyBezier function doesn't suit that case

i will probably also add support for a bezier with 2 points and validate the number of points param
once i get this one cleaned up, i will do one for closed curves,
then move on to generating points without using PolyBezier