Skip to content

Instantly share code, notes, and snippets.

@SabinT
Created July 9, 2021 17:26
Show Gist options
  • Save SabinT/24f4e7dcd422ffe0997eb5be4ee90aee to your computer and use it in GitHub Desktop.
Save SabinT/24f4e7dcd422ffe0997eb5be4ee90aee to your computer and use it in GitHub Desktop.
Unit equilateral triangle on XY plane, pointy side towards +ve Y axis
# Assuming triangle side, x = 1 unit
# Height of triangle, H = sqrt(x) * x / 2 = 0.866025403784438
# Height of centroid h = x / (2 * sqrt(3)) = 0.288675134594812; 2h = 0.577350269189624
# Lower Right Vertex: (x/2, -h)
v 0.5 -0.288675134594812 0
# Top Vertex: (0, 2h)
v 0 0.577350269189624 0
# Lower Left Vertex (-x/2, -h)
v -0.5 -0.288675134594812 0
# Note: OBJ format uses 1-based indexing, not 0-based
f 1 2 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment