Skip to content

[CSG]: Non-touching unions fail to retain some colours #227

Closed
@Cloud7050

Description

@Cloud7050

CSG currently patches the JSCAD modeling library in order to retain colour data between operations. If I recall correctly, the unmodified library resets colours to its default shade of blue after each operation.

With the patch applied, the union of two Shapes in CSG normally retains their various colours. However, the patch does not cover all cases.

If non-touching Shapes are unioned, one of them reverts to the default blue.

Snippet to reproduce issue:

import {
    silver, crimson, black,
    cube, cone, sphere,
    intersect, union, scale, translate,
    render_grid_axes
} from "csg";

const base = intersect(
    scale(cube(silver), 1, 1, 0.3),
    scale(cone(crimson), 1, 1, 3)
);
const snowglobe = union(
    translate(sphere(black), 0, 0, 0.5),
    base
);
render_grid_axes(snowglobe);

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug[Category]minor[Priority]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions