Giter VIP home page Giter VIP logo

rtree's People

Contributors

alexvonb avatar evan-dsa avatar geromueller avatar mapret avatar neonit avatar seven332 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtree's Issues

How to get coordinate for a target match?

Is there any way to get the coordinate when we have the match, instead of loop through the whole tree using the iterator?

Also, where can I set the a_searchResult array?

  /// Find all within search rectangle
  /// \param a_min Min of search bounding rect
  /// \param a_max Max of search bounding rect
  /// \param a_searchResult Search result array.  Caller should set grow size. Function will reset, not append to array.
  /// \param a_resultCallback Callback function to return result.  Callback should return 'true' to continue searching
  /// \param a_context User context to pass as parameter to a_resultCallback
  /// \return Returns the number of entries found
  int Search(const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], t_resultCallback a_resultCallback, void* a_context);

Sourcecode is unlicensed

Hello,

The source code is this repository is unlicensed. What terms may I use this source code under?

how to add a point as (x,y) in R tree?

hello,nushoin
i have read your code adn i have a question, you code insert a box when init the Rtree. could i add point as (x,y) in init Rtree and Rtree gennerted automatic ?
Thanks!

Rtree hierarch print

Hi,

How can I print a list of all boxes in an rtree to vizualize the tree hierarchy like the image below (blue boxes)?

image

My current code for neighbour search is this:

	//////////////////////////////////////////////////////////////////////////////
	// Create RTree
	//////////////////////////////////////////////////////////////////////////////

	RTree<int, double, 3> tree;

	//////////////////////////////////////////////////////////////////////////////
	// Insert AABB
	//////////////////////////////////////////////////////////////////////////////

	for (int i = 0; i < elements.size(); i++) {
		double min[3] = { elements[i].aabb.xmin(), elements[i].aabb.ymin(), elements[i].aabb.zmin() };
		double max[3] = { elements[i].aabb.xmax(), elements[i].aabb.ymax(), elements[i].aabb.zmax() };
		tree.Insert(min, max, i);
	}

	//////////////////////////////////////////////////////////////////////////////
	// Search Closest Boxes | Skip duplicates pairs | Perform callback with OBB
	//////////////////////////////////////////////////////////////////////////////
	std::vector<int> result;
	for (int i = 0; i < elements.size(); i++) {//AABB.size()

		//std::vector<int> result;
		auto callback = [&result, i, &elements](int foundValue) -> bool
		{

			if (i < foundValue && cgal_box_util::GetCollision(elements[i].oob, elements[foundValue].oob)) {
				result.push_back(i);
				result.push_back(foundValue);
			}
			return true;
		};

		double min[3] = { elements[i].aabb.xmin(), elements[i].aabb.ymin(), elements[i].aabb.zmin() };
		double max[3] = { elements[i].aabb.xmax(), elements[i].aabb.ymax(), elements[i].aabb.zmax() };
		int nhits = tree.Search(min, max, callback);//callback in this method call callback above

	}

Modify original code to avoid duplicates

Dear @AlexVonB

Thank you for a previous help.
I have one more question.

How can I modify existing code or include into lambda, the check that the id of a box is bigger than searched one?
I want to avoid the second loop below when I collect resultWanted.


        std::vector<int> result;
        auto callback = [&result](int foundValue) -> bool { result.push_back(foundValue); return true; };
        int nhits = tree.Search(min, max, callback);

      std::vector<int> resultWanted;
       for (int j = 0; j < result.size(); j++) {
         if(result[j]>j){
            resultWanted.push_back(result[j]);
            }
        }


Question about rect segement intersections

Hi,
I am a student who is studying R-Tree now.
I wonder if the tree.search() function also supports Box-Segment intersection? So far the input is always a search_rectangle, could I directly input a segment represented by two 3D points, and get all the rectangles intersected with the input segment?

What Foo stands for?

Hi,

In this example, what Foo stands for?

RTree<Foo*, double, 3> tree;
double min[3] = {0., 0., 0.};
double max[3] = {1., 1., 1.};
Foo* bar = new Foo();
tree.Insert(min, max, bar);

