57 {
59 if (fts.s_range_cf == 0) {
60
61 point pt =
pn.
cross(straight(fts.currpos, fts.dir));
64 return 0;
65 }
66 vfloat rng = (pt - fts.currpos).length();
67 if (pt == fts.currpos || check_par(pt - fts.currpos, fts.dir, 0.01) == 1) {
68
69
70 if (fts.mrange >= rng) {
71
72 cpt[0] = pt;
73 crange[0] = rng;
75 if (t < 0)
76 s_ext[0] = 1;
77 else if (t > 0)
78 s_ext[0] = 0;
79 else
80 s_ext[0] = 2;
81 return 1;
82 }
83 return 0;
84 } else
85 return 0;
86 } else {
87 point pt[2];
88 circumf
cf(fts.currpos + fts.relcen,
89 fts.dir || fts.relcen,
90 fts.relcen.length());
91 int q =
cf.cross(
pn, pt, 0.0);
92 if (q == -1) {
93
94 cpt[0] = fts.currpos;
95 crange[0] = 0.0;
96 s_ext[0] = 2;
97 return 1;
98 }
99 if (q == 0) return 0;
100 if (q == 1) {
101 vec r1 = -fts.relcen;
102 vec r2 = pt[0] -
cf.Gpiv();
105 if (fts.mrange >= rng) {
106 cpt[0] = pt[0];
107 crange[0] = rng;
109 if (angle == 0.0) {
110
111 if (c > 0)
112 s_ext[0] = 0;
113 else if (c < 0)
114 s_ext[0] = 1;
115 else
116 s_ext[0] = 2;
117 } else {
118 if (c > 0)
119 s_ext[0] = 1;
120 else if (c < 0)
121 s_ext[0] = 0;
122 else
123 s_ext[0] = 2;
124 }
125 return 1;
126 } else
127 return 0;
128 }
129 if (q == 2) {
130 int qq = 0;
131 vec r = -fts.relcen;
132 vec vcr[2];
133 vcr[0] = pt[0] -
cf.Gpiv();
134 vcr[1] = pt[1] -
cf.Gpiv();
138 if (angle[0] > angle[1]) {
140 angle[0] = angle[1];
141 angle[1] = a;
142 point p = pt[0];
143 pt[0] = pt[1];
144 pt[1] = p;
145 }
147 rng =
cf.Grad() * angle[0];
148 if (fts.mrange >= rng) {
149
150 int ins = 0;
151 vec td = fts.dir;
152 td.turn(
cf.Gdir(), angle[0]);
154 if (t < 0)
155 ins = 1;
156 else
157 ins = 0;
158 cpt[0] = pt[0];
159 crange[0] = rng;
160 s_ext[0] = ins;
161 qq++;
162 rng =
cf.Grad() * angle[1];
163 if (fts.mrange >= rng) {
164 cpt[1] = pt[1];
165 crange[1] = rng;
166 s_ext[1] = (ins == 0 ? 1 : 0);
167 qq++;
168 }
169 }
170 return qq;
171 }
172 }
173 return 0;
174}
double cf[nMaxLevels][nEnergySteps]
vfloat ang2projvec(const vec &r1, const vec &r2, const vec &normal)