Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80131815
contact_cluster.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 30, 01:43
Size
4 KB
Mime Type
text/x-c++
Expires
Sun, Sep 1, 01:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20253049
Attached To
rTAMAAS tamaas
contact_cluster.hh
View Options
//==================================================================//
// Percolation detection and characterization of contact clusters //
// To be integrated in FFT-BEM code //
// //
// V.A. Yastrebov, 2014 //
// Centre des Materiaux, CNRS, MINES ParisTech //
// //
// G. Anciaux, 2014 //
// EPFL, ENAC, IIC, LSMS //
//==================================================================//
#ifndef __CONTACT_CLUSTER__
#define __CONTACT_CLUSTER__
/* -------------------------------------------------------------------------- */
#include <map>
#include "surface.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
class ContactArea;
class ContactClusterCollection;
/* -------------------------------------------------------------------------- */
/* Class Contact Cluster class
based on the publication:
[1] Ernesto Bribiesca,
"An easy measure of compactness for 2D and 3D shapes",
Pattern Recognition 41 (2008) 543--554.
doi:10.1016/j.patcog.2007.06.029
*/
class ContactCluster : public Map2d<int> {
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
friend class ContactClusterCollection;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
ContactCluster() : Map2d(0,1.) {}
~ContactCluster() {}
ContactCluster(int color, ContactArea & contact_area);
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
void computeBoundingBox(ContactArea & contact_area);
void minimizeBoundingBox(ContactArea & contact_area);
void extractCluster(ContactArea & contact_area);
void extractClusterPeriodic(ContactArea & contact_area);
void computeStatistics();
void findHoles();
void checkLines(UInt dir,ContactArea & contact_area);
//! function to print the contain of the class
virtual void printself(std::ostream & stream, int indent = 0) const;
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public:
std::vector<Real> getHolesAreas() const{
std::vector<Real> areas;
for (auto & x: holes_areas){
areas.push_back(x.second);
}
return areas;
}
UInt getA(){return A;};
UInt getP(){return P;};
UInt getNbHoles() const {return holes_areas.size();};
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
private:
/* If the shape is for sure concave then concave=true,
however it may be concave even if concave=false.
*/
//! concavity flag
bool concave;
//! color id of the cluster
int id;
//! coordinates of the left bottom corner of the bounding box (i0,j0)
UInt lb_corner[2];
//! coordinates of the right top corner of the bounding box (i1,j1)
UInt rt_corner[2];
//! from clusters connected through periodicity start stop is identifying inner part
int start[2];
int stop[2];
//! size of the bounding box (Nx,Ny)
UInt bbox_size[2];
//! contact area (A)
UInt A;
//! contact perimeter computed discretely (P)
UInt P;
//! interpixel perimeter (IP), the same as contact perimeter in notions of [1]
int IP;
//! the holes areas
std::map<UInt,Real> holes_areas;
//! center of mass (ic,jc)
Real mass_center[2];
//! corrected contact perimeter (Ps)
Real Ps;
//! discrete compactness (Cd=(n-P/4)/(n-sqrt(n)) ) from [1]
Real Cd;
/* Ratio of the internal (closed gap) area to the contact area
$$RI = (A0-Ai-A)/Real(A)$$,
where Ai is the area within the bounding box that surrounds contact cluster
*/
// Real RI;
//! compactness (comp = Ps/sqrt(A))
Real comp;
//! TODO
bool split_cluster;
};
/* -------------------------------------------------------------------------- */
inline std::ostream & operator <<(std::ostream & stream, const ContactCluster & _this)
{
_this.printself(stream);
return stream;
}
__END_TAMAAS__
#endif
Event Timeline
Log In to Comment