Exemplo n.º 1
0
def colored_point_cloud(points,
                        colors,
                        matrix=np.eye(4, dtype='f4'),
                        name="pcl"):
    #color = ensure_QColor(color)
    return Actors.Actor(geometry=Geometry.Geometry(
        attribs=CustomAttribs.ColorsAttribs(
            vertices=Array.Array(ndarray=points),
            colors=Array.Array(ndarray=colors)),
        primitive_type=Geometry.PrimitiveType.POINTS),
                        effect=CustomEffects.point_colors(),
                        transform=ensure_Transform(matrix),
                        name=name)
Exemplo n.º 2
0
def axes(size=1, matrix=np.eye(4, dtype='f4'), line_width=1, name="axes"):

    indices = [0, 1, 2, 3, 4, 5]
    vertices = [
        [0, 0, 0]  #0
        ,
        [size, 0, 0]  #1
        ,
        [0, 0, 0]  #2
        ,
        [0, size, 0]  #3
        ,
        [0, 0, 0]  #4
        ,
        [0, 0, size]  #5
    ]
    colors = [
        [1, 0, 0]  #red
        ,
        [1, 0, 0]  #red
        ,
        [0, 1, 0]  #green
        ,
        [0, 1, 0]  #green
        ,
        [0, 0, 1]  #blue
        ,
        [0, 0, 1]  #blue
    ]
    return Actors.Actor(
        geometry=Geometry.Geometry(
            indices=Array.Array(ndarray=np.array(indices, 'u4')),
            attribs=CustomAttribs.ColorsAttribs(
                vertices=Array.Array(ndarray=np.array(vertices, 'f4')),
                colors=Array.Array(ndarray=np.array(colors, 'f4'))),
            primitive_type=Geometry.PrimitiveType.LINES),
        effect=CustomEffects.point_colors(line_width=line_width),
        transform=ensure_Transform(matrix),
        name=name)