// sets the positions of the nodes in a largest face of G in the form // of a regular k-gon. The corresponding nodes and their positions are // stored in nodes and pos, respectively. void TutteLayout::setFixedNodes( const Graph &G, List<node>& nodes, List<DPoint>& pos, double radius) { // compute faces of a copy of G GraphCopy GC(G); PlanarModule pm; // compute a planar embedding if \a G is planar if(pm.planarityTest(G)) pm.planarEmbed(GC); CombinatorialEmbedding E(GC); E.computeFaces(); // search for largest face face maxFace = E.maximalFace(); // delete possible old entries in nodes and pos nodes.clear(); pos.clear(); // set nodes and pos NodeArray<bool> addMe(GC,true); adjEntry adj; List<node> maxNodes; forall_face_adj(adj,maxFace) { maxNodes.pushBack(adj->theNode()); }
// sets the positions of the nodes in a largest face of G in the form // of a regular k-gon. The corresponding nodes and their positions are // stored in nodes and pos, respectively. void TutteLayout::setFixedNodes( const Graph &G, List<node>& nodes, List<DPoint>& pos, double radius) { // compute faces of a copy of G GraphCopy GC(G); // compute a planar embedding if \a G is planar if(isPlanar(G)) planarEmbed(GC); //FIXME this stuff above seems wrong!! CombinatorialEmbedding E(GC); E.computeFaces(); // search for largest face face maxFace = E.maximalFace(); // delete possible old entries in nodes and pos nodes.clear(); pos.clear(); // set nodes and pos NodeArray<bool> addMe(GC,true); List<node> maxNodes; for(adjEntry adj : maxFace->entries) { maxNodes.pushBack(adj->theNode()); } for(node w : maxNodes) { if(addMe[w]) { nodes.pushBack(w); addMe[w] = false; } } double step = 2.0 * Math::pi / (double)(nodes.size()); double alpha = 0.0; for(int i = 0; i < nodes.size(); ++i) { pos.pushBack(DPoint(radius * cos(alpha), radius * sin(alpha))); alpha += step; } }
QVector<QPair<QPoint, QColor> > ImageProcessor::findTeeth(QImage input) { QTime t; t.start(); QImage useMe = constrastImage(input,65); QVector<QPoint> points = ImageProcessor::findOcculsionFaster(useMe); qDebug("1Time elapsed: %d ms", t.elapsed()); QVector<float> occValues = findAverageAndStd(points,input); int average = (int) occValues.at(0); float standardDev = occValues.at(1); qDebug("2Time elapsed: %d ms", t.elapsed()); int cutoff = average + (0 * standardDev); QPair<QVector<QPoint>,QVector<QPoint> > outlines = ImageProcessor::findOutline(input,cutoff,points); qDebug("3Time elapsed: %d ms", t.elapsed()); QVector<QPoint> allOutlines = outlines.first + outlines.second; qDebug("4Time elapsed: %d ms", t.elapsed()); QVector<QPoint> inter = ImageProcessor::findInterProximal(input,points,allOutlines,cutoff); qDebug("5Time elapsed: %d ms", t.elapsed()); QList<QVector<QPoint> > interProxGroups = groupPoints(inter,input.width(),input.height(),1,1,750); qDebug("6Time elapsed: %d ms", t.elapsed()); QVector<QPoint> enamelPoints = findInterProximalEnamel(input,interProxGroups,points); qDebug("7Time elapsed: %d ms", t.elapsed()); QVector<QPoint> badTooth = findCloseDecay(interProxGroups,input); qDebug("8Time elapsed: %d ms", t.elapsed()); QVector<QPoint> badEnamel = intersection(enamelPoints,badTooth); qDebug("9Time elapsed: %d ms", t.elapsed()); //QList<QVector<QPoint> > groupedEnamel = groupPoints(badEnamel,input.width(),input.height(),2,2,10); QVector<QPair<QPoint, QColor> > returnMe; foreach(QPoint point ,points) { QPair<QPoint, QColor> addMe(point,QColor(0,200,0,150)); returnMe.append(addMe); }
foreach(QPoint point, badEnamel) { QPair<QPoint, QColor> addMe(point,QColor(200,5,5,150)); returnMe.append(addMe); }
foreach(QPoint point ,allOutlines) { QPair<QPoint, QColor> addMe(point,QColor(200,115,115,150)); returnMe.append(addMe); }