Advertisement

Creation of Quad-Patch

Started by July 19, 2000 02:00 PM
-1 comments, last by LowRad 24 years, 5 months ago
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

This topic is closed to new replies.

Advertisement