Also is there a way to get all collision pairs without duplicates?
Meaning that the pair 0-1 and 1-0 is the same therefore the second one must be ignored.

About long long problem

Hi,

I want to use long long as the data type of my work.
May I ask how to use long long with this library?

Thanks a lot

Problem in TestBadData

Hello, I was trying to make a 3d tree from a file and stepped into this:

rectVector.push_back( Rect( xmin, ymin, xmin + xmax, ymin + ymax ) );

should it be rectVector.push_back( Rect( xmin, ymin, xmax, ymax ) ); ?

About PickSeeds

Hi I found that in PickSeeds function.
It has the situation that there is no seed picked by the function.
Then it causes segmentation fault.
In this situation, should we not to execute Classify on the seeds?

Got an Assertion failed with dimension>16

Hi,

I am using RTree on YearPredictionMSD with dimension=91.

I got an assertion error after 9 vectors inserted:

Assertion `PartitionVars::NOT_TAKEN == a_parVars->m_partition[a_index]' failed.

  const size_t dimension = 91;
  typedef RTree<float, float , dimension, float> MyTree;
  MyTree tree;
  for(int i=0; i < nb; i++)
  {
    tree.Insert(&xb[i * dimension], &xb[i * dimension], i); 
  }

Any idea?

Thanks a lot,
Xinyan

bug

i have inserted some data into the rtree, but when i insert new data, it invoke the bug. how can i send the test code and the data to you? my email is [email protected]. thank you very mush.

doesn't compile in Visual Studio 2019 out of the box

fopen gives some warning when compiling in MSVC compiler.

C4996 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details

easy workaround:

#pragma warning( push )
#pragma warning(disable:4996)
#pragma warning(disable:4244)
#include "RTree.h"
#pragma warning( pop )

also this line:

ELEMTYPEREAL halfExtent = ((ELEMTYPEREAL)a_rect->m_max[index] - (ELEMTYPEREAL)a_rect->m_min[index]) * 0.5f;

gives this warning

C4244 'initializing': conversion from 'float' to 'ELEMTYPEREAL', possible loss of data

it's probably the * 0.5f

But I must say, otherwise, this worked out of the box, in no time! and improved my code from O(n^2) to O(nlogn) and it's a blast.

just warning in RTree.h

Unused variable 'branch'
RTree.h string #898 "Branch branch;"

Probably its just unnecessary string.

Volume calculation of high dimension data set when min == max in real data set.

Hi,
Sorry to disturb you. My data set are some time series. I need to regard each time series as one point to insert RTree. For example:
point 1:{(x1,y1),(x2,y2),(x3,y3),(x4,y4) ,..., (xn,yn)}.
point 2:{(),()....},
point 3.....
I met a situation that some times when min value is equal to max value (y1==y2), the volume calculation is zero.
How to deal with this situation?
Thank you very much.

Warning in PickBranch

There is a warning in Pickbranch:

Variable 'bestArea' may be uninitialized when used here

at line:

else if ((increase == bestIncr) && (area < bestArea))

Best regards
Ben

License?

Hi, can you stick an appropriate license on this code?

As-is, technically it's illegal to actually use this code - a simple BSD license is probably most appropriate.

why does the "Remove" function need to know a_min and a_max?

Hello,
I'm wondering why there is no RemoveId (or whatever the name) function with simple signature

void RemoveId(const DATATYPE& a_dataId);

in addition to the existing

  void Remove(const ELEMTYPE a_min[NUMDIMS], const ELEMTYPE a_max[NUMDIMS], const DATATYPE& a_dataId);

It would just remove all entries with that id which is a feature that seems to be very useful because it is needed for every update.
Instead, one has to know the a_min and a_max of the entry which is a little counter-intuitive because:

  • it is unclear if entries with (smaller | larger | overlapping) bounding box and the same a_dataId will also be removed or strict equality is required,
  • in any case, it relies on floating point comparisons, the necessity of which is unclear to me.

Similarly, a function to update the a_min[NUMDIMS] and a_max[NUMDIMS] of an entry without having to delete it might also be great. Is there any way to do that already?
(By the way, is "entry" synonymous with "leaf"?)
Thanks for answer,
Mathias

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.