29#define pvecerror(string) \
31 if (vecerror != 0) { \
32 mcerr << "vecerror is not zero, program is terminated\n" \
33 << " function detected error is " << string << '\n'; \
36#define pvecerrorp(string) \
38 if (vecerror != 0) { \
39 mcerr << "vecerror is not zero, program is terminated\n" \
40 << " function detected error is " << string << '\n'; \
125 virtual void print(std::ostream& file,
int l)
const;
157#define ApplyAnyFunctionToVecElements(func) \
159 ActivePtr<absref_transmit> aref_tran_cont; \
160 get_components(aref_tran_cont); \
161 absref_transmit* aref_tran = aref_tran_cont.get(); \
162 if (aref_tran != NULL) { \
164 int q = aref_tran->qaref; \
165 for (n = 0; n < q; n++) (this->*(aref_tran->aref[n])).func; \
166 q = aref_tran->qaref_pointer; \
167 for (n = 0; n < q; n++) aref_tran->aref_pointer[n]->func; \
168 q = aref_tran->qaref_other; \
169 for (n = 0; n < q; n++) { \
170 absref* ar = aref_tran->get_other(n); \
211 void up(
const basis* fabas_new);
232 return vec(v.
x * p, v.
y * p, v.
z * p);
239 return vec(v.
x * p, v.
y * p, v.
z * p);
247 return vec(r1.
x + r2.
x, r1.
y + r2.
y, r1.
z + r2.
z);
254 return vec(r1.
x - r2.
x, r1.
y - r2.
y, r1.
z - r2.
z);
262 return r1.
x * r2.
x + r1.
y * r2.
y + r1.
z * r2.
z;
266 return vec(r1.
y * r2.
z - r1.
z * r2.
y, r1.
z * r2.
x - r1.
x * r2.
z,
267 r1.
x * r2.
y - r1.
y * r2.
x);
316#include "wcpplib/geometry/vec.ic"
343 basis(
const std::string& pname);
350 basis(
const vec& p,
const std::string& fname);
358 basis(
const vec& p,
const vec& c,
const std::string& pname);
361 basis(
const basis& pb,
const std::string& pname);
363 basis(
const vec& pex,
const vec& pey,
const vec& pez,
const std::string& pname);
367 virtual void print(std::ostream& file,
int l)
const;
370extern std::ostream&
operator<<(std::ostream& file,
const basis& b);
395 :
v(fex, fey, fez) {}
404 return p1.
v == p2.
v ? 1 : 0;
407 return p1.
v != p2.
v ? 1 : 0;
410 return apeq(p1.
v, p2.
v, prec);
414 virtual void print(std::ostream& file,
int l)
const;
417std::ostream&
operator<<(std::ostream& file,
const point& p);
425#define vec_syscoor_index 0
434 virtual void print(std::ostream& file,
int l)
const;
438extern std::ostream&
operator<<(std::ostream& file,
const abssyscoor& s);
453 const std::string& fname)
455 piv((fapiv != NULL) ? (*fapiv) :
point()),
456 bas((fabas != NULL) ? (*fabas) :
basis()) {}
461 virtual void print(std::ostream& file,
int l)
const;
Active pointer or automatic container or controlling pointer.
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(const absref_transmit &f)
absref_transmit(int fqaref, absref absref::**faref)
virtual absref_transmit * copy() const
virtual ~absref_transmit()
Destructor.
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 void get_components(ActivePtr< absref_transmit > &aref_tran)
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
virtual fixsyscoor * copy() const
void Ppiv(const point &fpiv)
virtual void print(std::ostream &file, int l) const
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
virtual const basis * Gabas() const
void Pbas(const basis &fbas)
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)
static absrefabsref::*[2] aref
virtual const point * Gapiv() const
virtual void down(const abssyscoor *fasc)
Convert numbering representation of object to basical system of fasc.
point()
Default constructor (coordinates are not initialised).
point operator+(const vec &fv) const
friend int operator!=(const point &p1, const point &p2)
virtual void up(const abssyscoor *fasc)
Convert numbering representation of objects to new system.
friend bool apeq(const point &p1, const point &p2, vfloat prec)
point & operator=(const point &fp)
point(const vfloat fex, const vfloat fey, const vfloat fez)
Constructor from coordinates.
vec operator-(const point &pp) const
friend int operator==(const point &p1, const point &p2)
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
virtual void shift(const vec &dir)
vec()
Default constructor.
vec up_new(const basis *fabas_new)
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)
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)
void turn(const vec &dir, vfloat angle)
Turn this vector.
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 shift(const vec &dir)
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)