def next(self): ''' returns next element ''' self._i += 1 if (self._i >= self._max): raise StopIteration if (self._as_coords): return dmga2py.cell_get_vertex_coords(self._cell_handle, self._i) else: return CellVertex( self._cell_handle, self._i, dmga2py.cell_get_vertex_coords(self._cell_handle, self._i))
def next(self): ''' returns coordinates of the next vertex as a tuple (x,y,z) ''' index = self._vertices_iterator.next() return dmga2py.cell_get_vertex_coords(self._cell_side._cell_handle, index)
def diagram_part(self): ''' :return: corresponding part of the diagram Returned value is either vertex as model.CellVertex, side as model.CellSide, or edge model.CellEdge ''' (cell_handle, complex_handle) = dmga2py.alpha_shape_cell_as_tuple( self._alpha_shape_cell_handle) (v, j) = (self.vertex, self.edge) if (self.dimension == self.DIM_VERTEX): #we have vertex in Voronoi (tetrahedron in Delaunay) return CellVertex(cell_handle, self.id, dmga2py.cell_get_vertex_coords(cell_handle, v)) if (self.dimension == self.DIM_EDGE): #we have edge in Voronoi (side in Delaunay) return CellEdge(cell_handle, self.id, (v, j), dmga2py.cell_edge_get_inverse(cell_handle, v, j)) if (self.dimension == self.DIM_SIDE): #we have side in Voronoi (edge i Delaunay) side_neighbour = dmga2py.cell_edge_get_neighbour_id( cell_handle, v, j) (u, i) = dmga2py.cell_edge_get_next(cell_handle, v, j) side_id = self.id side = [v] while (u, i) != ( v, j): # this suffice, as we are interested only on this side side.append(u) (u, i) = dmga2py.cell_edge_get_next(cell_handle, u, i) return CellSide(cell_handle, side_id, side_neighbour, side) raise ValueError( "AlphaSimplex.diagram_part(): simplex with dimension " + str(self.dimension))
def second_coords(self): ''' :return: coordinates of the second vertex as a tuple (x,y,z) ''' return dmga2py.cell_get_vertex_coords(self._cell_handle, self._u)
def first_coords(self): ''' :return: coordinates of the first vertex as a tuple (x,y,z) ''' return dmga2py.cell_get_vertex_coords(self._cell_handle, self._v)