Missing triangles in icosphere

I am trying to create a Goldberg sphere (sphere with hexagons and pentagons) from an icosphere using Godot 4, but some triangles are not appearing:
The icosahedron
All the vertices exist.

I tried different ways of adding the new vertices to the array new_faces:

  1. All of them at the same time (creating a new array)
  2. One by one, using append
  3. One by one, usingpush_back

I tried coloring differently all the new triangles I create in function subdivide, and it looks like the one I create using the centers of the edges is the one that is missing.

Code:

Icosahedron generation and subdivision

var vertices:PackedVector3Array = []

var faces = []
func generate_icosphere():
    var t = (1.0 + sqrt(5.0)) / 2
    
    vertices.push_back(Vector3(-1, t, 0).normalized())
    vertices.push_back(Vector3(1, t, 0).normalized())
    vertices.push_back(Vector3(-1, -t, 0).normalized())
    vertices.push_back(Vector3(1, -t, 0).normalized())
    vertices.push_back(Vector3(0, -1, t).normalized())
    vertices.push_back(Vector3(0, 1, t).normalized())
    vertices.push_back(Vector3(0, -1, -t).normalized())
    vertices.push_back(Vector3(0, 1, -t).normalized())
    vertices.push_back(Vector3(t, 0, -1).normalized())
    vertices.push_back(Vector3(t, 0, 1).normalized())
    vertices.push_back(Vector3(-t, 0, -1).normalized())
    vertices.push_back(Vector3(-t, 0, 1).normalized())
    
    faces.push_back(Triangle.new(vertices[0], vertices[11], vertices[5]))
    faces.push_back(Triangle.new(vertices[0], vertices[5], vertices[1]))
    faces.push_back(Triangle.new(vertices[0], vertices[1], vertices[7]))
    faces.push_back(Triangle.new(vertices[0], vertices[7], vertices[10]))
    faces.push_back(Triangle.new(vertices[0], vertices[10], vertices[11]))
    faces.push_back(Triangle.new(vertices[1], vertices[5], vertices[9]))
    faces.push_back(Triangle.new(vertices[5], vertices[11], vertices[4]))
    faces.push_back(Triangle.new(vertices[11], vertices[10], vertices[2]))
    faces.push_back(Triangle.new(vertices[10], vertices[7], vertices[6]))
    faces.push_back(Triangle.new(vertices[7], vertices[1], vertices[8]))
    faces.push_back(Triangle.new(vertices[3], vertices[9], vertices[4]))
    faces.push_back(Triangle.new(vertices[3], vertices[4], vertices[2]))
    faces.push_back(Triangle.new(vertices[3], vertices[2], vertices[6]))
    faces.push_back(Triangle.new(vertices[3], vertices[6], vertices[8]))
    faces.push_back(Triangle.new(vertices[3], vertices[8], vertices[9]))
    faces.push_back(Triangle.new(vertices[4], vertices[9], vertices[5]))
    faces.push_back(Triangle.new(vertices[2], vertices[4], vertices[11]))
    faces.push_back(Triangle.new(vertices[6], vertices[2], vertices[10]))
    faces.push_back(Triangle.new(vertices[8], vertices[6], vertices[7]))
    faces.push_back(Triangle.new(vertices[9], vertices[8], vertices[1]))
func subdivide(_radius):
    var new_faces = []
    for face in faces:
        var vert0 = face.vertices[0]
        var vert1 = face.vertices[1]
        var vert2 = face.vertices[2]
        var center0_1:Vector3 = lerp(vert0, vert1, 0.5).normalized()
        var center1_2:Vector3 = lerp(vert1, vert2, 0.5).normalized()
        var center2_0:Vector3 = lerp(vert2, vert0, 0.5).normalized()
        new_faces.push_back(Triangle.new(vert0, center0_1, center2_0))
        new_faces.push_back(Triangle.new(vert1, center0_1, center1_2))
        new_faces.push_back(Triangle.new(vert2, center1_2, center2_0))
        new_faces.push_back(Triangle.new(center0_1, center1_2, center2_0))
        print(face, new_faces)
    return new_faces
func generate(subdivisions,radius):
    generate_icosphere()
    var result_faces:Array = []
    result_faces = subdivide(20)
    return result_faces
class Triangle:
    var vertices:PackedVector3Array = []
    func _init(a, b, c):
        vertices.push_back(a)
        vertices.push_back(b)
        vertices.push_back(c)

Thanks in advance.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật