Jump to content
  • Advertisement
Sign in to follow this  
Preacher

Mapping Data to graphical forms

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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:


00010000
00111000
01111100
11111110
01111111
00111110
00011100
00001000


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

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!