Illustrator vector path to jit.gl.sketch OpenGL messages

bart at max (previously BITter)'s icon

Hi,

I have searched for days a big part of the www but find nothing good enough to accomplish what i want to do.

And it is so simple what i want to get:
- i have maked in illustrator vector shapes with simple paths
- i can export them in illustrator to .dwg and .dxf formats
- this i can then convert to the .obj format and use with jit.gl.model but this i do not want!

- i want to take out the .ai file, .dwg file or the .dxf file a list of coordinates that i can use with jit.gl.sketch

To create the same illustrator vector shapes but then in OpenGL 3D with jit.gl.sketch.

Anybody how can give: tips? solutions? free converters? ideas?

All will be honourable accepted :), thanks

Grzz, Bart

jasch's icon

hi bart,

save your file in the old EPS Illustrator 3 format and parse out the
postscript.
everything after %%EndSetup should be your vertices with "tag"

the origin of the coordinate-system is the lower left corner

m is the beginning (think moveto)
L/l is a straight line (lineto)
c/C is a bezier curve (stroke)

this is the glyph b

5.25586 52.1191 m
11.5923 52.1191 L
11.5923 30.3027 L
11.7358 30.3027 L
13.9683 34.1914 18 36.6387 23.6162 36.6387 c
32.2563 36.6387 38.3042 29.4395 38.3042 18.9268 c
38.3042 6.39844 30.3843 0.207031 22.6084 0.207031 c
17.5684 0.207031 13.6079 2.15039 10.9438 6.75879 c
10.8003 6.75879 L
10.4399 0.998047 L
4.96826 0.998047 L
5.18408 3.375 5.25586 6.90234 5.25586 9.99805 C
5.25586 52.1191 l

i have as bunch of old pre-jitter patches lying around, but you're
better of starting from scratch on this one...

hth

/*j

bart at max (previously BITter)'s icon

Hi, Jasch,

Thanks for this great solution! I am already busy with converting. This will take a lot of time. :( Is there somebody how knows a converter or parser?

Do you know also what k/K and V means?

I have find k/K right after %%EndSetup in:

u
u
u
*u
1 D
0 O
0.698039 0.67451 0.639216 0.741176 k
0 R
0.698039 0.67451 0.639216 0.741176 K
0 J 0 j 1 w 4 M []0 d

and V is sometimes in the "vertices" list beside the c/C's and l/L's like for example:

910.106 2116.75 L
911.7573 2117.3872 912.6172 2117.7178 V
912.7603 2116.876 912.833 2116.0039 912.833 2115.1108 c

Grzz, Bart

bart at max (previously BITter)'s icon

This is a follow up from my reply above.

c/C is a bezier curve (stroke)

Message "stroke" to jit.gl.sketch does nothing: no errors but also nothing is drawn.
I have tried with "linesegment" but this gives like expected weird results.

Is there an equivalent for "stroke" that works with jit.gl.sketch?

Grzz, Bart

jasch's icon

hmm, these codes are all shorthand codes for postscript commands:
they're re-defined in the dictionary in the header of the file.
here are a few extracted ones, i just had Textwrangler insert
linebreaks before each 'def' keyword. that way the header becomes a
least minimally readable. but to really understand them you'd have to
learn postscript.
(hmm, mail just added some more formatting to make it more interesting)

cheers

/*j

find the test file here http://www.jasch.ch/dl/test.eps

//////////////////////////////////////////////

def
/pl
{
transform
0.25 sub round 0.25 add exch
0.25 sub round 0.25 add exch
itransform
}
def
/setstrokeadjust where
    {
    pop true setstrokeadjust
    /c
    {
    curveto
}
def
    /C
    /c load
def
    /v
    {
    currentpoint 6 2 roll curveto
    }
def
    /V
    /v load
def
    /y
    {
    2 copy curveto
    }
def
    /Y
    /y load
def
    /l
    {
    lineto
    }
def
    /L
    /l load
def
    /m
    {
    moveto
    }
def
    }
    {
    /c
    {
    pl curveto
    }
def
    /C
    /c load
def
    /v
    {
    currentpoint 6 2 roll pl curveto
    }
def
    /V
    /v load
def
    /y
    {
    pl 2 copy curveto
    }
def
    /Y
    /y load
def
    /l
    {
    pl lineto
    }
def
    /L
    /l load
def
    /m
    {
    pl moveto
    }
def
    } ifelse
/d
{
setdash
}
def
/cf    {}
def
/i
{
dup 0 eq
    {
    pop cf
    } if
setflat
}
def
/j
{
setlinejoin
}
def
/J
{
setlinecap
}
def
/M
{
setmiterlimit
}
def
/w
{
setlinewidth
}
def
/H
{}
def
/h
{
closepath
}
def
/N
{
_pola 0 eq
    {
    _doClip 1 eq {clip /_doClip 0 d

jasch's icon

look at andrew's recipe # 17 TwineBall to see how it's done with
jt.gl.sketch

/*j

bart at max (previously BITter)'s icon

Hi,Jasch

Thanks, it works now!
Your explanations of:
" m is the beginning (think moveto)
L/l is a straight line (lineto)
c/C is a bezier curve (stroke) " ---> strokepoint

and the " recipe # 17 TwineBall " from Andrew is after tweaking and try and error doing the job that i want.

I will send my little patch to convert the illustrator files to a strokepoint list when it works properly.

Regards, Bart

yair reshef's icon

please do

On 8/23/07, bart wrote:
>
>
> Hi,Jasch
>
> Thanks, it works now!
> Your explanations of:
> " m is the beginning (think moveto)
> L/l is a straight line (lineto)
> c/C is a bezier curve (stroke) " ---> strokepoint
>
> and the " recipe # 17 TwineBall " from Andrew is after tweaking and try
> and error doing the job that i want.
>
> I will send my little patch to convert the illustrator files to a
> strokepoint list when it works properly.
>
>
> Regards, Bart
>

bart at max (previously BITter)'s icon

Ok! I will send it when properly working. At least i hope that it will work properly at some time. :)

Karl Kliem's icon

did you finish the patch?

k

bart at max (previously BITter)'s icon

Because of to many problems with reading in the illustrator files i haven't worked on it anymore.
But because of interest i will retry when i have free time again, that is to say end of september. :(

Rio's icon

I did some similar experiments on chinese calligraphy. While I
successfully build the outline of a character in Jitter, I don't know
how to fill the color inside a closed stroke.

As jasch kindly replied me

> that's a tough nut to crack. the difference between a stroked path
> and a filled one in OpenGL is tesselation.
> http://www.songho.ca/opengl/gl_tessellation.html
>
> i don't know that Jitter would do this automatically for you.
>
> you might want to look at the matrix-output of jit.gl.text3d as an
> alternate way of obtaining vertices from fonts.
>
> i'm sorry i can't be more helpful.

hope you guys can figure out some solution.

Rio