Importing (& streamlining) EPS

jbv jbv.silences at club-internet.fr
Fri Jun 6 16:09:00 EDT 2003


Alejandro,

> Can you give us an example of this linear
> interpolation?

At the end of this message you'll find the Bezier
handler I'm using. The linear interpolation works
although it's still a bit crude and needs some more
fine tuning.
I haven't had a look yet at the other approach you
mentioned in your last email, but if that new
solution is "really" computationally intensive,
I guess I'll stick with linear interpolation which
isn't too slow after all...

>
>
> By the way jbv, you made a demostration of openGL
> in MetaCard. Are you going to keep working in
> this demo? or Abandoned the idea?

Well, it's a long story. About 6 months ago, I was
planing to develop this openGL thing within a project
for a client. It seemed like a good opportunity to make
some "applied research" financed by a real life project.

Unfortunately, the client abandonned the project and I
found myself overflooded with other things to do and
had to put the idea on a shelf for a while.
Now I'm working on it at home in my spare time (using
Code Warrior on a Mac), and of course things have been
slowed down by several orders of magnitude. It's quite
irritating because it opens a fantastic new world...

Anyway, if anyone is willing to sponsor this research,
please contact me off-list...

Thanks,
JB


------------------------------------------------------------------


on bezier
  global variablezxc,a,b,c,d,Vsteps
  put a &cr& b &cr& c &cr& d
  put the first item of a into x1 -- red dot the first item of the loc of
grc startpoint
  put the first item of d into x2 -- blue dot the first item of the loc of
grc endpoint
  put the first item of b into xa -- green dot the first item of the loc
of grc control1
  put the first item of c into xb -- yellow dot the first item of the loc
of grc control2
  put the second item of a into y1
  put the second item of d into y2
  put the second item of b into ya
  put the second item of c into yb

  put 20 into Nsteps
  put 0 into v1
  put(1/Nsteps)into j
  put "" into n
  put "" into nv

  Repeat with i = 1 TO Nsteps
    put i*j into v1
    put v1 into line i of n
    put 1-v1 into v2
    put v1*v1*v2 into v11
    put v1*v2*v2 into v22
    put(v2^3)into v3
    put(v1^3)into v13

    put (x1*v3+(3*xa*v22)+(3*xb*v11)+(x2*v13))into x
    put (y1*v3+(3*ya*v22)+(3*yb*v11)+(y2*v13))into y
    put x div 1,y div 1 & return after variablezxc
  end repeat


  -- REMOVES similar successive pairs of values

  repeat with i=(number of lines of variablezxc) down to 2
    if line i of variablezxc is not "" then
      if line i of variablezxc = line i-1 of variablezxc then
        delete line i of variablezxc
      end if
    end if
  end repeat



  -- INITIALIZES step value AND fixed x values

  put trunc(abs(item 1 of last line of variablezxc-item 1 of first line of
variablezxc)/Nsteps) into v
  put "" into Vsteps
  repeat with i=1 to Nsteps
    put item 1 of first line of variablezxc+(i*v) into item 1 of line i of
Vsteps
  end repeat
  put item 1 of first line of variablezxc & cr before Vsteps



  -- COMPUTES linear interpolation on y values according to new x values

  repeat with j=1 to (number of lines of Vsteps)-1
    repeat with i=1 to number of lines of variablezxc
      if item 1 of line i of Vsteps = item 1 of line j of variablezxc then

        put item 2 of line i of variablezxc into item 2 of line i of
Vsteps
        next repeat
      else
        if (item 1 of line i of Vsteps > item 1 of line j of variablezxc)
and (item 1 of line i of Vsteps < item 1 of line (j+1) of variablezxc)
then
          put item 1 of line j of variablezxc into x1
          put item 1 of line (j+1) of variablezxc into x2
          put item 2 of line j of variablezxc into y1
          put item 2 of line (j+1) of variablezxc into y2
          put trunc(y1+((y2-y1)*((item 1 of line i of
Vsteps-x1)/(x2-x1)))) into item 2 of line i of Vsteps
        end if
      end if
    end repeat
  end repeat
  put item 2 of last line of variablezxc into item 2 of last line of
Vsteps
  put Vsteps & cr & cr & variablezxc

end bezier





More information about the metacard mailing list