25 o <<
"********" << std::endl;
26 o <<
"a_plane:" << std::endl;
27 o <<
"********" << std::endl;
28 o <<
"This is a 'plane' class" << std::endl;
30 o <<
"Create a plane:" << std::endl;
31 o <<
" a_plane p p1 p2 p3" << std::endl;
32 o <<
" (p: name of the plane)" << std::endl;
33 o <<
" (p1, p2, p3: 3 points defining the plane)" << std::endl;
35 o <<
"Commands:" << std::endl;
36 o <<
"n: returns normal to the plane." << std::endl;
37 o <<
"dist _pt: returns distance to a point." << std::endl;
38 o <<
"closest _pt: point on the plane closest to p." << std::endl;
39 o <<
"intersect _seg: intersection of plane with a segment" << std::endl;
40 o <<
"intersect _plane: intersection of plane with another plane" << std::endl;
41 o <<
"contains _pt: check whether point is in plane" << std::endl;
63 return this->
d0()*this->
n();
68 return fabs(this->
T()-this->
n()*p);
73 return p + (this->
dist(p))*(this->
n());
81 double cos_angle =
n*v;
84 double dist = this->
T()-n*p1;
94 double cos_angle = n1*n2;
124 a_point t(p(0,3),p(1,3),p(2,3));
127 this->
T(this->
T()-disp);
128 p(0,3) = p(1,3) = p(2,3) = 0.;
140 in >>
x >>
y >>
z >> t;
149 o << this->
X() <<
" ";
150 o << this->
Y() <<
" ";
151 o << this->
Z() <<
" ";
152 o << this->
T() <<
" ";
std::ostream & operator<<(std::ostream &o, const a_plane &m)
std::istream & operator>>(std::istream &i, a_plane &m)
a_point cross(const a_point &a, const a_point &b)
an homogeneous 3d matrix class
a coordinate system in the Points&Forces file format
static const std::string help()
bool contains(const a_point &p) const
check whether point is in plane
static const std::string help()
virtual void read(std::istream &i)
double d0() const
closest distance to origin
double dist(const a_point &p) const
distance between p and plane
a_point intersect(const a_segment &s) const
intersection of plane with a segment
a_point closest(const a_point &p) const
point on the plane closest to p
virtual void write(std::ostream &o) const
a_point p0() const
closest point to origin
a_point n() const
normal to the plane (direction: given by rotation p1-p2-p3)
a_point dir() const
get direction defined by segment
a_point c() const
center of segment
a_segment intersect(const a_segment &s, double &m1, double &m2) const
intersection between two segments, returns a segment between the closest point between the two lines ...
a_point p1() const
get first apex of segment