52 a_point * p1 = this->
vl(0);
53 a_point * p2 = this->
vl(1);
54 return (*p2-*p1).norm();
60 std::cout <<
"do not expect much with v different from 0. with this type of face" << std::endl;
71 a_point * p1 = this->
vl(0);
72 a_point * p2 = this->
vl(1);
73 return ((*p1)+(*p2))/2.;
78 a_point n = this->
ny();
95 p1 = (*(b->
pos())) * (*(this->
vl(0)));
96 p2 = (*(b->
pos())) * (*(this->
vl(1)));
101 p1 = (*(b->
pos())) * (*(this->
vl(0)));
102 p2 = (*(b->
pos())) * (*(this->
vl(1)));
107 p1 = (*(b->
pos())) * (*(this->
vl(0)));
108 p2 = (*(b->
pos())) * (*(this->
vl(1)));
110 return (p2-p1).normalise();
135 a_point px = this->
nx();
136 a_point py = this->
ny();
137 return cross(px,py).normalise();
143 for (
int i=0; i<4; i++)
145 if (p.contains(this->v3d(i)))
166 a_point n = this->
ny();
168 a_point p1 = p01-n*th;
169 a_point p2 = p01+n*th;
170 a_point p3 = p02+n*th;
171 a_point p4 = p02-n*th;
172 a_triangle t1(p1,p2,p3);
173 a_triangle t2(p1,p3,p4);
174 std::vector<a_triangle> list;
199 std::vector<a_triangle> t = this->
triangles();
200 bool i1 = t[0].contains(p);
201 bool i2 = t[1].contains(p);
207 return a_segment(this->
v3d(i%4),this->
v3d((i+1)%4));
212 a_point
c = this->
c();
213 a_point d = (val/2.)*this->
nx();
216 a_point p0n = this->
v(0)-d;
217 a_point p1n = this->
v(1)+d;
218 this->
block()->
v(r0)->set(p0n.x(),p0n.y(),p0n.z());
219 this->
block()->
v(r1)->set(p1n.x(),p1n.y(),p1n.z());
228 std::vector<a_triangle> t = this->
triangles();
230 s1 = t[0].intersect(s);
232 catch(a_segment::null_segment_error) {
236 s2 = t[1].intersect(s);
238 catch(a_segment::null_segment_error) {
246 a_point v1 = s1.p1();
247 a_point v2 = s1.p2();
248 a_point v3 = s2.p1();
249 a_point v4 = s2.p2();
251 return a_segment(v1,v4);
253 return a_segment(v2,v4);
255 return a_segment(v2,v3);
256 return a_segment(v1,v3);
269 std::vector<a_triangle> t1 = this->
triangles();
270 std::vector<a_triangle> t2 = f2->
triangles();
273 for (
int i=0; i<2; i++)
275 for (
int j=0; j<3; j++)
277 a_point p = t1[i][j];
278 double d = t2[0].distp(p);
310 std::vector<a_point> pts;
311 a_plane p = f2->
plane();
312 for (
int i=0; i<4; i++)
314 a_point
x =
f->v3d(i);
318 a_segment s1(pts[0],pts[1]);
330 std::vector<a_triangle> t1 = this->
triangles();
331 std::vector<a_triangle> t2 = f2->
triangles();
332 std::vector<a_segment> segs;
334 for (
int i=0; i<4; i++)
336 a_segment s = this->
segment(i);
338 for (
int k=0; k<2; k++)
342 a_segment s2 = t2[k].intersect(s);
345 catch(a_segment::null_segment_error) { }
349 for (
int i=0; i<4; i++)
353 for (
int k=0; k<2; k++)
357 a_segment s2 = t1[k].intersect(s);
360 catch(a_segment::null_segment_error) { }
363 int nsegs = segs.size();
369 faces.
av(segs[0].p1());
374 a_point p = segs[i].p2();
376 for (
int j=0; j<nsegs; j++)
380 a_point p2 = segs[j].p1();
381 double d = (p-p2).norm();
396 a_point p3 = segs[j].p2();
397 segs[j].p2(segs[j].p1());
a_block_2d3 * cb_2d3(a_block *b)
a_block_2d4 * cb_2d4(a_block *b)
a_block_2d5 * cb_2d5(a_block *b)
a_face_2d4 * cf_2d4(a_face *f)
a_point normal() const
normal to the definition plan of the block (world coordinates)
void thickness(const double thickness)
set block thickness
void thickness(const double thickness)
set block thickness
a_point normal() const
normal to the definition plan of the block (world coordinates)
void thickness(const double thickness)
set block thickness
a_point normal() const
normal to the definition plan of the block (world coordinates)
virtual std::string name() const
a_twist * pos() const
get pointer to position handle
a_point * v(const int i)
get pointer to vertex
virtual double S() const
Surface.
std::vector< a_triangle > triangles() const
get 2 triangles defining the face
a_plane plane() const
plane defined by face
double dym() const
distance from center to min y
double exry() const
relative excentricity in y direction (between 0 and 1)
void slide(const double &u, const double &v)
slide the face in its plane
virtual int contacttype() const
contact type: (-2: no sister face, -1: not touching, 2: plane contact, 1: edge contact,...
double length() const
length of the face
a_point nx() const
direction of face
int ptsinplane(const a_plane &p) const
get number of points in plane
a_segment segment(const int i) const
get segment (world coordinate)
virtual a_point cl() const
centre of gravity of the face (in local coordinates)
bool contains(const a_point &p) const
check whether a point is inside the face
virtual a_segment contactsegment() const
return edge of contact if faces touch by one edge: hinge
virtual a_point contactpoint() const
return point of contact if faces just touch by one point
a_segment intersect(const a_segment &s) const
intersection of face with a segment
a_point normal() const
normal to the face
virtual a_contact contactface() const
return common surface of contact
double thickness() const
thickness of the face
void grow(const double &val)
grow face
double dyM() const
distance from center to max y
a_point v3d(const int i) const
get vertex (world coordinate, 3D: 4 points: order v0-n, v0+n, v1+n, v1-n
a_point ny() const
normal to the vertices of the block
double exrx() const
relative excentricity in x direction (between 0 and 1)
virtual void slide(const double &u, const double &v)
slide the face in its plane
a_face * lface_
face in contact
std::vector< int > r_vertices_
references to the points of the block defining the face
double exy() const
excentricity in y direction
a_point c() const
centre of mass (in world coordinate)
virtual a_point x() const
application point of f on face
a_point * vl(const int i)
get vertex (in local coordinate)
a_point v(const int i) const
get vertex (in world coordinate)
a_wrench f() const
get force on the face
double exx() const
excentricity in x direction
a_block * block_
block to which the face belongs
a_block * block()
get block