Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STL file generated for a simple Polyhedron (L shape) : one face should not be part of the model #49

Open
karimall72 opened this issue Jul 14, 2018 · 3 comments

Comments

@karimall72
Copy link

Hello,

I want to generate a simple polyhedron (L shape) with the following code:

    List<Vector3d> listPoint = new ArrayList<Vector3d>();
    listPoint.add(Vector3d.xyz(0, 10, 0));
    listPoint.add(Vector3d.xyz(2, 10, 0));
    listPoint.add(Vector3d.xyz(2, 5, 0));
    listPoint.add(Vector3d.xyz(10, 5, 0));
    listPoint.add(Vector3d.xyz(10, 0, 0));
    listPoint.add(Vector3d.xyz(0, 0, 0));
    listPoint.add(Vector3d.xyz(0, 10, 20));
    listPoint.add(Vector3d.xyz(2, 10, 20));
    listPoint.add(Vector3d.xyz(2, 5, 20));
    listPoint.add(Vector3d.xyz(10, 5, 20));
    listPoint.add(Vector3d.xyz(10, 0, 20));
    listPoint.add(Vector3d.xyz(0, 0, 20));
    listPoint.add(Vector3d.xyz(4, 5, 20));
    List<List<Integer>> listFace = new ArrayList<List<Integer>>();
    listFace.add(Arrays.asList(0, 1, 2, 3, 4, 5));
    listFace.add(Arrays.asList(8, 7, 6, 11, 10, 9));
    listFace.add(Arrays.asList(1, 0, 6, 7));
    listFace.add(Arrays.asList(2, 1, 7, 8));
    listFace.add(Arrays.asList(3, 2, 8, 9));
    listFace.add(Arrays.asList(4, 3, 9, 10));
    listFace.add(Arrays.asList(5, 4, 10, 11));
    listFace.add(Arrays.asList(0, 5, 11, 6));
    CSG polyhedron = new Polyhedron(listPoint, listFace).toCSG();

The STL generated file for this polyhedron looks like this:

polyhedronwithonebadface

The red triangle should not be there. Otherwise, everything is fine.

Do I misuse the Polyhedron class, or is there an issue in its implementation ? (of course, using the
Extrude.points(...) method would be the right choice in that case, but I need to focus on Polyhedrons).

Regards

@selvakarna
Copy link

How did you get faces for STL forming? how to generate faces from Vertices automatically ?with perfect shape?

@karimall72
Copy link
Author

Thank you for you comment. Can you clarify ? Is your question related to the way I construct the L shape ?
If yes, I am working on a 3D design software, which can save 3D model as "obj" or "stl" file.
So, I just add to take coordinates and faces indices from a generated file to write the provided sample java code.

@selvakarna
Copy link

selvakarna commented May 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants