...

View Full Version : Working with polygons



Akora
09-25-2011, 01:45 PM
Hello
Can JavaScript work with polygons image witch was created in Photoshop?
I mean capture polygons coordinates and make these polygons interactive?

I have a very simple task to be done - draw a map with thousands of polygons, each polygon must have its properties and be interactive. And there will be circle-shape objects that user can move through the polygons on a distance for instance two-three polygons in a round. And these circle objects must also have their properties.

So I decided to draw polygon-map in Photoshop and do the rest in JavaScript. But I have doubts - can JavaScript "see" these polygons and operate with them or Photoshop-made image is not good for this.
Any advice on this matter?

Philip M
09-25-2011, 04:11 PM
I don't think that Photoshop and Javascript can interact in the way you want.

Akora
09-25-2011, 07:55 PM
Thank you Philip, I understand Photophop is not what I need.
Any suggestions what to use drawing my map so JavaScript \or anything\ could work with polygons in it?

morongo47
09-25-2011, 08:42 PM
.
You might have a look at some javascript vector libs. Graphics would be parametric, so you could use datasets to define objects/maps.

One example:
http://raphaeljs.com/

Akora
09-25-2011, 08:58 PM
.
You might have a look at some javascript vector libs. Graphics would be parametric, so you could use datasets to define objects/maps.

One example:
http://raphaeljs.com/

Thank you, I will dig in this direction.

morongo47
09-25-2011, 09:24 PM
Another way you might be able to do what you describe is with a game-engine, this is from gameQuery Docs:


collision(filter)
This method returns the list of elements collisioning with the selected one but only those that match with the filter given as parameter.

http://gamequery.onaluf.org/

So, if your circle intersected with the boundaries of several underlying objects, you get the list of objects returned and can use a callback to further process that return according to your game-logic (but of course, it doesn't have to be a game, you just use the functionality provided).

Have a look at this demo too:
http://www.java2s.com/Code/JavaScriptDemo/DynAPIExamplesDragDropwCollisionDetection.htm
.

vwphillips
09-26-2011, 09:16 AM
http://www.google.co.uk/search?q=image+map&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a

Akora
10-05-2011, 12:36 PM
Thank you guys, I think will do it in Adobe Illustrator. I found a way through image maping to grasp the coordinates of polygons.
Its just such a pity that graphic redactors doesn't have the option of showing coordinates of drawing and people like me must use image mapping plus special drawing technique to do such a simple task.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum