Retrieving indices of entries with the same symbol using coll object

Pannavich Weswibul's icon

I am currently linking lcd object with coll object to store all of the x and y data of my drawings. I have used combine object to convert the x y value into unique symbol and store them with respective index given to each entry. My goal is to retrieve the x y position of the crossing point in my drawing shape, which could be done by detecting duplication of the symbol stored in coll. However, I could not find any solution on getting that data out yet.

Here is the patch which I am currently working on:

Max Patch
Copy patch and select New From Clipboard in Max.

If my explanation is not clear please let me know and I will try my best to explain it again.

Source Audio's icon

merge data into another coll, and dump it through zl.len

if length > 1 then you have duplicates

Source Audio's icon

had a look at that patch.

I don't understand how you capture into coll when you clear it on mouse release ?

makes no sense.

here is modified patch to show you how to collect data,

dump it into another coll and display duplicates if any

Max Patch
Copy patch and select New From Clipboard in Max.

Pannavich Weswibul's icon

Thank you so much! Your patch is a huge help.

I linked the first inlet of lcd with a bang and have it store the x y data everytime there is a position update while my mouse is clicking. The main reason why I did it this way is because I wanted the duplicate detection to be spontanious with the drawing that I make, ie. trigger sound everytime the line cross.

The problem that I have right now is linking the duplication detection with my own location capture. It seem to repititively bang the coll into the checking system which, given how it updates everytime the location change, is overloading the checking system (because the updated list still contains data from the previous iteration). I will try to find a way to filter out the old data making it check the correct information.

Source Audio's icon

if you want to bang if current xy value

allready exists in coll, why not use it as index

and first lookup if it exists, bang if it does,

store it if it doesn‘t ?

Pannavich Weswibul's icon

I don’t think I am familiar with using lookup enough. How would I go about doing that?

Sorry for bothering you again.

(edit) I just got what you meant, I'm getting back on it right now and will update later

Pannavich Weswibul's icon

Update: I managed to change the index to xy value but I’m still not quite sure how to use lookup to see if the index exists. Could zl.lookup look into coll?

Source Audio's icon

if you recall it first it will output if it exists,

if not, store it.

Max Patch
Copy patch and select New From Clipboard in Max.

That is easy, but what I am not sure about is

the fact that mouse and GUI objects do not

trigger all values when you paint a line in LCD.

when you make a line it looks as if it has all painted

pixels uninterrupted, but that is not so.

you might cross a line several times without hitting existing

point.

Pannavich Weswibul's icon

Oh my god you actually done it. The code is super simple as well.

Thank you so much for this

(edit) I have just understood what you meant in the later sentence a little bit afterwards and have completely removed the fade out function. Thank you for the heads up as well TT