28#define pvecerror(string) \
30 if (vecerror != 0) { \
31 mcerr << "vecerror is not zero, program is terminated\n" \
32 << " function detected error is " << string << '\n'; \
35#define pvecerrorp(string) \
37 if (vecerror != 0) { \
38 mcerr << "vecerror is not zero, program is terminated\n" \
39 << " function detected error is " << string << '\n'; \
125 virtual void print(std::ostream& file,
int l)
const;
157#define ApplyAnyFunctionToVecElements(func) \
159 auto aref_tran = get_components(); \
160 int q = aref_tran.qaref; \
161 for (int n = 0; n < q; n++) (this->*(aref_tran.aref[n])).func; \
162 q = aref_tran.qaref_pointer; \
163 for (int n = 0; n < q; n++) aref_tran.aref_pointer[n]->func; \
164 q = aref_tran.qaref_other; \
165 for (int n = 0; n < q; n++) { \
166 absref* ar = aref_tran.get_other(n); \
203 void up(
const basis* fabas_new);
215 void shift(
const vec& dir)
override;
226 return vec(v.
x * p, v.
y * p, v.
z * p);
233 return vec(v.
x * p, v.
y * p, v.
z * p);
241 return vec(r1.
x + r2.
x, r1.
y + r2.
y, r1.
z + r2.
z);
248 return vec(r1.
x - r2.
x, r1.
y - r2.
y, r1.
z - r2.
z);
256 return r1.
x * r2.
x + r1.
y * r2.
y + r1.
z * r2.
z;
260 return vec(r1.
y * r2.
z - r1.
z * r2.
y, r1.
z * r2.
x - r1.
x * r2.
z,
261 r1.
x * r2.
y - r1.
y * r2.
x);
310#include "wcpplib/geometry/vec.ic"
337 basis(
const std::string& pname);
344 basis(
const vec& p,
const std::string& fname);
352 basis(
const vec& p,
const vec& c,
const std::string& pname);
355 basis(
const basis& pb,
const std::string& pname);
357 basis(
const vec& pex,
const vec& pey,
const vec& pez,
const std::string& pname);
361 virtual void print(std::ostream& file,
int l)
const;
364extern std::ostream&
operator<<(std::ostream& file,
const basis& b);
388 :
v(fex, fey, fez) {}
400 return p1.
v == p2.
v ? 1 : 0;
403 return p1.
v != p2.
v ? 1 : 0;
406 return apeq(p1.
v, p2.
v, prec);
410 virtual void print(std::ostream& file,
int l)
const;
413std::ostream&
operator<<(std::ostream& file,
const point& p);
421#define vec_syscoor_index 0
430 virtual void print(std::ostream& file,
int l)
const;
434extern std::ostream&
operator<<(std::ostream& file,
const abssyscoor& s);
449 const std::string& fname)
451 piv((fapiv != NULL) ? (*fapiv) :
point()),
452 bas((fabas != NULL) ? (*fabas) :
basis()) {}
457 void print(std::ostream& file,
int l)
const override;
absref_transmit & operator=(const absref_transmit &f)=default
Assignment operator.
int qaref_other
Number of objects available though virtual function GetOther.
absref_transmit(int fqaref, absref absref::**faref, int fqaref_pointer, absref **faref_pointer)
virtual void print(std::ostream &file, int l) const
absref_transmit(int fqaref_pointer, absref **faref_pointer)
virtual absref * get_other(int n)
int qaref
Number of vector objects which are the members of the class.
absref_transmit(int fqaref, absref absref::**faref)
virtual absref_transmit * copy() const
virtual ~absref_transmit()
Destructor.
absref_transmit(const absref_transmit &f)=default
Copy constructor.
absref_transmit()=default
virtual void up(const abssyscoor *fasc)
Convert numbering representation of objects to new system.
virtual void shift(const vec &dir)
virtual void down(const abssyscoor *fasc)
Convert numbering representation of object to basical system of fasc.
virtual ~absref()
Destructor.
virtual void turn(const vec &dir, vfloat angle)
Turn around axis doing via center of coordinate system along dir.
virtual void print(std::ostream &file, int l) const
virtual const point * Gapiv() const =0
abssyscoor(const std::string &fname)
virtual const basis * Gabas() const =0
virtual basis * copy() const
virtual absref_transmit get_components() override
basis switch_xyz() const
Change ex=ez; ey=ex; ez=ey.
friend std::ostream & operator<<(std::ostream &file, const basis &b)
static absref absref::* aref[3]
virtual void print(std::ostream &file, int l) const
const basis * Gabas() const override
void Ppiv(const point &fpiv)
static absref absref::* aref[2]
fixsyscoor * copy() const
absref_transmit get_components() override
void Pbas(const basis &fbas)
void print(std::ostream &file, int l) const override
fixsyscoor(const point &fpiv, const basis &fbas, const std::string &fname)
fixsyscoor(const point *const fapiv, const basis *const fabas, const std::string &fname)
fixsyscoor(const abssyscoor &f)
fixsyscoor(const std::string &fname)
const point * Gapiv() const override
void shift(const vec &dir) override
point()
Default constructor (coordinates are not initialised).
point operator+(const vec &fv) const
friend int operator!=(const point &p1, const point &p2)
friend bool apeq(const point &p1, const point &p2, vfloat prec)
point & operator=(const point &fp)
Assignment operator.
point(const vfloat fex, const vfloat fey, const vfloat fez)
Constructor from coordinates.
void up(const abssyscoor *fasc) override
Convert numbering representation of objects to new system.
vec operator-(const point &pp) const
void down(const abssyscoor *fasc) override
Convert numbering representation of object to basical system of fasc.
friend int operator==(const point &p1, const point &p2)
point(const point &p)
Copy constructor.
point(const vec &fv)
Constructor from vector.
virtual point * copy() const
friend std::ostream & operator<<(std::ostream &file, const point &p)
virtual void print(std::ostream &file, int l) const
void turn(const vec &dir, vfloat angle) override
Turn this vector.
vec up_new(const basis *fabas_new)
void shift(const vec &dir) override
friend vec operator*(const vec &v, vfloat p)
friend int check_perp(const vec &r1, const vec &r2, vfloat prec)
friend vec operator+(const vec &r1, const vec &r2)
friend vfloat ang2vec(const vec &r1, const vec &r2)
vec turn_new(const vec &dir, vfloat angle)
Make new turned vector and leave this one unchanged.
friend vec operator-(const vec &r1, const vec &r2)
friend vfloat operator*(const vec &r1, const vec &r2)
friend bool apeq(const vec &r1, const vec &r2, vfloat prec)
Return true if two vectors are approximately the same.
friend vec operator/=(vec &v, vfloat p)
friend vec operator||(const vec &r1, const vec &r2)
Vector product.
friend vec operator-=(vec &r1, const vec &r2)
vec operator/(vfloat p) const
void up(const basis *fabas_new)
friend int operator==(const vec &r1, const vec &r2)
Return 1 if precisely the same vectors and 0 otherwise.
void random_conic_vec(double theta)
friend vec & operator+=(vec &r1, const vec &r2)
friend vec switch_xyz(const vec &)
friend vec operator-(const vec &r)
friend vec operator*=(vec &v, vfloat p)
friend int check_par(const vec &r1, const vec &r2, vfloat prec)
friend vec operator*(vfloat p, const vec &v)
virtual ~vec()
Destructor.
vec(vfloat xx, vfloat yy, vfloat zz)
Constructor.
friend vec unit_vec(const vec &v)
friend vec project_to_plane(const vec &r, const vec &normal)
friend vfloat cos2vec(const vec &r1, const vec &r2)
vec()=default
Default constructor.
friend int operator!=(const vec &r1, const vec &r2)
Return 0 if precisely the same vectors and 1 otherwise.
friend vfloat ang2projvec(const vec &r1, const vec &r2, const vec &normal)
friend vfloat sin2vec(const vec &r1, const vec &r2)
void down(const basis *fabas)
void random_round_vec()
Generate random unit vector in plane perpendicular to z-axis.
vec down_new(const basis *fabas)
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
DoubleAc sqrt(const DoubleAc &f)