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 prec)");
42 int i = check_par(sl1.
dir, sl2.
dir, prec);
43 if (i == 0)
return false;
49 pvecerror(
"int straight::check_point_in(point fp, vfloat prec)");
51 if (f <= prec)
return 1;
55 pvecerror(
"point straight::cross(straight& sl, vfloat prec)");
60 if (type_of_cross == 2 || type_of_cross == 3) {
64 if (
fabs(f) <= prec) {
76 "vfloat straight::distance(const straight& sl, int type_of_cross, "
86 if (check_par(s1.
dir, s2.
dir, 0.0) != 0) {
94 if (check_par(s1.
dir, s2.
dir, 0.0) != 0) {
120 pt[1] = pn.
cross(s2);
122 if (pt[1].v.y == 0) {
145 pvecerror(
"void straight::straight(straight* sl, int qsl,...");
149 mean2dist = max_vfloat;
150 vfloat mean2dist_prev = max_vfloat;
156 mean2dist_prev = mean2dist;
159 for (n = 0; n < qsl; n++) {
160 dist[n] =
vecdistance(sl[n], type_of_cross, pt[n]);
161 mean2dist +=
pow(dist[n], 2);
166 if (mean2dist > 0) mean2dist =
sqrt(mean2dist);
167 sl_finish =
straight(ptf, qsl, anum);
175 }
while (mean2dist_prev < mean2dist ||
176 (mean2dist != 0 && mean2dist_prev - mean2dist > precision));
181 pvecerror(
"vfloat straight::distance(point& fpt)");
182 if (fpt ==
piv)
return 0.0;
188 pvecerror(
"vfloat straight::distance(point& fpt, point& fcpt)");
201 "vfloat straight::vecdistance(const vec normal, const straight& slt)");
202 if (check_perp(normal, slt.
Gdir(), 0.0) == 1) {
204 mcout <<
"straight::vecdistance: normal=" << normal
205 <<
" slt.Gdir()=" << slt.
Gdir();
207 return point(0, 0, 0);
209 basis bash(
dir, normal,
"temprorary");
214 return pn.
cross(slh);
219 pvecerror(
"straight::straight(const point* pt, int qpt, int anum) ");
227 double* x =
new double[qpt];
228 double* y =
new double[qpt];
229 double* z =
new double[qpt];
230 for (
int n = 0; n < qpt; n++) {
242 }
else if (anum == 1) {
256 dir = unit_vec(piv1 -
piv);
265 "straight::straight(const straight sl[4], point pt[2], vfloat prec");
276 for (i = 0; i < 2; i++) {
289 plane pn(sl[is], ptcurr[ip]);
290 ptcurr[i] = pn.
cross(sl[isc]);
291 meandist += (ptcurr[i] - ptprev[i]).length2();
292 mcout <<
" i=" << i <<
" ptprev[i]=" << ptprev[i]
293 <<
" ptcurr[i]=" << ptcurr[i] <<
'\n';
294 ptprev[i] = ptcurr[i];
297 meandist =
sqrt(meandist);
298 mcout <<
"meandist=" << meandist <<
'\n';
299 }
while (meandist >= precision);
300 *
this =
straight(ptcurr[0], ptcurr[1]);
304 Ifile <<
"straight (line):\n";
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
#define check_econd11(a, signb, stream)
virtual void up(const abssyscoor *fasc)
Convert numbering representation of objects to new system.
double line(const double x)
Plane, defined by defined by a point and a vector normal to the plane.
point cross(const straight &sl) const
void down(const abssyscoor *fasc) override
Convert numbering representation of object to basical system of fasc.
Definition of straight line, as combination of vector and point.
point cross(const straight &sl, vfloat prec) const
point piv
Origin point, pivot.
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 absref_transmit get_components() override
vec dir
Direction, unit vector.
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
DoubleAc pow(const DoubleAc &f, double p)
bool apeq(const circumf &f1, const circumf &f2, vfloat prec)
vfloat sin2vec(const vec &r1, const vec &r2)
int operator==(const circumf &f1, const circumf &f2)
vfloat cos2vec(const vec &r1, const vec &r2)
DoubleAc fabs(const DoubleAc &f)
DoubleAc sqrt(const DoubleAc &f)
#define pvecerror(string)