- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
if(typeid(*Line1)==typeid(TLine)) ; else
if(typeid(*Line2)==typeid(TLine)) {cLine=Line1; Line1=Line2; Line2=cLine;} else
if(typeid(*Line1)==typeid(TRay)) ; else
if(typeid(*Line2)==typeid(TRay)) {cLine=Line1; Line1=Line2; Line2=cLine;} else
if(typeid(*Line1)==typeid(TLineSegment)) ; else
if(typeid(*Line2)==typeid(TLineSegment)) {cLine=Line1; Line1=Line2; Line2=cLine;}
if(typeid(*Line1)==typeid(TLine)) {
if(typeid(*Line2)==typeid(TLine)) return 1; else
if(typeid(*Line2)==typeid(TRay)) {
if(
(( ((TRay*)Line2)->X1<=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1<=Point.x ) ||
( ((TRay*)Line2)->X1>=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1>=Point.x )) &&
(( ((TRay*)Line2)->Y1<=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1<=Point.y ) ||
( ((TRay*)Line2)->Y1>=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1>=Point.y ))
)
return 1;
else
return -1;
} else
if(typeid(*Line2)==typeid(TLineSegment)) {
if(
(( ((TLineSegment*)Line2)->X1<=Point.x && Point.x<=((TLineSegment*)Line2)->X2 )||( ((TLineSegment*)Line2)->X2<=Point.x && Point.x<=((TLineSegment*)Line2)->X1 )) &&
(( ((TLineSegment*)Line2)->Y1<=Point.y && Point.y<=((TLineSegment*)Line2)->Y2 )||( ((TLineSegment*)Line2)->Y2<=Point.y && Point.y<=((TLineSegment*)Line2)->Y1 ))
)
return 1;
else
return -1;
}
} else
if(typeid(*Line1)==typeid(TRay)) {
if(typeid(*Line2)==typeid(TRay)) {
if(
((( ((TRay*)Line1)->X1<=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1<=Point.x ) ||
( ((TRay*)Line1)->X1>=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1>=Point.x )) &&
(( ((TRay*)Line1)->Y1<=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1<=Point.y ) ||
( ((TRay*)Line1)->Y1>=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1>=Point.y )))
&&
((( ((TRay*)Line2)->X1<=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1<=Point.x ) ||
( ((TRay*)Line2)->X1>=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1>=Point.x )) &&
(( ((TRay*)Line2)->Y1<=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1<=Point.y ) ||
( ((TRay*)Line2)->Y1>=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1>=Point.y )))
)
return 1;
else
return -1;
} else
if(typeid(*Line2)==typeid(TLineSegment)) {
if(
((( ((TRay*)Line1)->X1<=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1<=Point.x ) ||
( ((TRay*)Line1)->X1>=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1>=Point.x )) &&
(( ((TRay*)Line1)->Y1<=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1<=Point.y ) ||
( ((TRay*)Line1)->Y1>=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1>=Point.y )))
&&
((( ((TLineSegment*)Line2)->X1<=Point.x && Point.x<=((TLineSegment*)Line2)->X2 )||( ((TLineSegment*)Line2)->X2<=Point.x && Point.x<=((TLineSegment*)Line2)->X1 )) &&
(( ((TLineSegment*)Line2)->Y1<=Point.y && Point.y<=((TLineSegment*)Line2)->Y2 )||( ((TLineSegment*)Line2)->Y2<=Point.y && Point.y<=((TLineSegment*)Line2)->Y1 )))
)
return 1;
else
return -1;
}
return 1;
} else
if(typeid(*Line1)==typeid(TLineSegment)) {
if(
((( ((TLineSegment*)Line1)->X1<=Point.x && Point.x<=((TLineSegment*)Line1)->X2 )||( ((TLineSegment*)Line1)->X2<=Point.x && Point.x<=((TLineSegment*)Line1)->X1 )) &&
(( ((TLineSegment*)Line1)->Y1<=Point.y && Point.y<=((TLineSegment*)Line1)->Y2 )||( ((TLineSegment*)Line1)->Y2<=Point.y && Point.y<=((TLineSegment*)Line1)->Y1 )))
&&
((( ((TLineSegment*)Line2)->X1<=Point.x && Point.x<=((TLineSegment*)Line2)->X2 )||( ((TLineSegment*)Line2)->X2<=Point.x && Point.x<=((TLineSegment*)Line2)->X1 )) &&
(( ((TLineSegment*)Line2)->Y1<=Point.y && Point.y<=((TLineSegment*)Line2)->Y2 )||( ((TLineSegment*)Line2)->Y2<=Point.y && Point.y<=((TLineSegment*)Line2)->Y1 )))
)
return 1;
else
return -1;
}
Мистер Хэнки 17.09.2010 21:17 # +3
Govnoeb 18.09.2010 16:11 # 0
говнокод дельфийца, не знакомого с полиморфизмом(да и с ООП вообще). даже не смешно: за такое надо уволнять
Мистер Хэнки 18.09.2010 16:44 # +2
istem 18.09.2010 17:54 # 0
Govnoeb 18.09.2010 16:06 # 0
bugmenot 18.10.2010 09:18 # 0
а так неуклюже потому, что пациент прогуливал алгебру и не знает, что "линия" - прямая y=kx+b а остальное - частные случаи, ограниченные неравенствами
таким образом задачу может решить 10-летний ребенок
sanchousf 24.10.2010 17:35 # +1
Попробуй записать прямуй x+5=0 (вертикальная), в виде y=kx+b.
Получиш y=-(1/0)x-5/0
xXx_totalwar 24.10.2010 20:31 # 0
bFaInlN 25.08.2021 01:10 # 0
inseminator 25.08.2021 21:02 # 0