Go to the documentation of this file.
100 if(criteria ==
"Wall Area")
101 return divPlane.
area;
102 else if(criteria ==
"Volume Ratio")
104 else if(criteria ==
"Betweenness Centrality" or criteria ==
"Betweenness Centrality (weighted)")
106 else if(criteria ==
"Random Walk Betweenness" or criteria ==
"Random Walk Betweenness (weighted)")
108 else if(criteria ==
"Neighbor Count")
109 return neighbLeft+neighbRight;
154 for(
uint i = 0; i<sz; i++){
166 writeChar((
char *)&sz,
sizeof(
uint), ba);
167 for(
uint i = 0; i < sz; i++){
227 cellCenter = cellToDivide->pos;
233 cellCenter = cellToDivide->pos;
235 Point3d divPlanePoint = cellCenter + plane.second*plane.first;
236 double distanceToCenter = plane.second;
238 DivPlane p(plane.first, divPlanePoint, distanceToCenter);
246 labelLeft = maxLabel+2;
247 labelRight = maxLabel+1;
251 void newLabelDaughters();
257 void writeDataToVec(std::vector<double>& d);
260 void createUpdatedNeighborhoodMap();
263 void createUpdatedNeighborhoodMap(std::map<IntInt, double>& neighborMap, std::map<Triangle, int>& trisNeighbMap);
265 vector<pair<Point3d, Point3d> > polygonCuttingSegs();
269 vector<vector<Point3d> > getCuttingPolygons();
272 void splitCuttingSegs();
274 void divideCellInCellGraph();
277 bool simulateDivision3D(std::map<IntInt, double> neighborMap, std::map<Triangle, int> trisNeighbMap);
282 double getValue(QString criteria);
295 void createDaughterMeshes();
340 double volumeTotal = 0;
347 cellVtxsOutside.insert(v);
348 cellVtxsOutside.insert(
n);
349 cellVtxsOutside.insert(m);
353 centroidP += volume * (t.
v[0]->pos + t.
v[1]->pos + t.
v[2]->pos) / 4.0;
354 volumeTotal += volume;
356 centroidP /= volumeTotal;
359 centroidsP[parentLabel]=centroidP;
360 std::cout <<
"pc " << centroidP <<
"/" << parentLabel << std::endl;
366 vtxDaughterMap.clear();
372 splitTrisAreas.clear();
377 clearSimulatedData();
382 Point3d divPlaneNrml = divPlane.first;
383 Point3d divPlanePos = divPos + divPlane.second * divPlane.first;
389 planeLineIntersect(divPlanePos, divPlaneNrml, v->pos, v->pos-divPlaneNrml, sP, intersectP);
391 vtxDaughterMap[v] = labelLeft;
394 vtxDaughterMap[v] = labelRight;
399 std::cout <<
"vtxs " << vtxsLeft.size() <<
"/" << vtxsRight.size() << std::endl;
403 if(triToBeSplit(t.
v[0],t.
v[1],t.
v[2])){
406 if(vtxDaughterMap[t.
v[0]] == labelLeft){
407 trisLeft.push_back(t);
408 splitTrisAreas[t] = make_pair(
triangleArea(t.
v[0]->pos, t.
v[1]->pos, t.
v[2]->pos),0);
410 trisRight.push_back(t);
411 splitTrisAreas[t] = make_pair(0,
triangleArea(t.
v[0]->pos, t.
v[1]->pos, t.
v[2]->pos));
417 vector<pair<Point3d, Point3d> > segs = polygonCuttingSegs(divPlaneNrml, divPlanePos);
427 double volumeRatio =
calcRatio(volumeLeft, volumeRight);
429 std::cout <<
"divTest " << divPlanePos <<
"/" << divPlaneNrml <<
"/" << planeArea <<
"/"<< volumeLeft <<
"/" << volumeRight << std::endl;
445 vector<pair<Point3d, Point3d> > polygonCuttingSegs(
Point3d planeNrml,
Point3d planeP);
double calcVolume(vector< Triangle > tris)
std::map< VtxVtx, vertex > segmentsToBeSplit
std::map< IntInt, double > nbhdMap
std::map< vertex, int > vtxDaughterMap
std::set< Triangle > trisSplit
std::vector< Point3i > tris
const Attributes & attributes() const
Get the mesh attributes.
DivAlg
Type of cell division SHORTEST WALL : CLOSEST MID : take midpoints of all wall segments and check whi...
std::set< Triangle > trisSplit
std::set< vertex > vtxsRight
std::map< Triangle, int > trisNeighbMap
void initialize(Mesh *m, int parentLabel)
CU_HOST_DEVICE T signedTetraVolume(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
bool readAttr(DivisionDataNew &dd, const QByteArray &ba, size_t &pos)
CU_HOST_DEVICE T triangleArea(const Point3(T) &a, const Point3(T) &b, const Point3(T) &c)
std::map< IntInt, double > neighborMapOld
std::map< IntInt, double > weights
std::map< vertex, int > vtxDaughterMap
double planeAreaRelActual
std::vector< Triangle > trisRight
void updGeometry()
Set area, length of cell walls, center and normal.
mgx::CellTissue::DivAlg divAlg
Distributed matrix library.
std::map< Triangle, std::pair< double, double > > splitTrisAreas
CellDivision(const cell &cellToDivide, DivPlane d, const cellGraph &C)
double calcRatio(double value1, double value2)
return the ratio ( = bigger value divided by smaller value)
mgx_EXPORT std::vector< std::vector< Point3d > > orderPolygonSegsMulti(std::vector< std::pair< Point3d, Point3d > > &polygonSegs)
std::pair< Point3d, double > P3dDouble
void clearSimulatedData()
DivPlane(Point3d nrml, Point3d pos, double displ)
VVGraph< VertexData, EdgeData > vvGraph
Simpler names for the various containers and iterators related to vertices and VV.
AttrMap< KeyT, ValueT > & attrMap(const QString &name, bool saveRequired=true)
Get the attribute, if it does not exist create it and add to the set If it exists,...
CellDivision(P3dDouble plane, CellTissue &T, cell cellToDivide, int maxLabel)
std::vector< CellDivisionAttr > simulationData
class Triangle Triangle.hpp <Triangle.hpp>
void copyCellGraph(CellTissue &orig, CellTissue ©)
copies the cell graph, used for simulating cell division (without altering the original)
std::vector< vertex > getOrRemoveCommonWall(Mesh *m, std::vector< vertex > &cellVtxs, bool removeCommon, bool includeEdgeOfShared)
bool operator==(const CellDivisionAttr &other) const
vector< vector< Point3d > > pointsPolygonMulti
bool operator==(const DivisionDataNew &other) const
double planeAreaRelShortest
std::vector< Triangle > cellTrisShared
double cutLowDegreeNeighbor
vector< vector< Point3d > > pointsPolygonMulti
CellDivisionAttr simulateDivision3D(P3dDouble divPlane, Point3d divPos)
std::set< vertex > cellVtxsOutside
double divisionPlaneAreaMulti(Point3d cellCenter, const std::vector< std::vector< Point3d > > &vMulti)
returns the summed area of multiple polygons (=division planes)
std::vector< Triangle > trisRight
std::map< VtxVtx, vertex > segmentsToBeSplit
std::map< Triangle, std::pair< double, double > > splitTrisAreas
double cutLowDegreeNeighbor
bool writeAttr(const DivisionDataNew &dd, QByteArray &ba)
double getValue(QString criteria)
std::vector< vertex > vtxs
CU_HOST_DEVICE bool planeLineIntersect(const Point3(T) &p, const Point3(T) &nrml, const Point3(T) &u1, const Point3(T) &u2, T &s, Point3(T) &u)
Plane-Line Intersection.
Attribute map wraps std::map.
std::vector< Triangle > findCellTris(vvGraph &S, int cellLabel)