Exemplo n.º 1
0
def iasetrans(Bi, t):
    from iamat2set import iamat2set
    from iaset2mat import iaset2mat


    x,v=iamat2set(Bi)
    Bo = iaset2mat((x+t,v))
    Bo = Bo.astype(Bi.dtype)

    return Bo
Exemplo n.º 2
0
def iaseline(l=3, theta=0):
    from iaset2mat import iaset2mat
    from iabinary import iabinary

    theta = pi*theta/180
    if abs(tan(theta)) <= 1:
        s  = sign(cos(theta))
        x0 = arange(0, l * cos(theta)-(s*0.5),s)
        x1 = floor(x0 * tan(theta) + 0.5)
    else:
        s  = sign(sin(theta))
        x1 = arange(0, l * sin(theta) - (s*0.5),s)
        x0 = floor(x1 / tan(theta) + 0.5)
    x = transpose(array([x1,x0],int32))
    B = iaset2mat((x,iabinary(ones((x.shape[1],1)))))
    return B
Exemplo n.º 3
0
def iaseline(l=3, theta=0):
    from iaset2mat import iaset2mat
    from iabinary import iabinary

    theta = pi * theta / 180
    if abs(tan(theta)) <= 1:
        s = sign(cos(theta))
        x0 = arange(0, l * cos(theta) - (s * 0.5), s)
        x1 = floor(x0 * tan(theta) + 0.5)
    else:
        s = sign(sin(theta))
        x1 = arange(0, l * sin(theta) - (s * 0.5), s)
        x0 = floor(x1 / tan(theta) + 0.5)
    x = transpose(array([x1, x0], int32))
    B = iaset2mat((x, iabinary(ones((x.shape[1], 1)))))
    return B
Exemplo n.º 4
0
def iaserot(B, theta=45, DIRECTION="CLOCKWISE"):
    from iamat2set import iamat2set
    from iabinary import iabinary
    from iaset2mat import iaset2mat

    DIRECTION = upper(DIRECTION)
    if DIRECTION == "ANTI-CLOCKWISE":
        theta = -theta
    SA = iamat2set(B)
    theta = pi * theta / 180
    (y, v) = SA
    if len(y) == 0: return iabinary([0])
    x0 = y[:, 1] * cos(theta) - y[:, 0] * sin(theta)
    x1 = y[:, 1] * sin(theta) + y[:, 0] * cos(theta)
    x0 = int32((x0 + 0.5) * (x0 >= 0) + (x0 - 0.5) * (x0 < 0))
    x1 = int32((x1 + 0.5) * (x1 >= 0) + (x1 - 0.5) * (x1 < 0))
    x = transpose(array([transpose(x1), transpose(x0)]))
    BROT = iaset2mat((x, v))

    return BROT
Exemplo n.º 5
0
def iaserot(B, theta=45, DIRECTION="CLOCKWISE"):
    from iamat2set import iamat2set
    from iabinary import iabinary
    from iaset2mat import iaset2mat


    DIRECTION = upper(DIRECTION)
    if DIRECTION == "ANTI-CLOCKWISE":
       theta = -theta
    SA = iamat2set(B)
    theta = pi * theta/180
    (y,v)=SA
    if len(y)==0: return iabinary([0])
    x0 = y[:,1] * cos(theta) - y[:,0] * sin(theta)
    x1 = y[:,1] * sin(theta) + y[:,0] * cos(theta)
    x0 = int32((x0 +0.5)*(x0>=0) + (x0-0.5)*(x0<0))
    x1 = int32((x1 +0.5)*(x1>=0) + (x1-0.5)*(x1<0))
    x = transpose(array([transpose(x1),transpose(x0)]))
    BROT = iaset2mat((x,v))

    return BROT