Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Check if an element exist in a vector

$
0
0

@pxt wrote:

Hi!
Im adding elements to a vector

    for(int i = 0; i < lines.size(); i++){
        ofVec4f a = lines.at(i);
        
        for(int e = 0; e < lines.size(); e++){
            if(e!=i){
                ofVec4f b = lines.at(e);
                ofVec2f inter = lineToLineIntersection(a.x, a.y, a.z, a.w, b.x, b.y, b.z, b.w);
                intersectionPoints.push_back(inter);
            }
        }
    }

but i need to check if an element already exist, and if exist so dont add it.

In java exist a funcion : includes() to check it, and in processing i think that is another call hasExist()… there is something similar?

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles