Posts: 359
Threads: 63
Joined: Jul 2010
Reputation:
0
wait 12 hours not 30 minutes before bumping your topics, and this isn't possible without very intense maths.
Posts: 367
Threads: 55
Joined: Oct 2011
Reputation:
0
No, I need function that random generate polygon in San Andreas. Then I make checking with IsPointInPolygon.
Posts: 1,047
Threads: 23
Joined: Jun 2009
pawn Код:
stock ReturnRandomPolygon3(&Float:Point1[2],&Float:Point2[2],&Float:Point[2])
{
Point1[0] = (random(6000)-3000.0);
Point1[1] = (random(6000)-3000.0);
Point2[0] = (random(6000)-3000.0);
Point2[1] = (random(6000)-3000.0);
Point3[0] = (random(6000)-3000.0);
Point3[1] = (random(6000)-3000.0);
}
stock ReturnRandomPolygon3ex(&Float:Point1[2],&Float:Point2[2],&Float:Point3[2])//other function
{
Point1[0] = (random(6000)-3000.0);
Point1[1] = (random(6000)-3000.0);
while(IsPointInPoligon(Point1[0],Point1[1],...yourPolygon...)
{
Point1[0] = (random(6000)-3000.0);
Point1[1] = (random(6000)-3000.0);
}
Point2[0] = (random(6000)-3000.0);
Point2[1] = (random(6000)-3000.0);
while(IsPointInPoligon(Point2[0],Point2[1],...yourPolygon...)
{
Point2[0] = (random(6000)-3000.0);
Point2[1] = (random(6000)-3000.0);
}
Point3[0] = (random(6000)-3000.0);
Point3[1] = (random(6000)-3000.0);
while(IsPointInPoligon(Point3[0],Point3[1],...yourPolygon...)
{
Point3[0] = (random(6000)-3000.0);
Point3[1] = (random(6000)-3000.0);
}
}
example use:
new Float:Points[3][2];
ReturnRandomPolygon3(Points[0],Points[1],Points[2]);
Edit the functions so they meet your requirements..
Posts: 367
Threads: 55
Joined: Oct 2011
Reputation:
0
Thank you very much! Hm, what do you mean ...yourPolygon...?
Posts: 1,047
Threads: 23
Joined: Jun 2009
Quote:
Originally Posted by zgintasz
Thank you very much! Hm, what do you mean ...yourPolygon...?
|
Just use the function ispointinpolygon correctly ;>
Posts: 367
Threads: 55
Joined: Oct 2011
Reputation:
0
Okay, thank you very much : ).