Archived

This topic is now archived and is closed to further replies.

LowRad

Creation of Quad-Patch

Recommended Posts

LowRad    234
Hi all, I want to create an algorithm to create QuadPath for my Landscape Demo. I want to write a function, that it''s will be able to split a patch in 4 smaller patch. For the moment, i just try to write a small test programm that''s supposse to draw patch on my screen in 2d, But it''s really weird it''s dont work. Here is this function.
    
void CreatePatch (int x1, int y1, int x2, int y2)
{
   if (countpatch > MAXPATCH) return;
   countpatch++;
   col++;

   // Draw the patch

   DrawRectangle (x1, y1, x2, y2, color);

   // Split it into 4 new patch

   int mid_x = (x2 - x1) / 2;
   int mid_y = (y2 - y1) / 2;
   
   CreatePatch (mid_x, y1, x2, mid_y);
   CreatePatch (mid_x, mid_y, x2, y2);
   CreatePatch (x1, y1, mid_x, mid_y);
   CreatePatch (x1, mid_y, mid_x, y2);

   countpatch--;
}
    
That''s doesn''t work and i dont see why, so if someone can find something work with it. PLz, tell me. I think this leak too !! Thanks, LowRad

Share this post


Link to post
Share on other sites