removing array elements

Hi there,

I'm trying to remove points from a curve/line acquiring their position and store it in an array only then to able to remove them based on the index.

cheers
fc

Comments

  • malbrechtmalbrecht Fabric for Houdini Posts: 752 ✭✭✭

    Moin, Frederico,

    I am not sure if you are asking a question or just describing what you do - which is fine.

    If you should have meant to ask a question, the way I would interpret your posting is this: Is there a method to remove entries from an array, ideally thread-safe?

    I haven't updated my Fabric installation for quite some time (mainly because most of the game engine integration things are of no interest to me, while the features I was hoping for got delayed). With "my version" there is no such function, you'd have to move entries from the array forward manually.
    Depending on the situation, you could build up an array of "points to be removed from the array" and then, once that array is filled, run the original array from the end, removing points in one go. That might be considerably faster than doing it every time a single point is to be removed.

    However, what I wished for was a double-linked list. I wrote one for some of my projects - the idea is very 1980s: You have a list header that points to the first and the last node in a chain. Each node in the chain (that makes up your "array") has a link to the previous and a link to the next node. Removing nodes therefor simply means updating the previous-link in the next node and the next-link in the previous node, done.
    This obviously only makes sense for array/lists that are to be processed sequentially. If you need indexed access, there's some overhead to create that probably eats up performance advantages of this method.

    Marc


    Marc Albrecht - marc-albrecht.de - does things.

  • Hi Marc,

    thnx for your reply and... yes was a question :smiley:

    the thing is I don't find a function that delete/removes points...

    cheers
    fc

Sign In or Register to comment.