ini rumus buatan gue, tapi mungkin ngga terlalu efisien ^ ^
function getRadius(x1,y1,x2,y2:extended):integer;
var x,y:extended;
begin
x:=sqr(x2-x1);
y:=sqr(y2-y1);
getRadius:=round(sqrt(x+y));
end;
// taruh ini waktu onMouseUp atao Down
a:=getRadius(x,y,d.sx,d.sy);
b:=getRadius(x,y,d.ex,d.ey);
c:=getRadius(d.sx,d.sy,d.ex,d.ey);
if c<>0 then begin
cx:=(sqr(a)-sqr(b)+sqr(c))/(2*c);
rd :=round(sqrt(sqr(a)-sqr(cx)));
end;
// x,y adalah posisi mouse
// d.sx,d.sy adalah start point dari line
// d.ex.d.ey adalah end point dari line
// rd adalah jarak posisi mouse terhadap sebuah garis
untuk menggunakan rd caranya adalah
if (rd>=-5) and (rd<=5) then showmessage('gotcha!!'); // (-5 dan 5) berarti
sensitivitasnya adalah dari -5 sampe 5 pixels.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/xGHJAA/i7folB/TM
---------------------------------------------------------------------~->
Berlangganan: [EMAIL PROTECTED]
Stop Berlangganan: [EMAIL PROTECTED]
Keluhan Milis(Unbouncing,spam,dll): [EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/