Creating an area out of points then filling it with sprites.

Started by
3 comments, last by SweetToothKane 17 years, 6 months ago
I have no code yet but am looking more for help on implementation than anything. Basically, imagine you can place 4 points to make a square and then you want to fill that (evenly or randomly) with sprites. Given the array of points how would you go about filling it with those sprites? This needs to work with other shapes too.
Advertisement
By "filling an area with sprites", do you mean you want to fill an area with a certain repeating pattern? If so, that's done using texturing usually, by drawing several polygons and texturing them with a repeating pattern.

If you could clarify, or maybe even show an image of something similar to what you want to acheive, we might be able to be more helpful.

Hope this helps.
Sirob Yes.» - status: Work-O-Rama.
Here you go, my awesome Photoshop skills. The red dots are the points, the lines being the border. This is best I could quickly do it and show what I am trying to do. Basically, place many quads in the defined area, but it doesn't have to be in a specific pattern.

http://img230.imageshack.us/img230/8379/testcg3.jpg
I think what you are trying to do is randomly place point sprites inside the convex hull formed by your red points. You can do this by using barycentric coordinates for arbitrary polygons (aka generalized barycentric coordinates). Then all you would need to do is generate some random numbers between 0 and 1 and the forementioned method would give you a 3D point to place your sprite at by taking a linear combination of the red dots.
thanks, I will look into it and see what I come up with.

This topic is closed to new replies.

Advertisement