Set the vertex indexes that make up triangular faces.

        Parameters
        --------------
        values : (n, 3) int
          Indexes of self.vertices
196124
def faces(self, values):
        
        if values is None:
            values = []
        values = np.asanyarray(values, dtype=np.int64)
        # automatically triangulate quad faces
        if util.is_shape(values, (-1, 4)):
            log.info('triangulating quad faces')
            values = geometry.triangulate_quads(values)
        self._data['faces'] = values
566370
def create_triangular_prism(p1, p2, p3, height):
    '''
    

    '''
    from blmath.geometry import Plane

    base_plane = Plane.from_points(p1, p2, p3)
    lower_base_to_upper_base = height * -base_plane.normal # pylint: disable=invalid-unary-operand-type
    vertices = np.vstack(([p1, p2, p3], [p1, p2, p3] + lower_base_to_upper_base))

    faces = np.array([
        [0, 1, 2],  # base
        [0, 3, 4], [0, 4, 1],  # side 0, 3, 4, 1
        [1, 4, 5], [1, 5, 2],  # side 1, 4, 5, 2
        [2, 5, 3], [2, 3, 0],  # side 2, 5, 3, 0
        [5, 4, 3],  # base
    ])

    return Mesh(v=vertices, f=faces)
201254
def update_positions(self, positions):
        '''
        '''
        sphs_verts = self.sphs_verts_radii.copy()
        sphs_verts += positions.reshape(self.n_spheres, 1, 3)

        self.tr.update_vertices(sphs_verts)
        self.poslist = positions
720582
def resolve_indices(self, index, start_val):
        """"""

        channels = self.vertices[index].meta['channels']
        base_channel = start_val 
        rot_ind = -np.ones(3, dtype=int)
        pos_ind = -np.ones(3, dtype=int)
        for i in range(len(channels)):
            if channels[i]== 'Xrotation':
                rot_ind[0] = base_channel + i
            elif channels[i]=='Yrotation':
                rot_ind[1] = base_channel + i
            elif channels[i]=='Zrotation':
                rot_ind[2] = base_channel + i
            elif channels[i]=='Xposition':
                pos_ind[0] = base_channel + i
            elif channels[i]=='Yposition':
                pos_ind[1] = base_channel + i
            elif channels[i]=='Zposition':
                pos_ind[2] = base_channel + i
        self.vertices[index].meta['rot_ind'] = list(rot_ind)
        self.vertices[index].meta['pos_ind'] = list(pos_ind)
248973
function () {
        if (!this.vertexCount) {
            return;
        }

        var indices = this.indices;
        var attributes = this.attributes;
        var positions = attributes.position.value;
        var normals = attributes.normal.value;

        if (!normals || normals.length !== positions.length) {
            normals = attributes.normal.value = new vendor.Float32Array(positions.length);
        }
        else {
            // Reset
            for (var i = 0; i < normals.length; i++) {
                normals[i] = 0;
            }
        }

        var p1 = vec3Create();
        var p2 = vec3Create();
        var p3 = vec3Create();

        var v21 = vec3Create();
        var v32 = vec3Create();

        var n = vec3Create();

        var len = indices ? indices.length : this.vertexCount;
        var i1, i2, i3;
        for (var f = 0; f < len;) {
            if (indices) {
                i1 = indices[f++];
                i2 = indices[f++];
                i3 = indices[f++];
            }
            else {
                i1 = f++;
                i2 = f++;
                i3 = f++;
            }

            vec3Set$2(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]);
            vec3Set$2(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]);
            vec3Set$2(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]);

            vec3.sub(v21, p1, p2);
            vec3.sub(v32, p2, p3);
            vec3.cross(n, v21, v32);
            // Already be weighted by the triangle area
            for (var i = 0; i < 3; i++) {
                normals[i1*3+i] = normals[i1*3+i] + n[i];
                normals[i2*3+i] = normals[i2*3+i] + n[i];
                normals[i3*3+i] = normals[i3*3+i] + n[i];
            }
        }

        for (var i = 0; i < normals.length;) {
            vec3Set$2(n, normals[i], normals[i+1], normals[i+2]);
            vec3.normalize(n, n);
            normals[i++] = n[0];
            normals[i++] = n[1];
            normals[i++] = n[2];
        }
        this.dirty();
    }
1129262
def identify_vertex_neighbours(self, vertex):
        
        simplices = self.simplices
        ridx, cidx = np.where(simplices == vertex)
        neighbour_array = np.unique(np.hstack([simplices[ridx]])).tolist()
        neighbour_array.remove(vertex)
        return neighbour_array
1303058
def fan_triangulate(indices):
    """"""
    if len(indices[0]) != 4:
        raise ValueError("Assumes working with a sequence of quad indices")
    new_indices = []
    for face in indices:
        new_indices.extend([face[:-1], face[1:]])
    return np.array(new_indices)
1334447
def update_vertices(self, mask):
        
        if self.uv is not None:
            self.uv = self.uv[mask]
