.


:




:

































 

 

 

 





- , -. . . 7, , , .

: = = .

a b . .

, , , , .

, , -, , .

 

. , , . . . , - x. , , , , . x , , :

 

, . , , . , :

 

 


, , .. 1, .

- . , -, , , . - , , , ( 8). :

, ,

, , :

.

:

,

, , .

. (5) . , , , . , , , . , , , . 9, , , , , , , , , , , . .

, . , , , . . , . .

. , , , . , . , , , , , . .

, (. 10). . , , . , : . . , , , , , , . . .


, 1991 , , . () . , . , . , ..

‑ .

 
 

- , . , , . .

2005 . . 1999 . , , , , , . , , ‑ . , .

 
 

. , . . , . , . . . .

, , ( ), :

.

- , , .

, , . 2005 . [8] . Delphi, .

14. .  

A, , . 14 . , , . , . 14 a, b c, X , .

 

, X , . A, B, C X - , , .

, .

, .14 a

, . , ,

,

Sign . , b , , ,

.

, , . , , 14 a, b c, , , , , ox, .

InTri, A =(AX,AY), B =(BX,BY), C =(CX,CY) X =(x,y). TRUE, (, , ), FALSE, . , .

function InTriI(x,y,AX,AY,BX,BY,CX,CY: Integer): boolean;

var

Res1,Res2: Integer;

begin

Res1:= (y-ay)*(cx-ax)-(x-ax)*(cy-ay);

Res2:= (y-cy)*(bx-cx)-(x-cx)*(by-cy);

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if Res1 XOR Res2 < 0 then

Result:= false //

else

begin

Res2:= (y-by)*(ax-bx)-(x-bx)*(ay-by);

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if Res1 XOR Res2 < 0 then

Result:= false

else

Result:= true;

end;

end;

 

, .

 

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if Res1 XOR Res2 < 0 then

 

, . , , , Res1 Res2. , , 1, . , XOR . , Delpi, XOR, 4 , . , Delphi, , . , Single Double. , . .

InTri Single.

 

function InTriS(x,y,AX,AY,BX,BY,CX,CY: Single): boolean;

var

Res1,Res2: Single;

ReI1: Integer absolute Res1;

ReI2: Integer absolute Res2;

begin

Res1:= (y-ay)*(cx-ax)-(x-ax)*(cy-ay);

Res2:= (y-cy)*(bx-cx)-(x-cx)*(by-cy);

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if ReI1 XOR ReI2 < 0 then

Result:= false //

else

begin

Res2:= (y-by)*(ax-bx)-(x-bx)*(ay-by);

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if ReI1 XOR ReI2 < 0 then

Result:= false

else

Result:= true;

end;

end;//function InTriS

 

InTri Double.

 

function InTriD(x,y,AX,AY,BX,BY,CX,CY: Double): boolean;

var

Res1,Res2: Double;

ReI1: Int64 absolute Res1;

ReI2: Int64 absolute Res2;

begin

Res1:= (y-ay)*(cx-ax)-(x-ax)*(cy-ay);

Res2:= (y-cy)*(bx-cx)-(x-cx)*(by-cy);

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if ReI1 XOR ReI2 < 0 then

Result:= false //

else

begin

Res2:= (y-by)*(ax-bx)-(x-bx)*(ay-by);

// if (Res1>0)and(Res2<0)or(Res1<0)and(Res2>0) then

if ReI1 XOR ReI2 < 0 then

Result:= false

else

Result:= true;

end;

end;//function InTriD

 

, , 6 15 , 4 10 .






:


: 2016-10-30; !; : 785 |


:

:

! . .
==> ...

1808 - | 1612 -


© 2015-2024 lektsii.org - -

: 0.059 .