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(
"bool apeq(const straight &sl1, const straight &sl2, vfloat prec)");
42 if (check_par(sl1.
dir, sl2.
dir, prec) == 0)
return false;
48 pvecerror(
"int straight::check_point_in(point fp, vfloat prec)");
50 if (f <= prec)
return 1;
54 pvecerror(
"point straight::cross(straight& sl, vfloat prec)");
59 if (type_of_cross == 2 || type_of_cross == 3) {
63 if (
fabs(f) <= prec) {
75 "vfloat straight::vecdistance(const straight& sl, int& type_of_cross, "
85 if (check_par(s1.
dir, s2.
dir, 0.0) != 0) {
93 if (check_par(s1.
dir, s2.
dir, 0.0) != 0) {
119 pt[1] = pn.
cross(s2);
121 if (pt[1].v.y == 0) {
144 pvecerror(
"void straight::straight(straight* sl, int qsl,...");
148 mean2dist = max_vfloat;
149 vfloat mean2dist_prev = max_vfloat;
155 mean2dist_prev = mean2dist;
158 for (n = 0; n < qsl; n++) {
159 dist[n] =
vecdistance(sl[n], type_of_cross, pt[n]);
160 mean2dist +=
pow(dist[n], 2);
165 if (mean2dist > 0) mean2dist =
sqrt(mean2dist);
166 sl_finish =
straight(ptf, qsl, anum);
174 }
while (mean2dist_prev < mean2dist ||
175 (mean2dist != 0 && mean2dist_prev - mean2dist > precision));
180 pvecerror(
"vfloat straight::distance(point& fpt)");
181 if (fpt ==
piv)
return 0.0;
187 pvecerror(
"vfloat straight::distance(point& fpt, point& fcpt)");
200 "vfloat straight::vecdistance(const vec normal, const straight& slt)");
201 if (check_perp(normal, slt.
Gdir(), 0.0) == 1) {
203 mcout <<
"straight::vecdistance: normal=" << normal
204 <<
" slt.Gdir()=" << slt.
Gdir();
206 return point(0, 0, 0);
208 basis bash(
dir, normal,
"temprorary");
213 return pn.
cross(slh);
218 pvecerror(
"straight::straight(const point* pt, int qpt, int anum) ");
226 double* x =
new double[qpt];
227 double* y =
new double[qpt];
228 double* z =
new double[qpt];
229 for (
int n = 0; n < qpt; n++) {
241 }
else if (anum == 1) {
255 dir = unit_vec(piv1 -
piv);
264 "straight::straight(const straight sl[4], point pt[2], vfloat prec");
275 for (i = 0; i < 2; i++) {
288 plane pn(sl[is], ptcurr[ip]);
289 ptcurr[i] = pn.
cross(sl[isc]);
290 meandist += (ptcurr[i] - ptprev[i]).length2();
291 mcout <<
" i=" << i <<
" ptprev[i]=" << ptprev[i]
292 <<
" ptcurr[i]=" << ptcurr[i] <<
'\n';
293 ptprev[i] = ptcurr[i];
296 meandist =
sqrt(meandist);
297 mcout <<
"meandist=" << meandist <<
'\n';
298 }
while (meandist >= precision);
299 *
this =
straight(ptcurr[0], ptcurr[1]);
303 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.
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
Shortest distance between two lines, may be negative.
vfloat distance(const straight &sl, int &type_of_cross, point pt[2]) const
int check_point_in(const point &fp, vfloat prec) const
virtual absref_transmit get_components() override
vec dir
Direction, unit vector.
static absref absref::* aref[2]
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)