Exemplo n.º 1
0
// GetVertsWithCond gets all vertices with any of the given conditions
//  "seepH" => localVerts={1,2,3}
func GetVertsWithCond(fconds []*FaceCond, conds ...string) (verts []int) {
	for _, fc := range fconds {
		// check if fc has any of conds
		if utl.StrIndexSmall(conds, fc.Cond) < 0 {
			continue
		}

		// add local verts
		for _, lv := range fc.LocalVerts {
			// check if vert was added already
			if utl.IntIndexSmall(verts, lv) < 0 {
				verts = append(verts, lv) // add a vert
			}
		}
	}

	sort.Ints(verts)
	return
}
Exemplo n.º 2
0
// GetVerts gets all vertices with any of the given conditions
//  Example: "seepH" => localVerts={1,2,3}
func (o FaceConds) GetVerts(conds ...string) (verts []int) {

	// for each face condition
	for _, fc := range o {

		// check if fc has any of conds
		if utl.StrIndexSmall(conds, fc.Cond) < 0 {
			continue
		}

		// add local verts
		for _, lv := range fc.LocalVerts {

			// check if vert was added already
			if utl.IntIndexSmall(verts, lv) < 0 {
				verts = append(verts, lv) // add a vert
			}
		}
	}

	// results
	sort.Ints(verts)
	return
}