Best way to "remove" elements in a vector but keep the space?

Started by
11 comments, last by Waterlimon 11 years, 10 months ago
I use it for an sparse octree so it should be cache friendly. A node currently takes 5 bytes (+4 for parent pointer but i dont think i need that one) + The data carried

So the "structural" space requirement is 5 bytes. Doing it with pointers and new is out of the question, its just way too ugly ans would probably double the node size (might be way more inefficient than that, i think its designed for larger chunks of data)

I could put the objects in a class with a bool to indicate wether it exists or not and fill the array with those. I just dont like wasting a byte for each node.

Ive already made it by using a method to check an objects validity and invalidate one, so ill probably just keep it like that.

o3o

Advertisement
I use it for an sparse octree so it should be cache friendly. A node currently takes 5 bytes (+4 for parent pointer but i dont think i need that one) + The data carried


Pardon my ignorance, but what is a sparse octree? I know what a sparse matrix is, and an octree, but not a sparse octree.

Ive already made it by using a method to check an objects validity and invalidate one, so ill probably just keep it like that.[/quote]
It may be you already have the best solution.

How many objects do you think there will be in the octree?
[size=2]Current project: Ephenation.
[size=2]Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/
Sparse octree is an octree where a subnode may or may not exist. (if it doesnt exist, it means that node and everything that it should contain if it were a regular octree are empty)

I expect to have as many objects as possible. I dont have a goal to how much data i want, but more data at more efficiency will leave more room to mess around with other stuff or have higher detail.

I would use the tree for both large terrain and small objects if i ever get ar enough to implement them.

o3o

This topic is closed to new replies.

Advertisement