I'm getting the same results as Wims.

A simple way to demonstrate this bug is the following: //echo -a $inellipse(35,5,10,10,50,50) $inellipse(5,35,10,10,50,50)

Both points are outside of the circle. But the first one returns $false and the second one (erroneously) returns $true.


I'm not sure if you are using your own algorithm to check if a point is inside an ellipse or not, but just in case, a working formula for testing if a point is inside an ellipse that works with mIRC's input syntax is this:



If I replace $inellipse with $inellipse2 (as I've written below), everything works correctly:

Code:
; $inellipse2(x2,y2,x,y,w,h)
alias inellipse2 {
  if ($calc( (2 * ($1 - $3) / $5 - 1)^2 + (2 * ($2 - $4) / $6 - 1)^2 ) <= 1) { return $true }
  return $false
}


Using Wims's original script with $inellipse:


Using Wims's original script with $inellipse2:

Last edited by drum; 29/09/12 12:51 AM.