Example #1
0
    def __init__(self,
                 width=1,
                 height=1,
                 depth=1,
                 width_segments=1,
                 height_segments=1,
                 depth_segments=1,
                 planes=None,
                 uniform_colour=(0.5, 0.5, 1.0),
                 uniform_opacity=1.0,
                 vertex_colours=None,
                 wireframe=False,
                 wireframe_offset=None):
        vertices, faces, outline = create_box(width, height, depth,
                                              width_segments,
                                              height_segments,
                                              depth_segments,
                                              planes)

        PrimitiveVisual.__init__(
            self,
            vertices['position'],
            outline if wireframe else faces,
            uniform_colour,
            uniform_opacity,
            vertex_colours,
            wireframe,
            wireframe_offset)
Example #2
0
    def __init__(self,
                 width=1,
                 height=1,
                 depth=1,
                 width_segments=1,
                 height_segments=1,
                 depth_segments=1,
                 planes=None,
                 uniform_colour=(0.5, 0.5, 1.0),
                 uniform_opacity=1.0,
                 vertex_colours=None,
                 wireframe=False,
                 wireframe_offset=None):
        vertices, faces, outline = create_box(width, height, depth,
                                              width_segments, height_segments,
                                              depth_segments, planes)

        PrimitiveVisual.__init__(self, vertices['position'], outline
                                 if wireframe else faces, uniform_colour,
                                 uniform_opacity, vertex_colours, wireframe,
                                 wireframe_offset)
def RGB_identity_cube(width_segments=16,
                      height_segments=16,
                      depth_segments=16,
                      planes=None,
                      uniform_colour=None,
                      uniform_opacity=1.0,
                      vertex_colours=True,
                      wireframe=False,
                      *args,
                      **kwargs):
    """
    Creates a *RGB* identity cube base on
    :class:`colour_analysis.visuals.Box` class.

    Parameters
    ----------
    width_segments : int, optional
        Box segments count along the width.
    height_segments : int, optional
        Box segments count along the height.
    depth_segments : int, optional
        Box segments count along the depth.
    planes: array_like, optional
        Any combination of ``{'-x', '+x', '-y', '+y', '-z', '+z'}``

        Included planes in the box construction.
    uniform_colour : array_like, optional
        Uniform mesh colour.
    uniform_opacity : numeric, optional
        Uniform mesh opacity.
    vertex_colours : array_like, optional
        Per vertex varying colour.
    wireframe : bool, optional
        Use wireframe display.

    Other Parameters
    ----------------
    \\*args : list, optional
        Arguments passed to :class:`colour_analysis.visuals.Box` class
        constructor.
    \\**kwargs : dict, optional
        Keywords arguments passed to :class:`colour_analysis.visuals.Box` class
        constructor.
    """

    vertices, _faces, _outline = create_box(width_segments=width_segments,
                                            height_segments=height_segments,
                                            depth_segments=depth_segments,
                                            planes=planes)

    vertex_colours = vertices['color'] if vertex_colours else None

    RGB_box = Box(width_segments=width_segments,
                  height_segments=height_segments,
                  depth_segments=depth_segments,
                  planes=planes,
                  uniform_colour=uniform_colour,
                  uniform_opacity=uniform_opacity,
                  vertex_colours=vertex_colours,
                  wireframe=wireframe,
                  wireframe_offset=(1, 1),
                  *args,
                  **kwargs)

    vertices = RGB_box.mesh_data.get_vertices()
    vertices += 0.5
    RGB_box.mesh_data.set_vertices(vertices)

    return RGB_box
def RGB_identity_cube(width_segments=16,
                      height_segments=16,
                      depth_segments=16,
                      planes=None,
                      uniform_colour=None,
                      uniform_opacity=1.0,
                      vertex_colours=True,
                      wireframe=False,
                      *args,
                      **kwargs):
    """
    Creates a *RGB* identity cube base on
    :class:`colour_analysis.visuals.Box` class.

    Parameters
    ----------
    width_segments : int, optional
        Box segments count along the width.
    height_segments : int, optional
        Box segments count along the height.
    depth_segments : int, optional
        Box segments count along the depth.
    planes: array_like, optional
        Any combination of ``{'-x', '+x', '-y', '+y', '-z', '+z'}``

        Included planes in the box construction.
    uniform_colour : array_like, optional
        Uniform mesh colour.
    uniform_opacity : numeric, optional
        Uniform mesh opacity.
    vertex_colours : array_like, optional
        Per vertex varying colour.
    wireframe : bool, optional
        Use wireframe display.

    Other Parameters
    ----------------
    \\*args : list, optional
        Arguments passed to :class:`colour_analysis.visuals.Box` class
        constructor.
    \\**kwargs : dict, optional
        Keywords arguments passed to :class:`colour_analysis.visuals.Box` class
        constructor.
    """

    vertices, _faces, _outline = create_box(
        width_segments=width_segments,
        height_segments=height_segments,
        depth_segments=depth_segments,
        planes=planes)

    vertex_colours = vertices['color'] if vertex_colours else None

    RGB_box = Box(
        width_segments=width_segments,
        height_segments=height_segments,
        depth_segments=depth_segments,
        planes=planes,
        uniform_colour=uniform_colour,
        uniform_opacity=uniform_opacity,
        vertex_colours=vertex_colours,
        wireframe=wireframe,
        wireframe_offset=(1, 1),
        *args,
        **kwargs)

    vertices = RGB_box.mesh_data.get_vertices()
    vertices += 0.5
    RGB_box.mesh_data.set_vertices(vertices)

    return RGB_box