2

I created a custom mesh. That works so far. Regarding to the face creation I realized it by a switch operation. If I have 4 Vertices (0,1,2),(0,2,3) and so on...

   switch (coordinates_updated.vertices.length) {

        case 5://wall
            geometry.faces.push(
                new THREE.Face3(0, 1, 2),
                new THREE.Face3(0, 2, 3));
            break;
        case 6:
            geometry.faces.push(
                new THREE.Face3(0, 1, 2),// make a triangle
                new THREE.Face3(0, 2, 3),
                new THREE.Face3(0, 3, 4));
            break;
        ...

But now some error occurs for more complex buildings! See the image building My problem is I have for each building different numbers of vertices. I need a kind of method that can create the faces automatically ( no switch operation) and without overlaps.

Can anyone give some advice or tips how to do this? Are there some methods which are handle this kind of problem?

1

1 Answer 1

1

What you're trying to achieve is known as 'Polygon Triangulation'. Here is an overview over the problem and popular algorithms.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.