- //line1 = v1 to v2
- //line2 = v3 to v4
- function CollLineLine(v1,v2, v3,v4:TVec2):Boolean;
- var vN:TVec2;
- fDot1,fDot2,fDot3,fDot4:Single;
- begin
- vN:=Vec2Orth(v1-v2);
- fDot1:=vN*(v1-v3);
- fDot2:=vN*(v1-v4);
- vN:=Vec2Orth(v3-v4);
- fDot3:=vN*(v3-v1);
- fDot4:=vN*(v3-v2);
- if( (((fDot1<0) and (fDot2>0)) or ((fDot1>0) and (fDot2<0))) or
- (((fDot3<0) and (fDot4>0)) or ((fDot3>0) and (fDot4<0)))) then
- result:=true
- else
- result:=false;
- end;