745588
def consume_vertices(self):
        
        while True:
            # Vertex color
            if len(self.values) == 7:
                yield (
                    float(self.values[1]),
                    float(self.values[2]),
                    float(self.values[3]),
                    float(self.values[4]),
                    float(self.values[5]),
                    float(self.values[6]),
                )
            # Positions only
            else:
                yield (
                    float(self.values[1]),
                    float(self.values[2]),
                    float(self.values[3]),
                )

            try:
                self.next_line()
            except StopIteration:
                break

            if not self.values:
                break

            if self.values[0] != "v":
                break
61938
def unmerge_vertices(self):
        
        # new faces are incrementing so every vertex is unique
        faces = np.arange(len(self.faces) * 3,
                          dtype=np.int64).reshape((-1, 3))

        # use update_vertices to apply mask to
        # all properties that are per-vertex
        self.update_vertices(self.faces.reshape(-1))
        # set faces to incrementing indexes
        self.faces = faces
        # keep face normals as the haven't changed
        self._cache.clear(exclude=['face_normals'])
1107051
private void triangulateFeatures(List<AssociatedTriple> inliers,
									 DMatrixRMaj P1, DMatrixRMaj P2, DMatrixRMaj P3) {
		List<DMatrixRMaj> cameraMatrices = new ArrayList<>();
		cameraMatrices.add(P1);
		cameraMatrices.add(P2);
		cameraMatrices.add(P3);

		// need elements to be non-empty so that it can use set().  probably over optimization
		List<Point2D_F64> triangObs = new ArrayList<>();
		triangObs.add(null);
		triangObs.add(null);
		triangObs.add(null);

		Point4D_F64 X = new Point4D_F64();
		for (int i = 0; i < inliers.size(); i++) {
			AssociatedTriple t = inliers.get(i);

			triangObs.set(0,t.p1);
			triangObs.set(1,t.p2);
			triangObs.set(2,t.p3);

			// triangulation can fail if all 3 views have the same pixel value. This has been observed in
			// simulated 3D scenes
			if( triangulator.triangulate(triangObs,cameraMatrices,X)) {
				structure.points[i].set(X.x,X.y,X.z,X.w);
			} else {
				throw new RuntimeException("Failed to triangulate a point in the inlier set?! Handle if this is common");
			}
		}
	}
109285
public void rearrangeTriangles(int[] indices) {
        assert indices.length % 3 == 0;
        // Step 1: Make sure that the first index of each triangle is the smallest
        // one (rotate triangle nodes if necessary)
        for (int off = 0; off < indices.length; off += 3) {
            if ((indices[off + 1] < indices[off]) && (indices[off + 1] < indices[off + 2])) {
                int tmp = indices[off];
                indices[off] = indices[off + 1];
                indices[off + 1] = indices[off + 2];
                indices[off + 2] = tmp;
            } else if ((indices[off + 2] < indices[off]) && (indices[off + 2] < indices[off + 1])) {
                int tmp = indices[off];
                indices[off] = indices[off + 2];
                indices[off + 2] = indices[off + 1];
                indices[off + 1] = tmp;
            }
        }

        // Step 2: Sort the triangles based on the first triangle index
        Triangle[] tris = new Triangle[indices.length / 3];
        for (int i = 0; i < tris.length; i++) {
            int off = i * 3;
            tris[i] = new Triangle(indices, off);
        }

        Arrays.sort(tris);

        for (int i = 0; i < tris.length; i++) {
            int off = i * 3;
            tris[i].copyBack(indices, off);
        }
    }
411666
def update_vertices(self, vertices):
        

        vertices = np.array(vertices, dtype=np.float32)
        self._vbo_v.set_data(vertices)
1224472
def keep_vertices(self, indices_to_keep, ret_kept_edges=False):
        '''
        

        '''

        if self.v is None:
            return

        initial_num_verts = self.v.shape[0]
        if self.e is not None:
            initial_num_edges = self.e.shape[0]
            e_indices_to_keep = self.all_edges_with_verts(indices_to_keep, as_boolean=True)

        self.v = self.v[indices_to_keep]
        if self.e is not None:
            v_old_to_new = np.zeros(initial_num_verts, dtype=int)
            e_old_to_new = np.zeros(initial_num_edges, dtype=int)

            v_old_to_new[indices_to_keep] = np.arange(len(indices_to_keep), dtype=int)
            self.e = v_old_to_new[self.e[e_indices_to_keep]]
            e_old_to_new[e_indices_to_keep] = np.arange(self.e.shape[0], dtype=int)
        else:
            e_indices_to_keep = []

        return np.nonzero(e_indices_to_keep)[0] if ret_kept_edges else self
1055228
def setValues(self, values):
        
        ncols = self.getNumCols()
        nindices = self.getNumIndices()
        for key, value in values.items():
            key = Utils.convToList(key)
            assert len(key) == nindices
            value = Utils.convToList(value)
            assert len(value) == ncols-nindices
            self.addRow(key + value)
1262351
def x_indexes(self, indexes):
        
        self._assert_shape(self._data, indexes, self._y_indexes)
        self._x_indexes = indexes
        self.x_index = len(indexes) / 2
1056596
def setShape(self, shape):
        
        for pp in shape:
            if len(pp) != 3:
                raise ValueError('shape point must consist of x,y,z')
        self._shape3D = shape
        self._shape = [(x, y) for x, y, z in shape]