|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Guessimation of Areas by Monte Carlo Method problem
Any "monte carlo" method uses a random algorithm. In your case you need a way to generate random two dimensional points in some rectangular area of the plane that contains your triangle. AND, you need a way to test if a point is inside your triangle or not. You sit in a loop generating random points and testing them. You count each point and you count the ones that are inside the triangle. Over time the ratio of those inside the triangle to the total will be a good approximation of the ratio of the area of the triangle to the area of the rectangle. If the rectangle has an area of 100 and you test 1000 points and find that 127 of them are in the triangle then you know that the area of the triangle is 12.7. This seems pretty silly when applied to a triangle... But, in real life there are problems where it is easier to construct the test than to compute the result directly. There are applications of monte carlo algorithms to game programming. Just think about rolling dice to decide whether an arrow "hit" a player or not. Bob P. Mohammed 'DreaMWeaver' KARGAS wrote: > > Hi everyone > > Ive been set a task to program by my computer science teacher to calculate the area of a triangle by guessimation using the monte carlo method. > > Problem is, I dont know what this is or how to do it!! Could you please explain it to me? Id be really grateful! > ______________________________________________ > FREE Personalized Email at Mail.com > Sign up at http://www.mail.com/?sr=signup > > ================================================================= > The GameProgrammer.Com mailing list is for the open discussion > of any topic related to the art, science, and business of > programming games. This list is especially tolerant of beginners. > We were all beginners once > > To SUBSCRIBE or UNSUBSCRIBE please visit: > http://gameprogrammer.com/mailinglist.html ================================================================= The GameProgrammer.Com mailing list is for the open discussion of any topic related to the art, science, and business of programming games. This list is especially tolerant of beginners. We were all beginners once To SUBSCRIBE or UNSUBSCRIBE please visit: http://gameprogrammer.com/mailinglist.html
|
|