# Mapping Data to graphical forms

This topic is 4882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi im developing an ant colony simulation which requires a terrain composed of basic shapes where the ants can exist on. Ants communicate using chemicals layed on the ground and so i have to map data onto the shapes which is ok if the shape is rectangular, just use a two dim array. Im using two basic building blocks for the enviroment at present, rectangular planes to cover large areas and paths to connect these planes. if the paths are diagonal their shape will be a paralleogram What about if a shape is a parrallelogram? How do i map a 2d array of data onto the skewed rectangle? Thanks ;)

##### Share on other sites
There are two options.

1. Map as if the parallelogram was a masked object, as if you place a rectangle over the whole bounds of the object.
2. Rotate the map and store the angle of rotation.

Option 1 would require some sort of mask to establish the edges. I think there is a (silly) GDI function to Blit Parallelograms that uses a mask so that might give you an idea. The advantage is it can apply to other shapes, like stars or circles. You map might look like this:

0001000000111000011111001111111001111111001111100001110000001000

And you just ignore the zeroes because they're out of the shape.

Mark
Cornutopia Games
http://www.cornutopia.net

• 20
• 10
• 19
• 14
• 20