Beispiel #1
0
def extrude(g2obj, zvals, bbot, btop, bside=None):
    d2 = g2.dims(g2obj)
    nzvals = ct.c_int(len(zvals))
    zvals = list_to_c(zvals, float)
    bbot = list_to_c(supplement(bbot, d2[2]), int)
    btop = list_to_c(supplement(btop, d2[2]), int)
    bside = ct.c_int(bside if bside is not None else -1)
    ret = ct.c_void_p()
    ccall(cport.g3_extrude, g2obj, nzvals, zvals, bbot, btop, bside,
          ct.byref(ret))
    return ret
Beispiel #2
0
def build_tri_grid(verts, nedge, bnds):
    verts = list_to_c(concat(verts), float)
    nedge = ct.c_int(nedge)
    bnds = list_to_c(supplement(bnds, 3), int)
    ret = ct.c_void_p()
    ccall(cport.g2_tri_grid, verts, nedge, bnds, ct.byref(ret))
    return ret
Beispiel #3
0
def build_from_points(pts, force_closed, bnds):
    bnds = list_to_c(supplement(bnds, len(pts)), int)
    force_closed = ct.c_int(force_closed)
    npts = ct.c_int(len(pts))
    pts = list_to_c(concat(pts), float)
    ret = ct.c_void_p()
    ccall(cport.c2_frompoints, npts, pts, bnds, force_closed, ct.byref(ret))
    return ret
Beispiel #4
0
def spline(pts, bnds, nedges):
    bnds = list_to_c(supplement(bnds, len(pts)), int)
    npts = ct.c_int(len(pts))
    pts = list_to_c(concat(pts), float)
    nedges = ct.c_int(nedges)
    ret = ct.c_void_p()
    ccall(cport.c2_spline, npts, pts, nedges, bnds, ct.byref(ret))
    return ret
Beispiel #5
0
def stripe_grid(obj, partition, tipalgo, bnd, cb):
    npartition = ct.c_int(len(partition))
    partition = list_to_c(partition, float)
    bnd = list_to_c(supplement(bnd, 4), int)
    ret = ct.c_void_p()
    ccall_cb(cport.g2_stripe_grid, cb, obj, npartition, partition, tipalgo,
             bnd, ct.byref(ret))
    return ret
Beispiel #6
0
def custom_rectangular_grid(algo, left, bottom, right, top, herw, rinvalid,
                            cb):
    herw = list_to_c(supplement(herw, 4), float)
    rinvalid = ct.c_int(rinvalid)
    ret = ct.c_void_p()
    ccall_cb(cport.g2_custom_rect_grid, cb, algo, left, bottom, right, top,
             herw, rinvalid, ct.byref(ret))
    return ret
Beispiel #7
0
def build_rect_grid(xdata, ydata, bnds):
    nx = ct.c_int(len(xdata))
    xdata = list_to_c(xdata, float)
    ny = ct.c_int(len(ydata))
    ydata = list_to_c(ydata, float)
    bnds = list_to_c(supplement(bnds, 4), 'int')
    ret = ct.c_void_p()
    ccall(cport.g2_rect_grid, nx, xdata, ny, ydata, bnds, ct.byref(ret))
    return ret
Beispiel #8
0
def build_ring_grid(p0, rdata, adata, bnds):
    p0 = list_to_c(p0, float)
    nr = ct.c_int(len(rdata))
    rdata = list_to_c(rdata, float)
    na = ct.c_int(len(adata))
    adata = list_to_c(adata, float)
    bnds = list_to_c(supplement(bnds, 2), int)
    ret = ct.c_void_p()
    ccall(cport.g2_ring_grid, p0, nr, rdata, na, adata, bnds, ct.byref(ret))
    return ret