From a9797f87db4b946b09a8f2b247255fcb8493032a Mon Sep 17 00:00:00 2001 From: 8-prime Date: Tue, 14 Jan 2025 13:14:28 +0100 Subject: [PATCH] Fix vertex ordering --- stl/geometry/shapes.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stl/geometry/shapes.go b/stl/geometry/shapes.go index 53e6a6c..cbe5958 100644 --- a/stl/geometry/shapes.go +++ b/stl/geometry/shapes.go @@ -71,12 +71,12 @@ func createBox(x, y, z, width, height, depth float64) ([]types.Triangle, error) vertices := make([]types.Point3D, 8) // Pre-allocate vertices array quads := [6][4]int{ - {0, 1, 2, 3}, // front - {5, 4, 7, 6}, // back - {4, 0, 3, 7}, // left - {1, 5, 6, 2}, // right - {3, 2, 6, 7}, // top - {4, 5, 1, 0}, // bottom + {0, 3, 2, 1}, // front (viewed from front) + {5, 6, 7, 4}, // back (viewed from back) + {4, 7, 3, 0}, // left (viewed from left) + {1, 2, 6, 5}, // right (viewed from right) + {3, 7, 6, 2}, // top (viewed from top) + {4, 0, 1, 5}, // bottom (viewed from bottom) } // Fill vertices array