bool LocalMapLayer::isValidPerspective(const GeoDataLatLonBox &candidate) const { if (!mVisible || !mHasContent) { //any perspective is valid if no content is showing return true; } GeoDataLatLonBox box = mLocalMapLogic->currentBox(); if (!candidate.contains(box) && !candidate.intersects(box)) { //No relation - invalid perspective return false; } //Acceptable scales qreal d = diameter(box); qreal zoomOutLimit = d * 4; qreal zoomInLimit = d * 0.25; qreal dCandidate = diameter(candidate); if (dCandidate > zoomOutLimit || dCandidate < zoomInLimit) { //Box is too big or too small return false; } return true; }
int diameter(Node* root) { if(!root) { return -1; } return std::max( std::max(diameter(root->child[0]), diameter(root->child[1])), 1 + maxLevel(root->child[0]) + 1 + maxLevel(root->child[1]) + 1 ); }
int diameter (TNODE_p_t tree) { if (tree == NULL) return 0; int ld = diameter(tree->left); int rd = diameter(tree->right); int dd = (ld > rd) ? ld : rd; int lp = 1 + heightTree(tree->left) + heightTree(tree->right); return (lp > dd) ? lp : dd; }
int diameter(struct Tree* root,int *p) { if(root==NULL)return 0; int left,right; left=diameter(root->left,p); right=diameter(root->right,p); if(left+right > *p)*p=left+right; return maxi(left,right)+1 ; }
int diameter(Node* node) { if(node == NULL) return 0; int lh = height(node->left); int rh = height(node->right); int ldiameter = diameter(node->left); int rdiameter = diameter(node->right); return max(lh+rh+1, max(ldiameter,rdiameter)); }
int diameter(struct BT *root,int *prev) { if(!root) return 0; int left=diameter(root->l,prev); int right=diameter(root->r,prev); if(left+right>*prev) *prev=left+right; return max(left,right)+1; }
void TDObj::hide (void) { if (id_displayed != td_notdispd) { hide (diameter ()); } else bzouzerr << "called when not already displayed ?" << endl ; }
//==== Write External File ====// void PropGeom::write(xmlNodePtr root) { xmlAddStringNode( root, "Type", "Prop"); //==== Write General Parms ====// xmlNodePtr gen_node = xmlNewChild( root, NULL, (const xmlChar *)"General_Parms", NULL ); write_general_parms( gen_node ); //==== Write Fuse Parms ====// xmlNodePtr prop_node = xmlNewChild( root, NULL, (const xmlChar *)"Prop_Parms", NULL ); xmlAddIntNode( prop_node, "NumBlades", numBlades ); xmlAddIntNode( prop_node, "SmoothFlag", smoothFlag ); xmlAddIntNode( prop_node, "NumU", numU ); xmlAddIntNode( prop_node, "NumW", numW ); xmlAddDoubleNode( prop_node, "Diameter", diameter() ); xmlAddDoubleNode( prop_node, "ConeAngle", cone_angle() ); xmlAddDoubleNode( prop_node, "Pitch", pitch() ); for ( int i = 0 ; i < (int)sectVec.size() ; i++ ) { xmlNodePtr sect_node = xmlNewChild( prop_node, NULL, (const xmlChar *)"Sect_Parms", NULL ); xmlAddDoubleNode( sect_node, "X_Off", sectVec[i].x_off() ); xmlAddDoubleNode( sect_node, "Y_Off", sectVec[i].y_off() ); xmlAddDoubleNode( sect_node, "Chord", sectVec[i].chord() ); xmlAddDoubleNode( sect_node, "Twist", sectVec[i].twist() ); xmlNodePtr af_node = xmlNewChild( sect_node, NULL, (const xmlChar *)"Airfoil", NULL ); sectVec[i].foil->write( af_node ); } }
int main () { Node* root = new Node(1, new Node(2, new Node(5, new Node(7), new Node(8, new Node(9, new Node(10), new Node(11) ) ) ), new Node(6, NULL, new Node(12, new Node(13), new Node(14, NULL, new Node(15) ) ) ) ), new Node(3, NULL, new Node(4) ) ); int length = diameter(root); std::cout << length; return 0; }
int diameter(Tree root) { int ldiam,rdiam,rhit,lhit,k; if(root ==NULL) return 0; ldiam = diameter(root->left); rdiam =diameter(root->right); rhit = height(root->right); lhit = height(root->left); printf("-- %d %d %d %d data %d\n",ldiam,rdiam,lhit,rhit,root->data); k =max(rdiam,ldiam); return max(k,(rhit+lhit+1)); }
void PropGeom::scale() { double current_factor = scaleFactor()*(1.0/lastScaleFactor); diameter.set( diameter()*current_factor ); lastScaleFactor = scaleFactor(); }
inline std::vector< Completion > fromCOMPDAT( const EclipseGrid& grid, const DeckRecord& compdatRecord, const Well& well, int prev_complnum ) { std::vector< Completion > completions; // We change from eclipse's 1 - n, to a 0 - n-1 solution // I and J can be defaulted with 0 or *, in which case they are fetched // from the well head const auto& itemI = compdatRecord.getItem( "I" ); const auto defaulted_I = itemI.defaultApplied( 0 ) || itemI.get< int >( 0 ) == 0; const int I = !defaulted_I ? itemI.get< int >( 0 ) - 1 : well.getHeadI(); const auto& itemJ = compdatRecord.getItem( "J" ); const auto defaulted_J = itemJ.defaultApplied( 0 ) || itemJ.get< int >( 0 ) == 0; const int J = !defaulted_J ? itemJ.get< int >( 0 ) - 1 : well.getHeadJ(); int K1 = compdatRecord.getItem("K1").get< int >(0) - 1; int K2 = compdatRecord.getItem("K2").get< int >(0) - 1; WellCompletion::StateEnum state = WellCompletion::StateEnumFromString( compdatRecord.getItem("STATE").getTrimmedString(0) ); Value<double> connectionTransmissibilityFactor("ConnectionTransmissibilityFactor"); Value<double> diameter("Diameter"); Value<double> skinFactor("SkinFactor"); { const auto& connectionTransmissibilityFactorItem = compdatRecord.getItem("CONNECTION_TRANSMISSIBILITY_FACTOR"); const auto& diameterItem = compdatRecord.getItem("DIAMETER"); const auto& skinFactorItem = compdatRecord.getItem("SKIN"); if (connectionTransmissibilityFactorItem.hasValue(0) && connectionTransmissibilityFactorItem.getSIDouble(0) > 0) connectionTransmissibilityFactor.setValue(connectionTransmissibilityFactorItem.getSIDouble(0)); if (diameterItem.hasValue(0)) diameter.setValue( diameterItem.getSIDouble(0)); if (skinFactorItem.hasValue(0)) skinFactor.setValue( skinFactorItem.get< double >(0)); } const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnumFromString(compdatRecord.getItem("DIR").getTrimmedString(0)); for (int k = K1; k <= K2; k++) { completions.emplace_back( I, J, k, int( completions.size() + prev_complnum ) + 1, grid.getCellDepth( I,J,k ), state, connectionTransmissibilityFactor, diameter, skinFactor, direction ); } return completions; }
/* Function to get diameter of a binary tree */ int diameter(struct node * tree) { /* base case where tree is empty */ if (tree == 0) return 0; /* get the height of left and right sub-trees */ int lheight = height(tree->left); int rheight = height(tree->right); /* get the diameter of left and right sub-trees */ int ldiameter = diameter(tree->left); int rdiameter = diameter(tree->right); /* Return max of following three 1) Diameter of left subtree 2) Diameter of right subtree 3) Height of left subtree + height of right subtree + 1 */ return max(lheight + rheight + 1, max(ldiameter, rdiameter)); }
int main() { int T; scanf("%d",&T); while(T--) { int x; scanf("%d",&x); diameter(x); } return 0; }
//-------------------------------------------------------------------- // This function normalizes integer values and corrects the rounding // errors. It doesn't do anything with the source floating point values // (m_weight_array_dbl), it corrects only integers according to the rule // of 1.0 which means that any sum of pixel weights must be equal to 1.0. // So, the filter function must produce a graph of the proper shape. //-------------------------------------------------------------------- void image_filter_lut::normalize() { unsigned i; int flip = 1; for(i = 0; i < image_subpixel_scale; i++) { for(;;) { int sum = 0; unsigned j; for(j = 0; j < m_diameter; j++) { sum += m_weight_array[j * image_subpixel_scale + i]; } if(sum == image_filter_scale) break; double k = double(image_filter_scale) / double(sum); sum = 0; for(j = 0; j < m_diameter; j++) { sum += m_weight_array[j * image_subpixel_scale + i] = iround(m_weight_array[j * image_subpixel_scale + i] * k); } sum -= image_filter_scale; int inc = (sum > 0) ? -1 : 1; for(j = 0; j < m_diameter && sum; j++) { flip ^= 1; unsigned idx = flip ? m_diameter/2 + j/2 : m_diameter/2 - j/2; int v = m_weight_array[idx * image_subpixel_scale + i]; if(v < image_filter_scale) { m_weight_array[idx * image_subpixel_scale + i] += inc; sum += inc; } } } } unsigned pivot = m_diameter << (image_subpixel_shift - 1); for(i = 0; i < pivot; i++) { m_weight_array[pivot + i] = m_weight_array[pivot - i]; } unsigned end = (diameter() << image_subpixel_shift) - 1; m_weight_array[0] = m_weight_array[end]; }
void TDObj::show (void) { if (id_displayed == td_notdispd) { id_displayed = td_displayed.insert (td_displayed.end(), this); GLfloat diam = diameter (); list<TDObj *>::iterator li; int i=0; for (li = td_displayed.begin() ; li != id_displayed ; li++, i++) // JDJDJDJD we may reach END !!!!! (*li)->pos.z -= diam; // pos.z = -1.0 + diam / 2.0; // the initial top-z value should be tunable JDJDJDJD pos.z = -15.0 - diam / 2.0; // the initial top-z value should be tunable JDJDJDJD } else bzouzerr << "called when already displayed ?" << endl ; }
int main() { struct Tree* root=newnode(10); root->left=newnode(11); root->right=newnode(12); root->left->left=newnode(1); root->left->right=newnode(2); root->right->left=newnode(4); root->right->right=newnode(15); int a=0; int *p; p=&a; printf("%d",diameter(root,p)); return 0; }
void TDObj::show (TDObj const & td) { if (id_displayed == td_notdispd) { list<TDObj *>::iterator ni = td.id_displayed; ni ++; id_displayed = td_displayed.insert (ni, this); GLfloat diam = diameter (); list<TDObj *>::iterator li; for (li = td_displayed.begin() ; li != id_displayed ; li++) (*li)->pos.z -= diam; pos.z = td.pos.z + diam / 2.0; // just on top of td } else bzouzerr << "called when already displayed ?" << endl ; }
LedMeasurement augmentKeypoint(cv::Mat grayImage, cv::KeyPoint origKeypoint) { // Saving this now before we monkey with m_floodFillMask cv::bitwise_not(m_floodFillMask, m_scratchNotMask); const int loDiff = 2; const int upDiff = 2; auto m_area = cv::floodFill( grayImage, m_floodFillMask, origKeypoint.pt, 255, &m_filledBounds, loDiff, upDiff, CV_FLOODFILL_MASK_ONLY | (/* connectivity 4 or 8 */ 4) | (/* value to write in to mask */ 255 << 8)); // Now m_floodFillMask contains the mask with both our point // and all other points so far. We need to split them by ANDing with // the NOT of the old flood-fill mask we saved earlier. cv::bitwise_and(m_scratchNotMask, m_floodFillMask, m_perPointResults); // OK, now we have the results for just this point in per-point // results /// Initialize return value auto ret = static_cast<LedMeasurement>(origKeypoint); if (m_area <= 0) { // strange... return ret; } m_binarySubImage = m_perPointResults(m_filledBounds); computeContour(); m_moments = haveContour() ? cv::moments(m_contour, false) : cv::moments(m_binarySubImage, true); // the first two we are using from the keypoint description, the latter we can't // always get (contour-based) #if 0 /// Estimate diameter ret.diameter = diameter(); ret.area = area(); if (haveContour()) { ret.circularity = circularity(); } #endif ret.knowBoundingBox = true; ret.boundingBox = cv::Size2f(m_filledBounds.width, m_filledBounds.height); return ret; }
int main() { std::ifstream in("input.txt"); std::ofstream out("output.txt"); int N, M; in >> N >> M; std::vector<node> graph (N); for (int i = 0; i < M; i++) { int from, to; in >> from >> to; graph[from].neighbors.push_back(to); graph[to].neighbors.push_back(from); } out << diameter(graph, N); out.close(); in.close(); return 0; }
void stalkersGraphRunMetrics(Graph* gStalkers) { printf("Stalkers graph executing metrics:\n"); degreeDistribution(gStalkers, false); int diam = diameter(gStalkers); double avgPthLgth = averagePathLength(gStalkers); int ccNumber = numberOfCCs(gStalkers); int maximumCC = maxCC(gStalkers); double dense = density(gStalkers); }
int main() { /* 1 / \ 2 3 / \ 4 5 */ Tree root =createNode(1); root->left = createNode(2); root->right = createNode(3); root->left->right = createNode(5); root->left->left = createNode(4); printf("Diameter of the tree %d\n",diameter(root)); }
main() { struct BT *rt=nn(4); rt->l=nn(5); rt->r=nn(89); rt->l->r=nn(77); rt->l->l=nn(55); rt->r->r=nn(44); rt->r->l=nn(22); rt->l->l->l=nn(30); rt->l->l->r=nn(43); int i,b=0; for(i=0;i<4;i++) { zigzagr(rt,i,b); printf("\n\n"); b=~b; } printf("\n\n\n\n"); zigzag(rt); printf("\n\n"); if(hassumproperty(rt)) printf("it has children sum property\n\n"); else printf("it has no childeren sum property\n\n"); // convert(rt); if(hassumproperty(rt)) printf("it has children sum property\n\n"); else printf("it has no childeren sum property\n\n"); int p=0; int d= diameter(rt,&p); printf("Diameter %d\n",d); }
void graph::correct(){ calcDist(); int v1, v2, d; d = diameter(); bool done = false; for (int i = 0; i < nodes; i++){ for (int j = 0; j < nodes; j++){ if (dist[i][j] = d){ v1 = i; v2 = j; done = true; break; } } if (done) break; } vector<int> v1Neighbors, v2Neighbors; for (int i = 0; i < nodes; i++){ if (adj[v1][i]) v1Neighbors.push_back(i); if (adj[v2][i]) v2Neighbors.push_back(i); } bool * x = new bool[nodes * nodes]; bool * best = new bool[nodes * nodes]; int best_d = 10000000; float best_a = 1000000.0f; for (vector<int>::iterator i = v1Neighbors.begin(); i != v1Neighbors.end(); i++){ for (vector<int>::iterator j = v2Neighbors.begin(); j != v2Neighbors.end(); j++){ for (int r = 0; r < nodes; r++) for (int c = 0; c < nodes; c++) x[r * nodes + c] = adj[r][c]; das(x, v1, *j, *i, v2, nodes); graph g(x, nodes); if (g.diameter() <= best_d && g.average() < best_a){ memcpy(best, x, nodes * nodes * sizeof(bool)); best_d = g.diameter(); best_a = g.average(); } } } delete[] x; memcpy(&adj[0][0], best, nodes * nodes * sizeof(bool)); delete[] best; }
int VSSpherePhantom::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = VSSubphantom::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = diameter(); break; case 1: *reinterpret_cast< float*>(_v) = apodization(); break; } _id -= 2; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDiameter(*reinterpret_cast< QString*>(_v)); break; case 1: setApodization(*reinterpret_cast< float*>(_v)); break; } _id -= 2; } else if (_c == QMetaObject::ResetProperty) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }
std::pair<std::string , std::vector<CompletionPtr> > Completion::completionsFromCOMPDATRecord( const DeckRecord& compdatRecord ) { std::vector<CompletionPtr> completions; std::string well = compdatRecord.getItem("WELL").getTrimmedString(0); // We change from eclipse's 1 - n, to a 0 - n-1 solution int I = compdatRecord.getItem("I").get< int >(0) - 1; int J = compdatRecord.getItem("J").get< int >(0) - 1; int K1 = compdatRecord.getItem("K1").get< int >(0) - 1; int K2 = compdatRecord.getItem("K2").get< int >(0) - 1; WellCompletion::StateEnum state = WellCompletion::StateEnumFromString( compdatRecord.getItem("STATE").getTrimmedString(0) ); Value<double> connectionTransmissibilityFactor("ConnectionTransmissibilityFactor"); Value<double> diameter("Diameter"); Value<double> skinFactor("SkinFactor"); { const auto& connectionTransmissibilityFactorItem = compdatRecord.getItem("CONNECTION_TRANSMISSIBILITY_FACTOR"); const auto& diameterItem = compdatRecord.getItem("DIAMETER"); const auto& skinFactorItem = compdatRecord.getItem("SKIN"); if (connectionTransmissibilityFactorItem.hasValue(0) && connectionTransmissibilityFactorItem.getSIDouble(0) > 0) connectionTransmissibilityFactor.setValue(connectionTransmissibilityFactorItem.getSIDouble(0)); if (diameterItem.hasValue(0)) diameter.setValue( diameterItem.getSIDouble(0)); if (skinFactorItem.hasValue(0)) skinFactor.setValue( skinFactorItem.get< double >(0)); } const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnumFromString(compdatRecord.getItem("DIR").getTrimmedString(0)); for (int k = K1; k <= K2; k++) { CompletionPtr completion(new Completion(I , J , k , state , connectionTransmissibilityFactor, diameter, skinFactor, direction )); completions.push_back( completion ); } return std::pair<std::string , std::vector<CompletionPtr> >( well , completions ); }
int diameter(int root) { std::pair<int, int> radius = {0, 0}; for (auto const node : tree[root]) { int cost = diameter(node.first) + node.second; if (cost > radius.first) { std::swap(radius.first, radius.second); radius.first = cost; } else if (cost > radius.second) { radius.second = cost; } } answer = std::max(answer, radius.first + radius.second); return radius.first; }
int main(int argc, char** argv) { BinaryTree tree; if (argc != 3) { std::cout << "Invalid number of arguments.\nUsage: " << argv[0] << " <inputFile> <outFile>\n"; return 1; } tree.readFile(argv[1]); tree.DFS(); tree.gvout(argv[2]); cout<<"is 10 anc 23 "<<isAncestor(tree,10,23)<<endl; cout<<"is 10 anc 40 "<<isAncestor(tree,10,40)<<endl; cout<<"is 40 anc 10 "<<isAncestor(tree,40,10)<<endl; cout<<"is 2 anc 47 "<<isAncestor(tree,2,47)<<endl; cout<<"is 1 anc 160 "<<isAncestor(tree,1,160)<<endl; cout<<"is 160 anc 1 "<<isAncestor(tree,160,1)<<endl; cout<<"is 160 anc 95 "<<isAncestor(tree,160,95)<<endl; cout<<"is 5 anc 11 "<<isAncestor(tree,5,11)<<endl; cout<<"is 11 anc 5 "<<isAncestor(tree,11,5)<<endl; cout << "LCA of 1 and 160 is " << LCA(tree,1,160) << endl; cout << "LCA of 160 and 1 is " << LCA(tree,160,1) << endl; cout << "LCA of 160 and 95 is " << LCA(tree,160,95) << endl; cout << "LCA of 95 and 160 is " << LCA(tree,95,160) << endl; cout << "LCA of 2 and 2 is " << LCA(tree,2,2) << endl; cout << "LCA of 5 and 11 is " << LCA(tree,5,11) << endl; cout << "LCA of 11 and 5 is " << LCA(tree,11,5) << endl; cout << "LCA of 160 and 3 is " << LCA(tree,160,3) << endl; cout << "LCA of 10 and 11 is " << LCA(tree,10,11) << endl; cout << "Size of tree = " << subTreeSize(tree,1) << endl; cout << "Size of subtree at 160 = " << subTreeSize(tree,160) << endl; cout << "Size of subtree at 95 = " << subTreeSize(tree,95) << endl; cout << "Size of subtree at 5 = " << subTreeSize(tree,5) << endl; cout << "Size of subtree at 2 = " << subTreeSize(tree,2) << endl; cout << "Balance = " << isBalanced(tree, 1) << endl; cout << "Balance at 160 = " << isBalanced(tree, 160) << endl; cout << "Balance at 80 = " << isBalanced(tree, 80) << endl; cout << "Balance at 40 = " << isBalanced(tree, 40) << endl; cout << "Balance at 5 = " << isBalanced(tree, 5) << endl; cout << "Balance at 2 = " << isBalanced(tree, 2) << endl; cout << "Balance at 3 = " << isBalanced(tree, 3) << endl; /* cout << "LCA of 2 and 6 is " << LCA(tree,2,6) << endl; cout << "LCA of 2 and 4 is " << LCA(tree,2,4) << endl; cout << "LCA of 2 and 2 is " << LCA(tree,2,2) << endl; cout << "LCA of 7 and 4 is " << LCA(tree,7,4) << endl; cout << "Balance = " << isBalanced(tree, 1) << endl; cout << "Balance at 8= " << isBalanced(tree, 8) << endl; cout << "Balance at 4 = " << isBalanced(tree, 4) << endl; cout << "Balance at 3 = " << isBalanced(tree, 3) << endl; cout << "Balance at 2 = " << isBalanced(tree, 2) << endl; cout << "Size of tree = " << subTreeSize(tree,1) << endl; cout << "Size of subtree at 2 = " << subTreeSize(tree,2) << endl; cout << "Size of subtree at 3 = " << subTreeSize(tree,3) << endl; cout << "Size of subtree at 8 = " << subTreeSize(tree,8) << endl; */ cout <<"Diameter of tree =" << diameter(tree) <<endl; return 0; }
void FeatureSearch::initSearch() { m_countFeatures = 0; for(std::vector<SearchPairInfo>::iterator itSPI = m_infos.begin(); itSPI != m_infos.end(); itSPI++) { m_countFeatures += itSPI->area.width() * itSPI->area.height(); } // Allocate the array of points m_pointArray = annAllocPts( m_countFeatures, m_spaceDimension ); for(std::vector<SearchPairInfo>::iterator itSPI = m_infos.begin(); itSPI != m_infos.end(); itSPI++) { // Initialize the descriptors int cacheLineCount = (itSPI->area.width() + diameter()); size_t cacheLineSize = cacheLineCount * sizeof(Feature); // pixels will hold a cache of the luminosity to feed the descriptors Feature** pixels = new Feature*[diameter()]; for(int i = 0; i < diameter(); i++) { pixels[i] = new Feature[ cacheLineCount ]; } // KisColorSpace* cs = dev->colorSpace(); // Read the first 'radius' line to initialize the cache KisHLineIterator itDevA = itSPI->devA->createHLineIterator(itSPI->area.x(), itSPI->area.y(), itSPI->area.width(), false); KisHLineIterator itDevAPrime = itSPI->devAPrime->createHLineIterator(itSPI->area.x(), itSPI->area.y(), itSPI->area.width(), false); // Intialize the first row of the cache, as the cache needs to be full before it is possible to start creating descriptors for the key points for(int indexInPixels = radius(); indexInPixels < diameter() - 1; ++indexInPixels) { deviceToCache(itDevA, pixels[indexInPixels], radius()); itDevA.nextRow(); } // Copy the first line, as the first 'radius' columns are initialized with the same pixel value for(int i = 0; i < radius(); ++i) { memcpy(pixels[i], pixels[radius()], cacheLineSize); } // Main loop int posInAP = 0; for(int y = 0; y < itSPI->area.height(); y++) { // Fill the last line of the cache if( itDevA.y() <= itSPI->area.bottom()) { deviceToCache(itDevA, pixels[diameter() - 1], radius()); } else { // No more line in the device, so copy the last line memcpy(pixels[diameter() - 1], pixels[diameter() - 2], cacheLineSize); } itDevA.nextRow(); // Use the cache to fill the array of points for(int x = 0; x < itSPI->area.width(); x++) { int subPos = 0; // kdDebug() << " Feature : " << posInAP << endl; for(int i = 0; i < diameter(); i++) { for(int j = 0; j < diameter(); j++) { pixels[i][j + x].convertToArray((m_pointArray[ posInAP ]) + subPos ); // kdDebug() << subPos << " "<< pixels[i][j + x] << endl; subPos++; } } m_values.push_back(*reinterpret_cast<float*>(itDevAPrime.rawData())); ++itDevAPrime; ++posInAP; } itDevAPrime.nextRow(); swapCache(pixels, diameter()); } // delete the luminosity cache for(int i = 0; i < diameter(); i++) { delete[] pixels[i]; } delete[] pixels; } // Initialize the search tree m_tree = new ANNkd_tree( m_pointArray, m_countFeatures, m_spaceDimension); }
FeatureSearch::FeatureSearch( int r) : m_countFeatures(0), m_radius(r), m_diameter(2*r+1), m_tree(0) { // Compute the size of the descriptors m_spaceDimension = Feature::size() * diameter() * diameter(); }