Skip to content

am I using this right? too many triangles #595

@BrannonKing

Description

@BrannonKing

I construct a box with this function:

inline lv::Tree operator&(const lv::Tree &a, const lv::Tree &b) { return lv::max(a, b); }
inline lv::Tree box(const QVector3D &lower, const QVector3D &upper) {
    // Construct the box as the intersection of three axis-aligned slabs
    auto x_slab = ((lower.x() - lv::Tree::X()) & (lv::Tree::X() - upper.x()));
    auto y_slab = ((lower.y() - lv::Tree::Y()) & (lv::Tree::Y() - upper.y()));
    auto z_slab = ((lower.z() - lv::Tree::Z()) & (lv::Tree::Z() - upper.z()));

    // The box is the intersection of all three slabs
    return x_slab & y_slab & z_slab;
}

That gives me a nice, minimal set of triangles if I render it to mesh directly. Then I chop off two corners of my box like this:

        auto cut = m_thickness - Tree::X() + Tree::Z() - CHAMFER_DIM;
        return {shape & (-(cut | reflect_z(cut, length_of_box * 0.5))), true};

Then, after render-to-mesh, I get this many triangles:

Image

I've been using min_feature=0.05, but default settings for the mesh renderer give very similar results. It seems that it could/should be many fewer triangles in that resulting mesh. Also, why does it get weird and go down a little on the end (into the lower board in the image)? Am I using it correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions