List Info

Thread: Bezier / Vector Shape




Bezier / Vector Shape
user name
2006-11-28 01:54:50
Hello,

I have a lot of vector shape members (not closed)
I would like to create a function like this:

pointList = loadPoints(vectorShapeMemberName)

So I can have in pointList the list of points of the vector
shape.
That will allow me to move a little car over the curves
smoothly
backwards and forward. 

Would some one please give me some help? I tried all. I used
an example from director online but's not working.

Any help will be much appreciated,

Thanks
Min




 
____________________________________________________________
________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbu
siness.yahoo.com/r-index
_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
Bezier / Vector Shape
user name
2006-11-28 09:04:29
Hi
I'm not sure what you are looking for but maybe you try:

member("myvectorshape").vertexlist


Greetz

Joerg

Minyer Jolibem schrieb:
> Hello,
>
> I have a lot of vector shape members (not closed)
> I would like to create a function like this:
>
> pointList = loadPoints(vectorShapeMemberName)
>
> So I can have in pointList the list of points of the
vector shape.
> That will allow me to move a little car over the curves
smoothly
> backwards and forward. 
>
> Would some one please give me some help? I tried all. I
used
> an example from director online but's not working.
>
> Any help will be much appreciated,
>
> Thanks
> Min
>
>
>
>
>  
>
____________________________________________________________
________________________
> Want to start your own business?
> Learn how on Yahoo! Small Business.
> http://smallbu
siness.yahoo.com/r-index
> _______________________________________________
> dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
> http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
>
>   

_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
Bezier / Vector Shape
user name
2006-11-28 12:44:47
Minyer Jolibem wrote:
> Hello,
>
> I have a lot of vector shape members (not closed)
> I would like to create a function like this:
>
> pointList = loadPoints(vectorShapeMemberName)
>
> So I can have in pointList the list of points of the
vector shape.
> That will allow me to move a little car over the curves
smoothly
> backwards and forward. 
>
> Would some one please give me some help? I tried all. I
used
> an example from director online but's not working.
>
> Any help will be much appreciated,
>
> Thanks
> Min
>
>   
Hello Min,

the following is a global moviescript-function, by adjusting
a_iSteps 
you can control how many points are drawn in between
vertexpoints, i.e. 
how smooth the resulting bezier-curve is:

-- vectorShapePoints("vectorshape", 12, true)
on vectorShapePoints(a_sMemName, a_iSteps, a_bClosed)

 t_ar_VertexList = member(a_sMemName).vertexList

 if(a_bClosed) then
   t_ar_VertexList.append(t_ar_VertexList[1])
 end if

 t_ar_polygon = []
 repeat with i = 1 to t_ar_VertexList.count - 1
   repeat with j = 1 to a_iSteps
     p1 = t_ar_VertexList[i][#vertex]
     p2 = t_ar_VertexList[i][#vertex]   +
t_ar_VertexList[i][#handle1]
     p3 = t_ar_VertexList[i+1][#vertex] +
t_ar_VertexList[i+1][#handle2]
     p4 = t_ar_VertexList[i+1][#vertex]
     t = (j/(a_iSteps *1.0))
     t_rP = interpolateCubicBezier( t, p1, p2, p3, p4 )
     t_ar_polygon.append(t_rP)
   end repeat     end repeat

 -- Draw
 repeat with i = 1 to t_ar_polygon.count - 1
   p1 = t_ar_polygon[i]
   p2 = t_ar_polygon[i+1]
   _movie.stage.image.draw(p1, p2, [#shapeType:#line,
#lineSize:1, 
#color: rgb(0, 0, 0)])
 end repeat    updatestage

end

on interpolateCubicBezier( t, p1, p2, p3, p4 )
 u=1.0-t
 v=3.0*u*t
 return u*u*u*p1+u*v*p2+v*t*p3+t*t*t*p4
end

Best,
Wille
_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )