**CIGAL Reference Manual, Chapter 3 (Functions): findvec** ===== Findvec -- Find the vector nearest a specified position ===== **usage: vecnum = findvec(flag,firstvec,vlist,[x,y,z])**\\ **or: vecnum = findvec(flag,firstvec,vlist,[vref])** FINDVEC searches the list of graphics vectors in VLIST to find the stored vector nearest the coordinate position specified by X,Y,Z or the vector, VREF. If the coordinate position (X,Y,Z or VREF) is omitted FINDVEC waits for a coordinate position to be entered with the cursor. If the vector list to search (VLIST) is omitted, FINDVEC will search the default table of stored graphics vectors, VECS. FIRSTVEC is the number of the first vector in VLIST to search (by default, FIRSTVEC is 0). The FLAG argument tells FINDVEC how to go about the search. The default search (FLAG = 0) is to search through the list of stored vectors, find the first vector end point that is within 3 pixels of the reference point or the closest vector if none are within 3 pixels, move the cursor to the coordinates of the found vector, and return the number of the found vector. Specifying the following values for FLAG can modify this default search by: Value Meaning 1 Check only the end points of lists of connected vectors, otherwise all vector positions (MOVE, DRAW, POINT) are checked 2 Find nearest point along drawn vectors by interpolating between end points (cursor is placed at nearest point, and the returned value is the vector number of the end point) 4 Don't stop search at the first vector within 3 pixels of the reference point, check all and return the closest 8 Place the cursor at the coordinate of the found vector 16 Don't search, just place the cursor at the coordinates of stored vector number FIRSTVEC Note: FLAG values 4 or 8 can be combined with either 1 or 2 by addition. **See Also:**\\ [[jvs:cigal:manual:chapter2:sketch|SKETCH(2)]], [[jvs:cigal:manual:chapter1:variables|VARIABLES(1)]], [[jvs:cigal:manual:chapter4:vecs|VECS(4)]], [[jvs:cigal:manual:chapter1:vectors|VECTORS(1)]] [[jvs:cigal|CIGAL Home]], [[jvs:cigal:manual|CIGAL Manual]], [[jvs:cigal:manual:chapter3|Functions List]], [[jvs:cigal:manual:help|Manual Help]]