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 Nullium
(Posted 18 years ago)
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

Nullium
(Posted 18 years ago)
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

BlitzSupport
(Posted 18 years ago)
Do you know you can edit your original code? Just hit the 'Edit' button at the top-right of the code box.

Nullium
(Posted 18 years ago)
Ahh, thank you James!

Code Archives Forum