Deluanay Triangulation shaders?

Hey Sonic,

If you are talking about ‘low-poly’ effect as the phrase is generally used, I don’t think sprites will have much of a use for it. 

But you never know. :wink:

What i was thinking was starting off with one triangle ( Triangle has three points ) and the next triangle that’s spawned can “remember” two points from the first triangle and use that and randomize a third point and then it draws itself and then the third one and so on do the same thing. How does that sound?

Here’s an example in squares that @Alex@Panc wrote for me last year. We could start off in this direction. All you would need to do it get the math correct and your set.

local row = 35 local column = 20 local cellWidth = 15 local cellHeight = cellWidth local centerX = display.contentCenterX-cellWidth\*column/2-cellWidth/2 local centerY = display.contentCenterY-cellHeight\*row/2 -cellHeight/2 local cell = {} local function handleTile(self, event) if event.phase == "ended" then self:setFillColor(0,.5,.25) return true end end local function createGrid() for x = 1, row do cell[x] = {} for y = 1, column do cell[x][y] = display.newRect( x\*cellWidth, y\*cellHeight, cellWidth, cellHeight ) cell[x][y].strokeWidth = 0.6 cell[x][y]:setStrokeColor(1) cell[x][y]:setFillColor(0) cell[x][y].x = y \* cellWidth + centerX cell[x][y].y = x \* cellHeight + centerY cell[x][y].touch = handleTile cell[x][y]:addEventListener("touch", cell[x][y]) end end end createGrid()

–SonicX278 

@Alex@Panc any comments on this?

–SonicX278 

Just a note. Ill be out of town till Monday sadly. Ill get started right back when i get back!

–SonicX278 

@ SonicX278

That sort of technique wouldn’t have the characteristics of a Delaunay triangulation (which tends to enforce certain overall angle constraints, e.g. to eliminate slivers), but that seems to have been an example rather than a requirement, anyhow.

What you describe is something along the lines of a random walk.

This is fine (and touches on other useful applications as well), but you will need to be ready to deal with the new triangles penetrating old ones and be able to respond in some intelligent way, e.g. by rejecting your original candidate in that case and using the smaller one that would bridge the gap (which gets hairier if there’s no common vertex). To play on your earlier personification, this would also suggest your triangles should “forget” their sides, so that you could establish whether such a connection was even still viable.

That code will need some adjustments. The connectivity wouldn’t be like a rectangular grid, although triangles can still tile the plane. This is a good overview.

(I’ve been preparing some geometry articles for what feels like ages now, and though they probably still won’t land for a good while, I do go into a lot of this math. If and when the time comes I could supply code or excerpts.)

Alright! Thanks for the input! Hopefully i can start soon!

–SonicX278 

Yeah what StarCrunch said.If I understand correctly the definition of a Delunay Triangulation guarantees ( or rather requires) that the circumcirle of one of the triangles wholly inscribe that and that traingle only. With random walk that principle may be violated. And when that happens, there isn’t any ‘rhythm’.  

P.S : Please forgive me if I am wrong, only recently I started looking into the complex math of this topic after realizing I have a use for this. 

Did anyone have any update on this?

Thanks. 

I was playing around with a piece of code I have but I haven’t had time to keep working on it.

I have the shapes spawning randomly.

@ farjadfarabi_czs

While looking for some material for somebody else, I actually ran across a write-up on rakoonic’s effect, along with some Voronoi-related material. (And then forgot to post it.  :P) See in particular the various articles under Procedural Content here.

I’m not sure this will actually get you anywhere, but you seem to show an interest in this stuff anyhow.  :slight_smile:

Wow, One of the voronoise samples is basically Corona’s Crystallize filter. You were right about crystallize using voronoi. :smiley:

Actually, instead of triangles, squares (like on the link) are also interesting alternative.