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