PDA

View Full Version : Graphics algorithm - interesting puzzle


KillerShots
July 28th, 2002, 18:48
Ok, I'm doing some research into how to divide a polygon into many other polygons during real-time, and I'm running into a little logical puzzle - How to go from a triangle into a bunch of triangles(the plane must remain the same) due to a "slit" being "cut" into it in a random spot (and yes, the slit can go beyond the outer border of the triangle, but let's take this case for now). So, here's a pic to demonstrate what I'm trying to do (I know, crappy low quality, so what :) ).

The end result here is that I'm trying to figure out a way to do run-time polygon carving so a 3D engine that I've written up to this point doesn't have to draw 2D bullet holes, but can morph the geometry appropriately. Any ideas or help would be greatly appreciated :)

ammoQ
July 29th, 2002, 10:15
I think itīs not that difficult. First, make the triangles from P4 to P1,P2 and P3.
This will divide (P1,P2,P3) into 3 triangles: (P1,P2,P4), (P1,P3,P4) and (P2,P3,P4). P5 will be in one of these 3 smaller triangles; make the connections to the other 2 Points; e.g. if P5 is in (P1,P2,P4), connect P5 with P1 and P2. In your example, the result would be different from your result but equaly valid. A special case would be if P5 is one a border, but I think you can handle this yourself.