24 aref_tran.pass(
new absref_transmit(2,
aref));
28 pvecerror(
"straight::straight(const plane pl1, const plane pl2)");
29 *
this = pl1.
cross(pl2);
32 pvecerror(
"int operator==(const straight &sl1, const straight &sl2)");
34 if (!(sl1.
dir == sl2.
dir || sl1.
dir == -sl2.
dir))
return 0;
35 if (sl1.
piv == sl2.
piv)
return 1;
41 pvecerror(
"int apeq(const straight &sl1, const straight &sl2, vfloat "
43 int i = check_par(sl1.
dir, sl2.
dir, prec);
51 pvecerror(
"int straight::check_point_in(point fp, vfloat prec)");
53 if (f <= prec)
return 1;
57 pvecerror(
"point straight::cross(straight& sl, vfloat prec)");
62 if (type_of_cross == 2 || type_of_cross == 3) {
66 if (
fabs(f) <= prec) {
77 pvecerror(
"vfloat straight::distance(const straight& sl, int type_of_cross, "
87 if (check_par(s1.
dir, s2.
dir, 0.0) != 0)
95 if (check_par(s1.
dir, s2.
dir, 0.0) != 0)
120 pt[1] = pn.
cross(s2);
122 if (pt[1].v.y == 0) {
147 pvecerror(
"void straight::straight(straight* sl, int qsl,...");
158 mean2dist_prev = mean2dist;
161 for (n = 0; n < qsl; n++) {
162 dist[n] =
vecdistance(sl[n], type_of_cross, pt[n]);
163 mean2dist +=
pow(dist[n], 2);
168 if (mean2dist > 0) mean2dist =
sqrt(mean2dist);
169 sl_finish =
straight(ptf, qsl, anum);
177 }
while (mean2dist_prev < mean2dist ||
178 (mean2dist != 0 && mean2dist_prev - mean2dist > precision));
184 pvecerror(
"vfloat straight::distance(point& fpt)");
185 if (fpt ==
piv)
return 0.0;
190 pvecerror(
"vfloat straight::distance(point& fpt, point& fcpt)");
203 "vfloat straight::vecdistance(const vec normal, const straight& slt)");
204 if (check_perp(normal, slt.
Gdir(), 0.0) == 1)
206 mcout <<
"straight::vecdistance: normal=" << normal
207 <<
" slt.Gdir()=" << slt.
Gdir();
209 return point(0, 0, 0);
211 basis bash(
dir, normal,
"temprorary");
216 return pn.
cross(slh);
221 pvecerror(
"straight::straight(const point* pt, int qpt, int anum) ");
229 double* x =
new double[qpt];
230 double* y =
new double[qpt];
231 double* z =
new double[qpt];
233 for (n = 0; n < qpt; n++) {
245 }
else if (anum == 1) {
259 dir = unit_vec(piv1 -
piv);
267 pvecerror(
"straight::straight(const straight sl[4], point pt[2], vfloat "
279 for (i = 0; i < 2; i++) {
292 plane pn(sl[is], ptcurr[ip]);
293 ptcurr[i] = pn.
cross(sl[isc]);
294 meandist += length2(ptcurr[i] - ptprev[i]);
295 mcout <<
" i=" << i <<
" ptprev[i]=" << ptprev[i]
296 <<
" ptcurr[i]=" << ptcurr[i] <<
'\n';
297 ptprev[i] = ptcurr[i];
300 meandist =
sqrt(meandist);
301 mcout <<
"meandist=" << meandist <<
'\n';
302 }
while (meandist >= precision);
303 *
this =
straight(ptcurr[0], ptcurr[1]);
307 Ifile <<
"straight (line):\n";
DoubleAc pow(const DoubleAc &f, double p)
DoubleAc sqrt(const DoubleAc &f)
DoubleAc fabs(const DoubleAc &f)
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
#define check_econd11(a, signb, stream)
point cross(const straight &sl) const
point cross(const straight &sl, vfloat prec) const
vfloat vecdistance(const straight &sl, int &type_of_cross, point pt[2]) const
vfloat distance(const straight &sl, int &type_of_cross, point pt[2]) const
int check_point_in(const point &fp, vfloat prec) const
static absrefabsref::*[2] aref
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
virtual void up(const abssyscoor *fasc)
virtual void down(const abssyscoor *fasc)
int apeq(const circumf &f1, const circumf &f2, vfloat prec)
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
int operator==(const circumf &f1, const circumf &f2)
vfloat cos2vec(const vec &r1, const vec &r2)
vfloat sin2vec(const vec &r1, const vec &r2)
#define pvecerror(string)