void R3MeshSearchTree:: FindAll(const R3Point& query_position, RNArray<R3MeshIntersection *>& hits, RNScalar min_distance, RNScalar max_distance, int (*IsCompatible)(const R3Point&, const R3Vector&, R3Mesh *, R3MeshFace *, void *), void *compatible_data) { // Find closest point, ignoring normal FindAll(query_position, R3zero_vector, hits, min_distance, max_distance, IsCompatible, compatible_data); }
ECode FindActionModeCallback::OnTextChanged( /* [in] */ ICharSequence* s, /* [in] */ Int32 start, /* [in] */ Int32 before, /* [in] */ Int32 count) { FindAll(); return NOERROR; }
PlexAudioDevicePtr PlexAudioDevices::FindByName(const string& audioDeviceName) { PlexAudioDevicesPtr allDevices = FindAll(); // Find the matching device. BOOST_FOREACH(PlexAudioDevicePtr device, allDevices->getDevices()) if (device->getName() == audioDeviceName) return device; return PlexAudioDevicePtr(); }
void R3MeshSearchTree:: FindAll(const R3Point& query_position, const R3Vector& query_normal, RNArray<R3MeshIntersection *>& hits, RNScalar min_distance, RNScalar max_distance, int (*IsCompatible)(const R3Point&, const R3Vector&, R3Mesh *, R3MeshFace *, void *), void *compatible_data) { // Check root if (!root) return; // Update mark (used to avoid checking same face twice) mark++; // Use squared distances for efficiency RNScalar min_distance_squared = min_distance * min_distance; RNScalar max_distance_squared = max_distance * max_distance; // Search nodes recursively FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, root, BBox()); }
/* * Move the highlight to the next match. * @param next If true, find the next match further down in the document. * If false, find the previous match, up in the document. */ void FindActionModeCallback::FindNext( /* [in] */ Boolean next) { if (mWebView == NULL) { //throw new AssertionError( // "No WebView for FindActionModeCallback::findNext"); assert(0); } if (!mMatchesFound) { FindAll(); return; } if (0 == mNumberOfMatches) { // There are no matches, so moving to the next match will not do // anything. return; } mWebView->FindNext(next); UpdateMatchesString(); }
void R3MeshSearchTree:: FindAll(const R3Point& query_position, const R3Vector& query_normal, RNArray<R3MeshIntersection *>& hits, RNScalar min_distance_squared, RNScalar max_distance_squared, int (*IsCompatible)(const R3Point&, const R3Vector&, R3Mesh *, R3MeshFace *, void *), void *compatible_data, R3MeshSearchTreeNode *node, const R3Box& node_box) const { // Compute distance (squared) from query point to node bbox RNScalar distance_squared = DistanceSquared(query_position, node_box, max_distance_squared); if (distance_squared >= max_distance_squared) return; // Check each big face for (int i = 0; i < node->big_faces.NEntries(); i++) { // Get face container and check mark R3MeshSearchTreeFace *face_container = node->big_faces[i]; if (face_container->mark == mark) continue; face_container->mark = mark; // Find point in mesh face FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, face_container->face); } // Check if node is interior if (node->children[0]) { assert(node->children[1]); assert(node->small_faces.IsEmpty()); // Compute distance from query point to split plane RNScalar side = query_position[node->split_dimension] - node->split_coordinate; // Search children nodes if (side <= 0) { // Search negative side first R3Box child_box(node_box); child_box[RN_HI][node->split_dimension] = node->split_coordinate; FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, node->children[0], child_box); if (side*side < max_distance_squared) { R3Box child_box(node_box); child_box[RN_LO][node->split_dimension] = node->split_coordinate; FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, node->children[1], child_box); } } else { // Search positive side first R3Box child_box(node_box); child_box[RN_LO][node->split_dimension] = node->split_coordinate; FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, node->children[1], child_box); if (side*side < max_distance_squared) { R3Box child_box(node_box); child_box[RN_HI][node->split_dimension] = node->split_coordinate; FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, node->children[0], child_box); } } } else { // Check each small face for (int i = 0; i < node->small_faces.NEntries(); i++) { // Get face container and check mark R3MeshSearchTreeFace *face_container = node->small_faces[i]; if (face_container->mark == mark) continue; face_container->mark = mark; // Find point in mesh face FindAll(query_position, query_normal, hits, min_distance_squared, max_distance_squared, IsCompatible, compatible_data, face_container->face); } } }