Code archives/Algorithms/Point In Oval

This code has been declared by its author to be Public Domain code.

Download source code

Point In Oval by UnderwoodNullium2008
the 'ox# and oy#' is middle of the oval... :P
Function PointInOval:Int(px#,py#,ox#,oy#,width#,height#)

	Return((px - ox)^2 / width^2 + (py - oy)^2 / height^2 < 1)

End Function

Comments

UnderwoodNullium2008
A wee bit faster...

Function PointInOval:Int(px#,py#,ox#,oy#,width#,height#)

Return(((px - ox)*(px - ox)) / (width*width) + ((py - oy)*(py - oy)) / (height*height) < 1)

End Function


BlitzSupport2008
Do you know you can edit your original code? Just hit the 'Edit' button at the top-right of the code box.


UnderwoodNullium2009
Ahh, thank you James!


Code Archives Forum