Modeling the Twin Towers

Hello, so I have a code here, that I’ve been working on with AI, and basically I’ve gotten into a little trouble modeling the famous arches forming at the top of the Twin Towers..
Here’s an attached photo for the base columns and their arches, which appear to be right.

My issue is at the top of the building, it has arches too:

I’m hoping someone good with loops and applying geometry with a pattern could help me solve this.. I need the top arches to look like this, but I’ve made a mess of the loop with AI.
You can view the roof here:
360-degree Panorama from the roof of the New York World Trade Center - World Trade Center (1973–2001) - Wikipedia

Now, here’s my entire function for the Twin Towers, I apologize, as it’s not entirely modeled or accurate, I used AI to build it in THREE:

function buildTwinTower(bldgW, bldgL, coreW, coreL, pColSize, cColSize, towerH, cx, cz, bedrockDepth, f1H, f2H, typH, isNorthTower) {
    const towerGrp = new THREE.Group();
    const chamfer = 117; // The historic exact chamfer geometry (9 ft 9 inches)
    
    // Shared structural layout bounds for perfect vertical alignment
    let fwOuter = bldgW / 2;
    let flOuter = bldgL / 2;
    let pColStartX = cx - fwOuter + chamfer + (pColSize / 2);
    let pColStartZ = cz - flOuter + chamfer + (pColSize / 2);
    let pColSpanX = bldgW - 2 * chamfer - pColSize;
    let pColSpanZ = bldgL - 2 * chamfer - pColSize;

    // Upper column spacing calculated first so we can use it to offset the lobby bases
    let spaceColX = pColSpanX / 58; 
    let spaceColZ = pColSpanZ / 58;

    // Lobby & Crown columns shifted inward by exactly 2 upper column spaces
    let lobbyStartX = pColStartX + (2 * spaceColX);
    let lobbyStartZ = pColStartZ + (2 * spaceColZ);
    let lobbySpanX = pColSpanX - (4 * spaceColX);
    let lobbySpanZ = pColSpanZ - (4 * spaceColZ);
    let lobbySpaceX = lobbySpanX / 18;
    let lobbySpaceZ = lobbySpanZ / 18;

    // Architectural heights for the top crown sections
    let mechGapStart = towerH - (4 * typH);
    let mechGapHeight = 3 * typH;
    let topFloorStart = towerH - typH;

    // ==========================================
    // FOUNDATION: INDIVIDUAL BEDROCK CORE COLUMNS
    // ==========================================
    let fdnCoreGeo = new THREE.BoxGeometry(cColSize * 1.5, bedrockDepth, cColSize * 1.5);
    let footingGeo = new THREE.BoxGeometry(cColSize * 3.5, 48, cColSize * 3.5);
    extraGeoms.push(fdnCoreGeo, footingGeo);
    
    let coreStartX = cx - (coreW / 2) + (cColSize / 2);
    let coreStartZ = cz - (coreL / 2) + (cColSize / 2);
    
    for(let i = 0; i < 5; i++) {
        for(let j = 0; j < 9; j++) {
            let px = coreStartX + i * ((coreW - cColSize) / 4);
            let pz = coreStartZ + j * ((coreL - cColSize) / 8);

            let fdnCol = new THREE.Mesh(fdnCoreGeo, MATS.coreMetal);
            fdnCol.position.set(px, -bedrockDepth/2, pz);
            fdnCol.userData.layer = 'foundation';
            
            let footing = new THREE.Mesh(footingGeo, MATS.concrete);
            footing.position.set(px, -bedrockDepth + 24, pz);
            footing.userData.layer = 'foundation';
            
            towerGrp.add(fdnCol, footing);
        }
    }

    // ==========================================
    // GOTHIC ARCH (TRIDENT) GENERATOR
    // ==========================================
    // Master function to generate both the lobby and the mechanical gap tridents
    const createTridentGeo = (spaceSpan, height, colW, baseW, depth) => {
        let shape = new THREE.Shape();
        
        // Start at bottom left of the wide base
        shape.moveTo(-baseW, 0); 
        
        // Left branch outer sweep going up and out
        shape.bezierCurveTo(-baseW, height * 0.4, -spaceSpan - colW/2, height * 0.6, -spaceSpan - colW/2, height);
        shape.lineTo(-spaceSpan + colW/2, height);
        
        // Left branch inner sweep coming back down to the inner crotch
        shape.bezierCurveTo(-spaceSpan + colW/2, height * 0.6, -colW/2, height * 0.4, -colW/2, height * 0.2);
        
        // Center prong going straight up 
        shape.lineTo(-colW/2, height);
        shape.lineTo(colW/2, height);
        shape.lineTo(colW/2, height * 0.2);
        
        // Right branch inner sweep going up and out
        shape.bezierCurveTo(colW/2, height * 0.4, spaceSpan - colW/2, height * 0.6, spaceSpan - colW/2, height);
        shape.lineTo(spaceSpan + colW/2, height);
        
        // Right branch outer sweep coming back down to the base column
        shape.bezierCurveTo(spaceSpan + colW/2, height * 0.6, baseW, height * 0.4, baseW, 0);
        
        shape.lineTo(-baseW, 0); // Close
        
        let geo = new THREE.ExtrudeGeometry(shape, { depth: depth, bevelEnabled: false });
        geo.translate(0, 0, -depth / 2); // Center perfectly in depth
        return geo;
    };

    // ==========================================
    // UNIFIED BASE & LOBBY PERIMETER COLUMNS
    // ==========================================
    let archH = f1H * 0.45;     // The upper 45% of the lobby height is the branching arch
    let baseColH = f1H * 0.55;  // The lower 55% is the straight massive base column

    let lobbyTridentGeoX = createTridentGeo(spaceColX, archH, pColSize, pColSize * 1.1, pColSize * 1.6);
    let lobbyTridentGeoZ = createTridentGeo(spaceColZ, archH, pColSize, pColSize * 1.1, pColSize * 1.6);

    let fdnLobbyColGeo = new THREE.BoxGeometry(pColSize * 2.5, bedrockDepth, pColSize * 2.5);
    let perimFootingGeo = new THREE.BoxGeometry(pColSize * 5, 48, pColSize * 5);
    let lobbyColGeo = new THREE.BoxGeometry(pColSize * 2.2, baseColH, pColSize * 2.2);
    extraGeoms.push(fdnLobbyColGeo, perimFootingGeo, lobbyColGeo, lobbyTridentGeoX, lobbyTridentGeoZ);

    const addBasePerimeterCol = (px, pz, rotY, isXFace) => {
        let fCol = new THREE.Mesh(fdnLobbyColGeo, MATS.metal);
        fCol.position.set(px, -bedrockDepth/2, pz);
        fCol.rotation.y = rotY;
        fCol.userData.layer = 'foundation';
        
        let pFooting = new THREE.Mesh(perimFootingGeo, MATS.concrete);
        pFooting.position.set(px, -bedrockDepth + 24, pz);
        pFooting.rotation.y = rotY;
        pFooting.userData.layer = 'foundation';
        
        let lCol = new THREE.Mesh(lobbyColGeo, MATS.metal);
        lCol.position.set(px, baseColH / 2, pz);
        lCol.rotation.y = rotY;
        lCol.userData.layer = 'first_floor';
        
        // Add the Gothic Arch pointing UP
        let trGeo = isXFace ? lobbyTridentGeoX : lobbyTridentGeoZ;
        let trident = new THREE.Mesh(trGeo, MATS.metal);
        trident.position.set(px, baseColH, pz);
        trident.rotation.y = rotY;
        trident.userData.layer = 'first_floor';
        
        towerGrp.add(fCol, pFooting, lCol, trident);
    };

    // Base Flat Faces
    for(let i = 0; i <= 18; i++) {
        addBasePerimeterCol(lobbyStartX + i * lobbySpaceX, cz - flOuter + pColSize/2, 0, true); // North Face
        addBasePerimeterCol(lobbyStartX + i * lobbySpaceX, cz + flOuter - pColSize/2, 0, true); // South Face
        addBasePerimeterCol(cx - fwOuter + pColSize/2, lobbyStartZ + i * lobbySpaceZ, Math.PI/2, false); // West Face
        addBasePerimeterCol(cx + fwOuter - pColSize/2, lobbyStartZ + i * lobbySpaceZ, Math.PI/2, false); // East Face
    }

    // ==========================================
    // FACADES (Chamfered Glass)
    // ==========================================
    let glassShape = createChamferedShape(bldgW - pColSize*0.5, bldgL - pColSize*0.5, chamfer - pColSize*0.25, pColSize*0.5);
    let glassGeo = new THREE.ExtrudeGeometry(glassShape, { depth: towerH, bevelEnabled: false }).rotateX(Math.PI/2);
    let glassMesh = new THREE.Mesh(glassGeo, MATS.glass);
    glassMesh.position.set(cx, towerH, cz); 
    glassMesh.userData.layer = 'first_floor';
    towerGrp.add(glassMesh);
    extraGeoms.push(glassGeo);

    // ==========================================
    // FLOORS: CONCRETE SLABS &#038; SPANDREL BANDS
    // ==========================================
    let floorCount = 2 + Math.floor((towerH - f1H - f2H) / typH);
    let plateThick = 2; 

    let floorW = bldgW - (pColSize * 2) - (plateThick * 2);
    let floorL = bldgL - (pColSize * 2) - (plateThick * 2);
    let floorChamfer = chamfer - pColSize - plateThick;
    
    let floorShape = createChamferedShape(floorW, floorL, floorChamfer);
    let cw = coreW / 2; let cl = coreL / 2;
    let coreHole = new THREE.Path();
    coreHole.moveTo(-cw, -cl); coreHole.lineTo(-cw, cl);
    coreHole.lineTo(cw, cl); coreHole.lineTo(cw, -cl);
    floorShape.holes.push(coreHole);

    let slabGeo = new THREE.ExtrudeGeometry(floorShape, { depth: 4, bevelEnabled: false }).rotateX(Math.PI/2);
    
    let spandrelW = bldgW - (pColSize * 2); 
    let spandrelL = bldgL - (pColSize * 2);
    let spandrelChamfer = chamfer - pColSize;
    let spandrelShape = createChamferedShape(spandrelW, spandrelL, spandrelChamfer, plateThick);
    
    let spandrelGeo = new THREE.ExtrudeGeometry(spandrelShape, { depth: 52, bevelEnabled: false }).rotateX(Math.PI/2);
    extraGeoms.push(slabGeo, spandrelGeo);

    let slabInst = new THREE.InstancedMesh(slabGeo, MATS.concrete, floorCount);
    let spandrelInst = new THREE.InstancedMesh(spandrelGeo, MATS.metal, floorCount);

    // ==========================================
    // STEEL FLOOR JOISTS (Mounting to Inner Plate)
    // ==========================================
    let trussLines = [];
    let trussDepth = 33; 
    let tw = bldgW / 2 - pColSize - plateThick; 
    let tl = bldgL / 2 - pColSize - plateThick;
    let tChamfer = chamfer - pColSize - plateThick;

    let trussSpaceX = (tw * 2 - 2 * tChamfer) / 58;
    for(let i = 0; i <= 58; i++) {
        let px = -tw + tChamfer + i * trussSpaceX;
        let zLimit = tl;
        if (px < -tw + tChamfer) zLimit = tl - (tChamfer - (px - (-tw)));
        if (px > tw - tChamfer) zLimit = tl - (tChamfer - (tw - px));    
        
        if (px >= -cw && px <= cw) { 
            trussLines.push(new THREE.Vector3(px, -4, -cl), new THREE.Vector3(px, -4, -zLimit));
            trussLines.push(new THREE.Vector3(px, -4 - trussDepth, -cl), new THREE.Vector3(px, -4 - trussDepth, -zLimit));
            trussLines.push(new THREE.Vector3(px, -4, -cl), new THREE.Vector3(px, -4 - trussDepth, -zLimit));
            
            trussLines.push(new THREE.Vector3(px, -4, cl), new THREE.Vector3(px, -4, zLimit));
            trussLines.push(new THREE.Vector3(px, -4 - trussDepth, cl), new THREE.Vector3(px, -4 - trussDepth, zLimit));
            trussLines.push(new THREE.Vector3(px, -4, cl), new THREE.Vector3(px, -4 - trussDepth, zLimit));
        } else {
            trussLines.push(new THREE.Vector3(px, -4, -zLimit), new THREE.Vector3(px, -4, zLimit));
            trussLines.push(new THREE.Vector3(px, -4 - trussDepth, -zLimit), new THREE.Vector3(px, -4 - trussDepth, zLimit));
            trussLines.push(new THREE.Vector3(px, -4, -zLimit), new THREE.Vector3(px, -4 - trussDepth, zLimit));
        }
    }

    let trussSpaceZ = (tl * 2 - 2 * tChamfer) / 58;
    for(let i = 0; i <= 58; i++) {
        let pz = -tl + tChamfer + i * trussSpaceZ;
        let xLimit = tw;
        if (pz < -tl + tChamfer) xLimit = tw - (tChamfer - (pz - (-tl))); 
        if (pz > tl - tChamfer) xLimit = tw - (tChamfer - (tl - pz));     
        
        if (pz > -cl && pz < cl) {
            trussLines.push(new THREE.Vector3(-cw, -4, pz), new THREE.Vector3(-xLimit, -4, pz));
            trussLines.push(new THREE.Vector3(-cw, -4 - trussDepth, pz), new THREE.Vector3(-xLimit, -4 - trussDepth, pz));
            trussLines.push(new THREE.Vector3(-cw, -4, pz), new THREE.Vector3(-xLimit, -4 - trussDepth, pz));
            
            trussLines.push(new THREE.Vector3(cw, -4, pz), new THREE.Vector3(xLimit, -4, pz));
            trussLines.push(new THREE.Vector3(cw, -4 - trussDepth, pz), new THREE.Vector3(xLimit, -4 - trussDepth, pz));
            trussLines.push(new THREE.Vector3(cw, -4, pz), new THREE.Vector3(xLimit, -4 - trussDepth, pz));
        }
    }

    let floorTrussGeo = new THREE.BufferGeometry().setFromPoints(trussLines);
    extraGeoms.push(floorTrussGeo);
    let baseTrussMesh = new THREE.LineSegments(floorTrussGeo, MATS.joistWire);

    let dummy = new THREE.Object3D();
    for (let i = 0; i < floorCount; i++) {
        let level = i + 1; 
        let yPos = 0;
        if (level === 1) yPos = f1H;
        else if (level === 2) yPos = f1H + f2H;
        else yPos = f1H + f2H + (level - 2) * typH;

        if (yPos > towerH) continue;

        // Leave the top 3 mechanical floors completely empty (no slab, no spandrel, no joist)
        if (yPos > mechGapStart + 1 && yPos < topFloorStart - 1) {
            continue;
        }
        
        dummy.position.set(cx, yPos, cz);
        dummy.updateMatrix();
        slabInst.setMatrixAt(i, dummy.matrix);
        spandrelInst.setMatrixAt(i, dummy.matrix);

        let floorTruss = baseTrussMesh.clone();
        floorTruss.position.set(cx, yPos, cz);
        floorTruss.userData.layer = 'first_floor';
        towerGrp.add(floorTruss);
    }
    slabInst.userData.layer = 'first_floor';
    spandrelInst.userData.layer = 'first_floor';
    towerGrp.add(slabInst, spandrelInst);

    // ==========================================
    // MASSIVE THICK TAPERED CONCRETE ROOF CAP (8 to 4 sides)
    // ==========================================
    let oh = 12;  // Overhangs slightly past the outer columns at base
    let rh = 120; // 120" thick solid concrete 
    let ins = rh; // Tapers inward precisely by the thickness of the topping

    // Base Points: 8-sided Chamfer
    let basePts = [
        [cx + fwOuter + oh - chamfer, towerH, cz - flOuter - oh], // 0: NE top
        [cx + fwOuter + oh, towerH, cz - flOuter - oh + chamfer], // 1: NE right
        [cx + fwOuter + oh, towerH, cz + flOuter + oh - chamfer], // 2: SE right
        [cx + fwOuter + oh - chamfer, towerH, cz + flOuter + oh], // 3: SE bottom
        [cx - fwOuter - oh + chamfer, towerH, cz + flOuter + oh], // 4: SW bottom
        [cx - fwOuter - oh, towerH, cz + flOuter + oh - chamfer], // 5: SW left
        [cx - fwOuter - oh, towerH, cz - flOuter - oh + chamfer], // 6: NW left
        [cx - fwOuter - oh + chamfer, towerH, cz - flOuter - oh]  // 7: NW top
    ];

    // Top Points: 4-sided pure square (Inset by EXACTLY the concrete thickness 'ins' from the outer bounds)
    let topPts = [
        [cx + fwOuter + oh - ins, towerH + rh, cz - flOuter - oh + ins], // 8: NE corner
        [cx + fwOuter + oh - ins, towerH + rh, cz + flOuter + oh - ins], // 9: SE corner
        [cx - fwOuter - oh + ins, towerH + rh, cz + flOuter + oh - ins], // 10: SW corner
        [cx - fwOuter - oh + ins, towerH + rh, cz - flOuter - oh + ins]  // 11: NW corner
    ];

    let roofVerts = [];
    basePts.forEach(p => roofVerts.push(...p));
    topPts.forEach(p => roofVerts.push(...p));
    roofVerts.push(cx, towerH, cz);       // 12 (bottom center)
    roofVerts.push(cx, towerH + rh, cz);  // 13 (top center)

    let roofIndices = [
        // Sides (Counter-Clockwise winding for outward normals)
        0, 8, 1,          // NE Chamfer Triangle
        1, 8, 9,  1, 9, 2,   // East Flat Quad
        2, 9, 3,          // SE Chamfer Triangle
        3, 9, 10, 3, 10, 4,  // South Flat Quad
        4, 10, 5,         // SW Chamfer Triangle
        5, 10, 11, 5, 11, 6, // West Flat Quad
        6, 11, 7,         // NW Chamfer Triangle
        7, 11, 8,  7, 8, 0,  // North Flat Quad
        // Bottom Cap (Facing Down)
        0, 1, 12, 1, 2, 12, 2, 3, 12, 3, 4, 12, 4, 5, 12, 5, 6, 12, 6, 7, 12, 7, 0, 12,
        // Top Cap (Facing Up)
        8, 13, 9, 9, 13, 10, 10, 13, 11, 11, 13, 8
    ];
    
    let thickRoofGeo = new THREE.BufferGeometry();
    thickRoofGeo.setAttribute('position', new THREE.Float32BufferAttribute(roofVerts, 3));
    thickRoofGeo.setIndex(roofIndices);
    thickRoofGeo.computeVertexNormals();
    
    let thickRoofMesh = new THREE.Mesh(thickRoofGeo, MATS.concrete);
    thickRoofMesh.userData.layer = 'first_floor';
    towerGrp.add(thickRoofMesh);
    extraGeoms.push(thickRoofGeo);

    // ==========================================
    // ELEVATOR SHAFTS (Inside the Core)
    // ==========================================
    let elevW = coreW * 0.35;
    let elevL = coreL * 0.25;
    let elevGeo = new THREE.BoxGeometry(elevW, towerH - f1H, elevL);
    extraGeoms.push(elevGeo);

    for (let ix = -1; ix <= 1; ix += 2) {
        for (let iz = -1; iz <= 1; iz += 2) {
            let elevMesh = new THREE.Mesh(elevGeo, MATS.concrete);
            let px = cx + ix * (coreW * 0.22);
            let pz = cz + iz * (coreL * 0.3);
            elevMesh.position.set(px, f1H + (towerH - f1H) / 2, pz);
            elevMesh.userData.layer = 'first_floor';
            towerGrp.add(elevMesh);
        }
    }

    // ==========================================
    // TIERED PERIMETER COLUMNS (Main Standard Body)
    // ==========================================
    // Shrink the standard 3-tier array to fit exactly below the mechanical gap
    let upperTowerH = mechGapStart - f1H;
    let t1H = upperTowerH * 0.33, t2H = upperTowerH * 0.33, t3H = upperTowerH * 0.34;

    let pColGeo1 = new THREE.BoxGeometry(pColSize, t1H, pColSize);
    let pColGeo2 = new THREE.BoxGeometry(pColSize * 0.8, t2H, pColSize * 0.8);
    let pColGeo3 = new THREE.BoxGeometry(pColSize * 0.6, t3H, pColSize * 0.6); // Matches the top
    extraGeoms.push(pColGeo1, pColGeo2, pColGeo3);
    
    const addTaperedCol = (px, pz, rotY = 0) => {
        let col1 = new THREE.Mesh(pColGeo1, MATS.metal); col1.position.set(px, f1H + (t1H / 2), pz); col1.rotation.y = rotY;
        let col2 = new THREE.Mesh(pColGeo2, MATS.metal); col2.position.set(px, f1H + t1H + (t2H / 2), pz); col2.rotation.y = rotY;
        let col3 = new THREE.Mesh(pColGeo3, MATS.metal); col3.position.set(px, f1H + t1H + t2H + (t3H / 2), pz); col3.rotation.y = rotY;

        col1.userData.layer = col2.userData.layer = col3.userData.layer = 'first_floor';
        towerGrp.add(col1, col2, col3);
    };

    // Main Body Flat Faces
    for(let i = 0; i < 59; i++) {
        addTaperedCol(pColStartX + i * spaceColX, cz - flOuter + pColSize/2, 0); // North Face
        addTaperedCol(pColStartX + i * spaceColX, cz + flOuter - pColSize/2, 0); // South Face
        addTaperedCol(cx - fwOuter + pColSize/2, pColStartZ + i * spaceColZ, 0); // West Face
        addTaperedCol(cx + fwOuter - pColSize/2, pColStartZ + i * spaceColZ, 0); // East Face
    }

    // ==========================================
    // MECHANICAL GAP TRIDENTS &#038; COLUMNS
    // ==========================================
    let archH_mech = typH * 1.1; 
    let topTrColW = pColSize * 0.6;
    let mechBaseW = topTrColW * 1.1; 
    let mechTrDepth = pColSize * 0.8;

    let mechTridentGeoX = createTridentGeo(spaceColX, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    let mechTridentGeoZ = createTridentGeo(spaceColZ, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    
    // The straight column connecting the lower downward arch to the upper upward arch
    let mechStraightH = mechGapHeight - (2 * archH_mech);
    let mechColGeo = new THREE.BoxGeometry(mechBaseW * 2, mechStraightH, mechBaseW * 2);
    extraGeoms.push(mechTridentGeoX, mechTridentGeoZ, mechColGeo);
const addMechGapAssembly = (px, pz, rotY, isXFace) => {
    const trGeo = isXFace ? mechTridentGeoX : mechTridentGeoZ;

    // Offset between adjacent columns
    const offset = isXFace ? spaceColX : spaceColZ;
    const dx = isXFace ? offset : 0;
    const dz = isXFace ? 0 : offset;

    // Loop through 5 columns
    for (let i = -2; i <= 2; i++) {
        const currentX = px + dx * i;
        const currentZ = pz + dz * i;

        // =====================================================
        // 1. STRAIGHT COLUMN (Always added)
        // =====================================================
        let col = new THREE.Mesh(mechColGeo, MATS.metal);
        col.position.set(
            currentX,
            mechGapStart + archH_mech + mechStraightH / 2,
            currentZ
        );
        col.rotation.y = rotY;
        col.userData.layer = 'first_floor';
        towerGrp.add(col);

        // =====================================================
        // 2. ARCHES (Only added in between the columns)
        // =====================================================
        // By checking (i > -2 && i < 2), we prevent the arches 
        // from being created at the far left and far right columns,
        // which removes the "overhang" at the ends of the assembly.
        if (i > -2 && i < 2) {
            
            // UPPER ARCH
            let archTop = new THREE.Mesh(trGeo, MATS.metal);
            if (i % 2 !== 0) { archTop.scale.x = -1; }
            archTop.position.set(currentX, topFloorStart - archH_mech, currentZ);
            archTop.rotation.set(0, rotY, 0);
            archTop.userData.layer = 'first_floor';
            towerGrp.add(archTop);

            // LOWER ARCH
            let archBottom = new THREE.Mesh(trGeo, MATS.metal);
            if (i % 2 !== 0) { archBottom.scale.x = -1; }
            archBottom.position.set(currentX, mechGapStart + archH_mech, currentZ);
            archBottom.rotation.set(Math.PI, rotY, 0);
            archBottom.userData.layer = 'first_floor';
            towerGrp.add(archBottom);
        }
    }
};
    for(let i = 0; i <= 18; i++) {
        addMechGapAssembly(lobbyStartX + i * lobbySpaceX, cz - flOuter + pColSize/2, 0, true);         // North Face
        addMechGapAssembly(lobbyStartX + i * lobbySpaceX, cz + flOuter - pColSize/2, 0, true);         // South Face
        addMechGapAssembly(cx - fwOuter + pColSize/2, lobbyStartZ + i * lobbySpaceZ, Math.PI/2, false); // West Face
        addMechGapAssembly(cx + fwOuter - pColSize/2, lobbyStartZ + i * lobbySpaceZ, Math.PI/2, false); // East Face
    }

    // ==========================================
    // TOP FLOOR COLUMNS (Above the Upward Tridents)
    // ==========================================
    let topColGeo = new THREE.BoxGeometry(pColSize * 0.6, typH, pColSize * 0.6);
    extraGeoms.push(topColGeo);

    for(let i = 0; i < 59; i++) {
        let pxN = pColStartX + i * spaceColX, pzN = cz - flOuter + pColSize/2;
        let pxS = pColStartX + i * spaceColX, pzS = cz + flOuter - pColSize/2;
        let pxW = cx - fwOuter + pColSize/2, pzW = pColStartZ + i * spaceColZ;
        let pxE = cx + fwOuter - pColSize/2, pzE = pColStartZ + i * spaceColZ;

        [ [pxN,pzN, 0], [pxS,pzS, 0], [pxW,pzW, Math.PI/2], [pxE,pzE, Math.PI/2] ].forEach(pos => {
            let col = new THREE.Mesh(topColGeo, MATS.metal);
            col.position.set(pos[0], topFloorStart + (typH / 2), pos[1]);
            col.rotation.y = pos[2];
            col.userData.layer = 'first_floor';
            towerGrp.add(col);
        });
    }

    // ==========================================
    // CHAMFER PLATES (2" thick FULL HEIGHT outer plates)
    // ==========================================
    let plateThickOuter = 2;
    let plateW = chamfer * Math.SQRT2; 
    let chamferPlateGeo = new THREE.BoxGeometry(plateW, towerH, plateThickOuter);
    extraGeoms.push(chamferPlateGeo);

    let offsetD = (pColSize / 2) + (plateThickOuter / 2);
    let invSqrt2 = Math.SQRT1_2;

    const addChamferPlate = (mx, mz, normX, normZ, rotY) => {
        let plate = new THREE.Mesh(chamferPlateGeo, MATS.metal);
        let px = mx + offsetD * normX;
        let pz = mz + offsetD * normZ;
        
        plate.position.set(px, towerH / 2, pz);
        plate.rotation.y = rotY;
        plate.userData.layer = 'first_floor';
        towerGrp.add(plate);
    };

    addChamferPlate(cx + fwOuter - chamfer/2 - pColSize/2, cz - flOuter + chamfer/2 + pColSize/2, invSqrt2, -invSqrt2, -Math.PI/4); // NE
    addChamferPlate(cx - fwOuter + chamfer/2 + pColSize/2, cz - flOuter + chamfer/2 + pColSize/2, -invSqrt2, -invSqrt2, Math.PI/4);  // NW
    addChamferPlate(cx + fwOuter - chamfer/2 - pColSize/2, cz + flOuter - chamfer/2 - pColSize/2, invSqrt2, invSqrt2, Math.PI/4);   // SE
    addChamferPlate(cx - fwOuter + chamfer/2 + pColSize/2, cz + flOuter - chamfer/2 - pColSize/2, -invSqrt2, invSqrt2, -Math.PI/4);  // SW

    // ==========================================
    // HAT TRUSS (Extruded Wide Flanges) & MAST
    // ==========================================
    let hatTrussPts = [];
    let hatBase = mechGapStart; // Perfectly spans the new top structural gaps
    
    for(let x = cx - cw; x <= cx + cw; x += cw) {
        hatTrussPts.push(new THREE.Vector3(x, hatBase, cz - cl), new THREE.Vector3(x, towerH, cz - flOuter)); 
        hatTrussPts.push(new THREE.Vector3(x, towerH, cz - cl), new THREE.Vector3(x, hatBase, cz - flOuter));
        hatTrussPts.push(new THREE.Vector3(x, hatBase, cz + cl), new THREE.Vector3(x, towerH, cz + flOuter)); 
        hatTrussPts.push(new THREE.Vector3(x, towerH, cz + cl), new THREE.Vector3(x, hatBase, cz + flOuter));
    }
    for(let z = cz - cl; z <= cz + cl; z += cl) {
        hatTrussPts.push(new THREE.Vector3(cx + cw, hatBase, z), new THREE.Vector3(cx + fwOuter, towerH, z)); 
        hatTrussPts.push(new THREE.Vector3(cx + cw, towerH, z), new THREE.Vector3(cx + fwOuter, hatBase, z));
        hatTrussPts.push(new THREE.Vector3(cx - cw, hatBase, z), new THREE.Vector3(cx - fwOuter, towerH, z)); 
        hatTrussPts.push(new THREE.Vector3(cx - cw, towerH, z), new THREE.Vector3(cx - fwOuter, hatBase, z));
    }

    let wfSize = 24; 
    let flThick = 4;
    let webThick = 4;
    let wfShape = new THREE.Shape();
    wfShape.moveTo(-wfSize/2, -wfSize/2);
    wfShape.lineTo(wfSize/2, -wfSize/2);
    wfShape.lineTo(wfSize/2, -wfSize/2 + flThick);
    wfShape.lineTo(webThick/2, -wfSize/2 + flThick);
    wfShape.lineTo(webThick/2, wfSize/2 - flThick);
    wfShape.lineTo(wfSize/2, wfSize/2 - flThick);
    wfShape.lineTo(wfSize/2, wfSize/2);
    wfShape.lineTo(-wfSize/2, wfSize/2);
    wfShape.lineTo(-wfSize/2, wfSize/2 - flThick);
    wfShape.lineTo(-webThick/2, wfSize/2 - flThick);
    wfShape.lineTo(-webThick/2, -wfSize/2 + flThick);
    wfShape.lineTo(-wfSize/2, -wfSize/2 + flThick);
    wfShape.lineTo(-wfSize/2, -wfSize/2);

    for(let i = 0; i < hatTrussPts.length; i += 2) {
        let p1 = hatTrussPts[i];
        let p2 = hatTrussPts[i+1];
        let path = new THREE.LineCurve3(p1, p2);
        
        let extrudeSettings = { extrudePath: path, steps: 1, bevelEnabled: false };
        let beamGeo = new THREE.ExtrudeGeometry(wfShape, extrudeSettings);
        
        let beamMesh = new THREE.Mesh(beamGeo, MATS.metal); 
        beamMesh.userData.layer = 'first_floor';
        towerGrp.add(beamMesh);
        extraGeoms.push(beamGeo);
    }

    if (isNorthTower) {
        let mastH = 4320; 
        let mastGeo = new THREE.CylinderGeometry(40, 60, mastH, 8);
        let mast = new THREE.Mesh(mastGeo, MATS.coreMetal);
        mast.position.set(cx, towerH + rh + (mastH / 2), cz);
        mast.userData.layer = 'first_floor';
        towerGrp.add(mast);
        extraGeoms.push(mastGeo);
    }

    return towerGrp;
}

The top arches stem from this loop:

const addMechGapAssembly = (px, pz, rotY, isXFace) => {
    const trGeo = isXFace ? mechTridentGeoX : mechTridentGeoZ;

    // Offset between adjacent columns
    const offset = isXFace ? spaceColX : spaceColZ;
    const dx = isXFace ? offset : 0;
    const dz = isXFace ? 0 : offset;

    // Loop through 5 columns
    for (let i = -2; i <= 2; i++) {
        const currentX = px + dx * i;
        const currentZ = pz + dz * i;

        // =====================================================
        // 1. STRAIGHT COLUMN (Always added)
        // =====================================================
        let col = new THREE.Mesh(mechColGeo, MATS.metal);
        col.position.set(
            currentX,
            mechGapStart + archH_mech + mechStraightH / 2,
            currentZ
        );
        col.rotation.y = rotY;
        col.userData.layer = 'first_floor';
        towerGrp.add(col);

        // =====================================================
        // 2. ARCHES (Only added in between the columns)
        // =====================================================
        // By checking (i > -2 && i < 2), we prevent the arches 
        // from being created at the far left and far right columns,
        // which removes the "overhang" at the ends of the assembly.
        if (i > -2 && i < 2) {
            
            // UPPER ARCH
            let archTop = new THREE.Mesh(trGeo, MATS.metal);
            if (i % 2 !== 0) { archTop.scale.x = -1; }
            archTop.position.set(currentX, topFloorStart - archH_mech, currentZ);
            archTop.rotation.set(0, rotY, 0);
            archTop.userData.layer = 'first_floor';
            towerGrp.add(archTop);

            // LOWER ARCH
            let archBottom = new THREE.Mesh(trGeo, MATS.metal);
            if (i % 2 !== 0) { archBottom.scale.x = -1; }
            archBottom.position.set(currentX, mechGapStart + archH_mech, currentZ);
            archBottom.rotation.set(Math.PI, rotY, 0);
            archBottom.userData.layer = 'first_floor';
            towerGrp.add(archBottom);
        }
    }
};

Anyone care to help me fix this so it arrays the arches properly?

For a variety of reasons I tend to avoid debugging AI-generated code. Anyway, you only need to reduce twice the number of arcs. I have marked some arcs in color. On the left is the current layout of arcs, there is one for every vertical beam. On the right arcs are on every second beam. Maybe you need the right layout? If yes, just fix this in the loop where you create these arcs.

Yes, it was creating double the amount of arches.

I figured it was in this loop as I was tinkering with it, but I diagnosed the problem and it’s now fixed..

I also created a ‘half arch’ function as well so it would be able to fix the first and last arch’s orientation.. (they start and end the opposite way as my model)

here’s my attached code:

// ==========================================
    // MECHANICAL GAP TRIDENTS & COLUMNS
    // ==========================================
    let archH_mech = typH * 1.1; 
    let topTrColW = pColSize * 0.6;
    
    // FIXED: The base is now exactly as wide as the prong (2 * baseW = topTrColW)
    let mechBaseW = topTrColW / 2; 
    // FIXED: Depth now exactly matches the column width for a perfectly uniform square thickness
    let mechTrDepth = topTrColW;   

    // 1. Existing Full Trident Generator 
    let mechTridentGeoX = createTridentGeo(spaceColX, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    let mechTridentGeoZ = createTridentGeo(spaceColZ, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    
    // 2. NEW: Half Trident Generator (Splits the arch perfectly in half for the corners)
    const createHalfTridentGeo = (spaceSpan, height, colW, baseW, depth) => {
        let shape = new THREE.Shape();
        shape.moveTo(0, 0); 
        shape.lineTo(0, height);
        shape.lineTo(colW/2, height);
        shape.lineTo(colW/2, height * 0.2);
        shape.bezierCurveTo(colW/2, height * 0.4, spaceSpan - colW/2, height * 0.6, spaceSpan - colW/2, height);
        shape.lineTo(spaceSpan + colW/2, height);
        shape.bezierCurveTo(spaceSpan + colW/2, height * 0.6, baseW, height * 0.4, baseW, 0);
        shape.lineTo(0, 0); 
        
        let geo = new THREE.ExtrudeGeometry(shape, { depth: depth, bevelEnabled: false });
        geo.translate(0, 0, -depth / 2); 
        return geo;
    };

    let mechHalfTridentGeoX = createHalfTridentGeo(spaceColX, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    let mechHalfTridentGeoZ = createHalfTridentGeo(spaceColZ, archH_mech, topTrColW, mechBaseW, mechTrDepth);

    // FIXED: The straight column now spans the ENTIRE mechanical gap height
    let mechColGeo = new THREE.BoxGeometry(topTrColW, mechGapHeight, mechTrDepth);
    extraGeoms.push(mechTridentGeoX, mechTridentGeoZ, mechHalfTridentGeoX, mechHalfTridentGeoZ, mechColGeo);

// Assembly function
    const addMechGapAssembly = (px, pz, rotY, isXFace, colIndex) => {
        const trGeo = isXFace ? mechTridentGeoX : mechTridentGeoZ;
        const halfTrGeo = isXFace ? mechHalfTridentGeoX : mechHalfTridentGeoZ;

        // 1. STRAIGHT COLUMN (Added at every single position, 0 to 58)
        let col = new THREE.Mesh(mechColGeo, MATS.metal);
        
        // Centered in the middle of the entire mechanical gap so it goes all the way up and down
        col.position.set(px, mechGapStart + mechGapHeight / 2, pz);
        col.rotation.y = rotY;
        col.userData.layer = 'first_floor';
        towerGrp.add(col);

        // 2. ARCHES
        // Interior Even Columns (2, 4, 6... 56) get the FULL arch bridging 2 gaps
        if (colIndex > 0 && colIndex < 58) {
            if (colIndex % 2 === 0) {
                let archTop = new THREE.Mesh(trGeo, MATS.metal);
                archTop.position.set(px, topFloorStart - archH_mech, pz);
                archTop.rotation.set(0, rotY, 0);
                archTop.userData.layer = 'first_floor';
                towerGrp.add(archTop);

                let archBottom = new THREE.Mesh(trGeo, MATS.metal);
                archBottom.position.set(px, mechGapStart + archH_mech, pz);
                archBottom.rotation.set(Math.PI, rotY, 0);
                archBottom.userData.layer = 'first_floor';
                towerGrp.add(archBottom);
            }
        }
        // First Column (0) gets the inward-pointing half arch to seal the first gap
        else if (colIndex === 0) {
            let s = isXFace ? 1 : -1; // Points inward
            
            let archTop = new THREE.Mesh(halfTrGeo, MATS.metal);
            archTop.position.set(px, topFloorStart - archH_mech, pz);
            archTop.rotation.set(0, rotY, 0);
            archTop.scale.x = s;
            archTop.userData.layer = 'first_floor';
            towerGrp.add(archTop);

            let archBottom = new THREE.Mesh(halfTrGeo, MATS.metal);
            archBottom.position.set(px, mechGapStart + archH_mech, pz);
            archBottom.rotation.set(Math.PI, rotY, 0);
            
            // FIXED: Accounts for the 3D axis reversal on the East/West faces!
            archBottom.scale.x = isXFace ? s : -s;
            archBottom.userData.layer = 'first_floor';
            towerGrp.add(archBottom);
        }
        // Last Column (58) gets the inward-pointing half arch to seal the last gap
        else if (colIndex === 58) {
            let s = isXFace ? -1 : 1; // Top points inward
            
            let archTop = new THREE.Mesh(halfTrGeo, MATS.metal);
            archTop.position.set(px, topFloorStart - archH_mech, pz);
            archTop.rotation.set(0, rotY, 0);
            archTop.scale.x = s; 
            archTop.userData.layer = 'first_floor';
            towerGrp.add(archTop);

            let archBottom = new THREE.Mesh(halfTrGeo, MATS.metal);
            archBottom.position.set(px, mechGapStart + archH_mech, pz);
            archBottom.rotation.set(Math.PI, rotY, 0);
            
            // FIXED: Accounts for the 3D axis reversal on the East/West faces!
            archBottom.scale.x = isXFace ? s : -s; 
            archBottom.userData.layer = 'first_floor';
            towerGrp.add(archBottom);
        }
    };

    // Call it 59 times using the exact same spacing as the tapered columns
    for(let i = 0; i < 59; i++) {
        addMechGapAssembly(pColStartX + i * spaceColX, cz - flOuter + pColSize/2, 0, true, i);         // North Face
        addMechGapAssembly(pColStartX + i * spaceColX, cz + flOuter - pColSize/2, 0, true, i);         // South Face
        addMechGapAssembly(cx - fwOuter + pColSize/2, pColStartZ + i * spaceColZ, Math.PI/2, false, i); // West Face
        addMechGapAssembly(cx + fwOuter - pColSize/2, pColStartZ + i * spaceColZ, Math.PI/2, false, i); // East Face
    }

I counted 29 complete arches on the photo for the real tower, and in my photo, they should be 29 now too.

Could use someone to double check this to make sure it’s now correct, I’m moving onto the hat trusses now, which are those big crossed beams up at the roof..

Photo of fixed arches at top of tower:

I’ve somewhat fixed the roof to be closer to the real thing, and began working on the hat truss, however I’m hitting some pretty complex geometry.

I have done some modeling to create a simplified version of the hat truss, however you can note clear differences in the outriggers that run from the central columns to the perimeter columns, as they are not properly drawn in my model..

My approach has been to try to keep it simple, and work on each part individually and take it part by part.. I’m having some success, but I’m trying to match it as closely to the original design as possible, and pick the truss up a little more at the center of the inner core columns to make it blend in with the mast for the spire.

A basic model of just the hat truss could go a long way. A model of it by itself.. It’s a pretty complex design, so I’m a little confused as to how to go about actually modeling it, with all this already given, but I am going to make an attempt over the next few days to fix it.. Could use some help laying out a good plan to draw it out with some lines first or something to see what’s going on, or someone to look at it who knows how to actually make it right, as there’s some very peculiar characteristics in the blue model based on what I can see.

Here’s my current hat truss and roof assembly:


I need it to look more like the blue frame pictured in this link:

9-11 Research: The Hat Trusses

Here’s my code for the entire Twin Towers:

function buildTwinTower(bldgW, bldgL, coreW, coreL, pColSize, cColSize, towerH, cx, cz, bedrockDepth, f1H, f2H, typH, isNorthTower) {
    const towerGrp = new THREE.Group();
    const chamfer = 117; // The historic exact chamfer geometry (9 ft 9 inches)
    
    // Shared structural layout bounds for perfect vertical alignment
    let fwOuter = bldgW / 2;
    let flOuter = bldgL / 2;
    let pColStartX = cx - fwOuter + chamfer + (pColSize / 2);
    let pColStartZ = cz - flOuter + chamfer + (pColSize / 2);
    let pColSpanX = bldgW - 2 * chamfer - pColSize;
    let pColSpanZ = bldgL - 2 * chamfer - pColSize;

    // Upper column spacing calculated first so we can use it to offset the lobby bases
    let spaceColX = pColSpanX / 58; 
    let spaceColZ = pColSpanZ / 58;

    // Lobby & Crown columns shifted inward by exactly 2 upper column spaces
    let lobbyStartX = pColStartX + (2 * spaceColX);
    let lobbyStartZ = pColStartZ + (2 * spaceColZ);
    let lobbySpanX = pColSpanX - (4 * spaceColX);
    let lobbySpanZ = pColSpanZ - (4 * spaceColZ);
    let lobbySpaceX = lobbySpanX / 18;
    let lobbySpaceZ = lobbySpanZ / 18;

    // Architectural heights for the top crown sections
    let mechGapStart = towerH - (4 * typH);
    let mechGapHeight = 3 * typH;
    let topFloorStart = towerH - typH;

    // Adjust towerH down one level so the roof rests exactly where the top floor was
    towerH = topFloorStart;

    // ==========================================
    // FOUNDATION: INDIVIDUAL BEDROCK CORE COLUMNS
    // ==========================================
    let fdnCoreGeo = new THREE.BoxGeometry(cColSize * 1.5, bedrockDepth, cColSize * 1.5);
    let footingGeo = new THREE.BoxGeometry(cColSize * 3.5, 48, cColSize * 3.5);
    extraGeoms.push(fdnCoreGeo, footingGeo);
    let rh = 120; // 120" thick solid concrete 
    let coreStartX = cx - (coreW / 2) + (cColSize / 2);
    let coreStartZ = cz - (coreL / 2) + (cColSize / 2);
    
    for(let i = 0; i < 5; i++) {
        for(let j = 0; j < 9; j++) {
            let px = coreStartX + i * ((coreW - cColSize) / 4);
            let pz = coreStartZ + j * ((coreL - cColSize) / 8);

            let fdnCol = new THREE.Mesh(fdnCoreGeo, MATS.coreMetal);
            fdnCol.position.set(px, -bedrockDepth/2, pz);
            fdnCol.userData.layer = 'foundation';
            
            let footing = new THREE.Mesh(footingGeo, MATS.concrete);
            footing.position.set(px, -bedrockDepth + 24, pz);
            footing.userData.layer = 'foundation';
            
            towerGrp.add(fdnCol, footing);
        }
    }

    // ==========================================
    // CORE COLUMNS - FULL HEIGHT
    // ==========================================
    // Core columns terminate beneath the roof framing (towerH)
    let coreColGeo = new THREE.BoxGeometry(
        cColSize * 1.5,
        towerH,
        cColSize * 1.5
    );

    extraGeoms.push(coreColGeo);

    for(let i = 0; i < 5; i++) {
        for(let j = 0; j < 9; j++) {

            let px = coreStartX + i * ((coreW - cColSize) / 4);
            let pz = coreStartZ + j * ((coreL - cColSize) / 8);

            let coreCol = new THREE.Mesh(coreColGeo, MATS.coreMetal);

            // Starts at ground (0) and runs just to the roof slab
            coreCol.position.set(px, towerH / 2, pz);
            coreCol.userData.layer = 'first_floor';

            towerGrp.add(coreCol);
        }
    }

    // ==========================================
    // GOTHIC ARCH (TRIDENT) GENERATOR
    // ==========================================
    // Master function to generate both the lobby and the mechanical gap tridents
    const createTridentGeo = (spaceSpan, height, colW, baseW, depth) => {
        let shape = new THREE.Shape();
        
        // Start at bottom left of the wide base
        shape.moveTo(-baseW, 0); 
        
        // Left branch outer sweep going up and out
        shape.bezierCurveTo(-baseW, height * 0.4, -spaceSpan - colW/2, height * 0.6, -spaceSpan - colW/2, height);
        shape.lineTo(-spaceSpan + colW/2, height);
        
        // Left branch inner sweep coming back down to the inner crotch
        shape.bezierCurveTo(-spaceSpan + colW/2, height * 0.6, -colW/2, height * 0.4, -colW/2, height * 0.2);
        
        // Center prong going straight up 
        shape.lineTo(-colW/2, height);
        shape.lineTo(colW/2, height);
        shape.lineTo(colW/2, height * 0.2);
        
        // Right branch inner sweep going up and out
        shape.bezierCurveTo(colW/2, height * 0.4, spaceSpan - colW/2, height * 0.6, spaceSpan - colW/2, height);
        shape.lineTo(spaceSpan + colW/2, height);
        
        // Right branch outer sweep coming back down to the base column
        shape.bezierCurveTo(spaceSpan + colW/2, height * 0.6, baseW, height * 0.4, baseW, 0);
        
        shape.lineTo(-baseW, 0); // Close
        
        let geo = new THREE.ExtrudeGeometry(shape, { depth: depth, bevelEnabled: false });
        geo.translate(0, 0, -depth / 2); // Center perfectly in depth
        return geo;
    };

    // ==========================================
    // UNIFIED BASE & LOBBY PERIMETER COLUMNS
    // ==========================================
    let archH = f1H * 0.45;     // The upper 45% of the lobby height is the branching arch
    let baseColH = f1H * 0.55;  // The lower 55% is the straight massive base column

    let lobbyTridentGeoX = createTridentGeo(spaceColX, archH, pColSize, pColSize * 1.1, pColSize * 1.6);
    let lobbyTridentGeoZ = createTridentGeo(spaceColZ, archH, pColSize, pColSize * 1.1, pColSize * 1.6);

    let fdnLobbyColGeo = new THREE.BoxGeometry(pColSize * 2.5, bedrockDepth, pColSize * 2.5);
    let perimFootingGeo = new THREE.BoxGeometry(pColSize * 5, 48, pColSize * 5);
    let lobbyColGeo = new THREE.BoxGeometry(pColSize * 2.2, baseColH, pColSize * 2.2);
    extraGeoms.push(fdnLobbyColGeo, perimFootingGeo, lobbyColGeo, lobbyTridentGeoX, lobbyTridentGeoZ);

    const addBasePerimeterCol = (px, pz, rotY, isXFace) => {
        let fCol = new THREE.Mesh(fdnLobbyColGeo, MATS.metal);
        fCol.position.set(px, -bedrockDepth/2, pz);
        fCol.rotation.y = rotY;
        fCol.userData.layer = 'foundation';
        
        let pFooting = new THREE.Mesh(perimFootingGeo, MATS.concrete);
        pFooting.position.set(px, -bedrockDepth + 24, pz);
        pFooting.rotation.y = rotY;
        pFooting.userData.layer = 'foundation';
        
        let lCol = new THREE.Mesh(lobbyColGeo, MATS.metal);
        lCol.position.set(px, baseColH / 2, pz);
        lCol.rotation.y = rotY;
        lCol.userData.layer = 'first_floor';
        
        // Add the Gothic Arch pointing UP
        let trGeo = isXFace ? lobbyTridentGeoX : lobbyTridentGeoZ;
        let trident = new THREE.Mesh(trGeo, MATS.metal);
        trident.position.set(px, baseColH, pz);
        trident.rotation.y = rotY;
        trident.userData.layer = 'first_floor';
        
        towerGrp.add(fCol, pFooting, lCol, trident);
    };

    // Base Flat Faces
    for(let i = 0; i <= 18; i++) {
        addBasePerimeterCol(lobbyStartX + i * lobbySpaceX, cz - flOuter + pColSize/2, 0, true); // North Face
        addBasePerimeterCol(lobbyStartX + i * lobbySpaceX, cz + flOuter - pColSize/2, 0, true); // South Face
        addBasePerimeterCol(cx - fwOuter + pColSize/2, lobbyStartZ + i * lobbySpaceZ, Math.PI/2, false); // West Face
        addBasePerimeterCol(cx + fwOuter - pColSize/2, lobbyStartZ + i * lobbySpaceZ, Math.PI/2, false); // East Face
    }

    // ==========================================
    // FACADES (Chamfered Glass)
    // ==========================================
    let glassShape = createChamferedShape(bldgW - pColSize*0.5, bldgL - pColSize*0.5, chamfer - pColSize*0.25, pColSize*0.5);
    let glassGeo = new THREE.ExtrudeGeometry(glassShape, { depth: towerH, bevelEnabled: false }).rotateX(Math.PI/2);
    let glassMesh = new THREE.Mesh(glassGeo, MATS.glass);
    glassMesh.position.set(cx, towerH, cz); 
    glassMesh.userData.layer = 'first_floor';
    towerGrp.add(glassMesh);
    extraGeoms.push(glassGeo);

    // ==========================================
    // FLOORS: CONCRETE SLABS & SPANDREL BANDS
    // ==========================================
    let floorCount = 2 + Math.floor((towerH - f1H - f2H) / typH);
    let plateThick = 2; 

    let floorW = bldgW - (pColSize * 2) - (plateThick * 2);
    let floorL = bldgL - (pColSize * 2) - (plateThick * 2);
    let floorChamfer = chamfer - pColSize - plateThick;
    
    let floorShape = createChamferedShape(floorW, floorL, floorChamfer);
    let cw = coreW / 2; let cl = coreL / 2;
    let coreHole = new THREE.Path();
    coreHole.moveTo(-cw, -cl); coreHole.lineTo(-cw, cl);
    coreHole.lineTo(cw, cl); coreHole.lineTo(cw, -cl);
    floorShape.holes.push(coreHole);

    let slabGeo = new THREE.ExtrudeGeometry(floorShape, { depth: 4, bevelEnabled: false }).rotateX(Math.PI/2);
    
    let spandrelW = bldgW - (pColSize * 2); 
    let spandrelL = bldgL - (pColSize * 2);
    let spandrelChamfer = chamfer - pColSize;
    let spandrelShape = createChamferedShape(spandrelW, spandrelL, spandrelChamfer, plateThick);
    
    let spandrelGeo = new THREE.ExtrudeGeometry(spandrelShape, { depth: 52, bevelEnabled: false }).rotateX(Math.PI/2);
    extraGeoms.push(slabGeo, spandrelGeo);

    let slabInst = new THREE.InstancedMesh(slabGeo, MATS.concrete, floorCount);
    let spandrelInst = new THREE.InstancedMesh(spandrelGeo, MATS.metal, floorCount);

    // ==========================================
    // STEEL FLOOR JOISTS (Mounting to Inner Plate)
    // ==========================================
    let trussLines = [];
    let trussDepth = 33; 
    let tw = bldgW / 2 - pColSize - plateThick; 
    let tl = bldgL / 2 - pColSize - plateThick;
    let tChamfer = chamfer - pColSize - plateThick;

    let trussSpaceX = (tw * 2 - 2 * tChamfer) / 58;
    for(let i = 0; i <= 58; i++) {
        let px = -tw + tChamfer + i * trussSpaceX;
        let zLimit = tl;
        if (px < -tw + tChamfer) zLimit = tl - (tChamfer - (px - (-tw)));
        if (px > tw - tChamfer) zLimit = tl - (tChamfer - (tw - px));    
        
        if (px >= -cw && px <= cw) { 
            trussLines.push(new THREE.Vector3(px, -4, -cl), new THREE.Vector3(px, -4, -zLimit));
            trussLines.push(new THREE.Vector3(px, -4 - trussDepth, -cl), new THREE.Vector3(px, -4 - trussDepth, -zLimit));
            trussLines.push(new THREE.Vector3(px, -4, -cl), new THREE.Vector3(px, -4 - trussDepth, -zLimit));
            
            trussLines.push(new THREE.Vector3(px, -4, cl), new THREE.Vector3(px, -4, zLimit));
            trussLines.push(new THREE.Vector3(px, -4 - trussDepth, cl), new THREE.Vector3(px, -4 - trussDepth, zLimit));
            trussLines.push(new THREE.Vector3(px, -4, cl), new THREE.Vector3(px, -4 - trussDepth, zLimit));
        } else {
            trussLines.push(new THREE.Vector3(px, -4, -zLimit), new THREE.Vector3(px, -4, zLimit));
            trussLines.push(new THREE.Vector3(px, -4 - trussDepth, -zLimit), new THREE.Vector3(px, -4 - trussDepth, zLimit));
            trussLines.push(new THREE.Vector3(px, -4, -zLimit), new THREE.Vector3(px, -4 - trussDepth, zLimit));
        }
    }

    let trussSpaceZ = (tl * 2 - 2 * tChamfer) / 58;
    for(let i = 0; i <= 58; i++) {
        let pz = -tl + tChamfer + i * trussSpaceZ;
        let xLimit = tw;
        if (pz < -tl + tChamfer) xLimit = tw - (tChamfer - (pz - (-tl))); 
        if (pz > tl - tChamfer) xLimit = tw - (tChamfer - (tl - pz));     
        
        if (pz > -cl && pz < cl) {
            trussLines.push(new THREE.Vector3(-cw, -4, pz), new THREE.Vector3(-xLimit, -4, pz));
            trussLines.push(new THREE.Vector3(-cw, -4 - trussDepth, pz), new THREE.Vector3(-xLimit, -4 - trussDepth, pz));
            trussLines.push(new THREE.Vector3(-cw, -4, pz), new THREE.Vector3(-xLimit, -4 - trussDepth, pz));
            
            trussLines.push(new THREE.Vector3(cw, -4, pz), new THREE.Vector3(xLimit, -4, pz));
            trussLines.push(new THREE.Vector3(cw, -4 - trussDepth, pz), new THREE.Vector3(xLimit, -4 - trussDepth, pz));
            trussLines.push(new THREE.Vector3(cw, -4, pz), new THREE.Vector3(xLimit, -4 - trussDepth, pz));
        }
    }

    let floorTrussGeo = new THREE.BufferGeometry().setFromPoints(trussLines);
    extraGeoms.push(floorTrussGeo);
    let baseTrussMesh = new THREE.LineSegments(floorTrussGeo, MATS.joistWire);

    let dummy = new THREE.Object3D();
    for (let i = 0; i < floorCount; i++) {
        let level = i + 1; 
        let yPos = 0;
        if (level === 1) yPos = f1H;
        else if (level === 2) yPos = f1H + f2H;
        else yPos = f1H + f2H + (level - 2) * typH;

        if (yPos > towerH) continue;

        // Leave the top 3 mechanical floors completely empty (no slab, no spandrel, no joist)
        if (yPos > mechGapStart + 1 && yPos < topFloorStart - 1) {
            continue;
        }
        
        dummy.position.set(cx, yPos, cz);
        dummy.updateMatrix();
        slabInst.setMatrixAt(i, dummy.matrix);
        spandrelInst.setMatrixAt(i, dummy.matrix);

        let floorTruss = baseTrussMesh.clone();
        floorTruss.position.set(cx, yPos, cz);
        floorTruss.userData.layer = 'first_floor';
        towerGrp.add(floorTruss);
    }
    slabInst.userData.layer = 'first_floor';
    spandrelInst.userData.layer = 'first_floor';
    towerGrp.add(slabInst, spandrelInst);
    
    // ==========================================
    // MECHANICAL GAP FIRST FLOOR SPANDREL PLATE
    // ==========================================
    let mechSpandrel = new THREE.Mesh(spandrelGeo, MATS.metal);
    mechSpandrel.position.set(cx, mechGapStart, cz);
    mechSpandrel.userData.layer = 'first_floor';
    towerGrp.add(mechSpandrel);
    
    // ==========================================
    // MASSIVE THICK TAPERED CONCRETE ROOF CAP (8 to 4 sides)
    // ==========================================
    let oh = 12;  // Overhangs slightly past the outer columns at base

    let ins = rh; // Tapers inward precisely by the thickness of the topping

    // Base Points: 8-sided Chamfer
    let basePts = [
        [cx + fwOuter + oh - chamfer, towerH, cz - flOuter - oh], // 0: NE top
        [cx + fwOuter + oh, towerH, cz - flOuter - oh + chamfer], // 1: NE right
        [cx + fwOuter + oh, towerH, cz + flOuter + oh - chamfer], // 2: SE right
        [cx + fwOuter + oh - chamfer, towerH, cz + flOuter + oh], // 3: SE bottom
        [cx - fwOuter - oh + chamfer, towerH, cz + flOuter + oh], // 4: SW bottom
        [cx - fwOuter - oh, towerH, cz + flOuter + oh - chamfer], // 5: SW left
        [cx - fwOuter - oh, towerH, cz - flOuter - oh + chamfer], // 6: NW left
        [cx - fwOuter - oh + chamfer, towerH, cz - flOuter - oh]  // 7: NW top
    ];

    // Top Points: 4-sided pure square (Inset by EXACTLY the concrete thickness 'ins' from the outer bounds)
    let topPts = [
        [cx + fwOuter + oh - ins, towerH + rh, cz - flOuter - oh + ins], // 8: NE corner
        [cx + fwOuter + oh - ins, towerH + rh, cz + flOuter + oh - ins], // 9: SE corner
        [cx - fwOuter - oh + ins, towerH + rh, cz + flOuter + oh - ins], // 10: SW corner
        [cx - fwOuter - oh + ins, towerH + rh, cz - flOuter - oh + ins]  // 11: NW corner
    ];

    let roofVerts = [];
    basePts.forEach(p => roofVerts.push(...p));
    topPts.forEach(p => roofVerts.push(...p));
    roofVerts.push(cx, towerH, cz);       // 12 (bottom center)
    roofVerts.push(cx, towerH + rh, cz);  // 13 (top center)

    let roofIndices = [
        // Sides (Counter-Clockwise winding for outward normals)
        0, 8, 1,          // NE Chamfer Triangle
        1, 8, 9,  1, 9, 2,   // East Flat Quad
        2, 9, 3,          // SE Chamfer Triangle
        3, 9, 10, 3, 10, 4,  // South Flat Quad
        4, 10, 5,         // SW Chamfer Triangle
        5, 10, 11, 5, 11, 6, // West Flat Quad
        6, 11, 7,         // NW Chamfer Triangle
        7, 11, 8,  7, 8, 0,  // North Flat Quad
        // Bottom Cap (Facing Down)
        0, 1, 12, 1, 2, 12, 2, 3, 12, 3, 4, 12, 4, 5, 12, 5, 6, 12, 6, 7, 12, 7, 0, 12,
        // Top Cap (Facing Up)
        8, 13, 9, 9, 13, 10, 10, 13, 11, 11, 13, 8
    ];
    
    let thickRoofGeo = new THREE.BufferGeometry();
    thickRoofGeo.setAttribute('position', new THREE.Float32BufferAttribute(roofVerts, 3));
    thickRoofGeo.setIndex(roofIndices);
    thickRoofGeo.computeVertexNormals();
    
    let thickRoofMesh = new THREE.Mesh(thickRoofGeo, MATS.concrete);
    thickRoofMesh.userData.layer = 'first_floor';
    towerGrp.add(thickRoofMesh);
    extraGeoms.push(thickRoofGeo);

    // ==========================================
    // ELEVATOR SHAFTS (Inside the Core)
    // ==========================================
    let elevW = coreW * 0.35;
    let elevL = coreL * 0.25;
    let elevGeo = new THREE.BoxGeometry(elevW, towerH - f1H, elevL);
    extraGeoms.push(elevGeo);

    for (let ix = -1; ix <= 1; ix += 2) {
        for (let iz = -1; iz <= 1; iz += 2) {
            let elevMesh = new THREE.Mesh(elevGeo, MATS.concrete);
            let px = cx + ix * (coreW * 0.22);
            let pz = cz + iz * (coreL * 0.3);
            elevMesh.position.set(px, f1H + (towerH - f1H) / 2, pz);
            elevMesh.userData.layer = 'first_floor';
            towerGrp.add(elevMesh);
        }
    }

    // ==========================================
    // TIERED PERIMETER COLUMNS (Main Standard Body)
    // ==========================================
    // Shrink the standard 3-tier array to fit exactly below the mechanical gap
    let upperTowerH = mechGapStart - f1H;
    let t1H = upperTowerH * 0.33, t2H = upperTowerH * 0.33, t3H = upperTowerH * 0.34;

    let pColGeo1 = new THREE.BoxGeometry(pColSize, t1H, pColSize);
    let pColGeo2 = new THREE.BoxGeometry(pColSize * 0.8, t2H, pColSize * 0.8);
    let pColGeo3 = new THREE.BoxGeometry(pColSize * 0.6, t3H, pColSize * 0.6); // Matches the top
    extraGeoms.push(pColGeo1, pColGeo2, pColGeo3);
    
    const addTaperedCol = (px, pz, rotY = 0) => {
        let col1 = new THREE.Mesh(pColGeo1, MATS.metal); col1.position.set(px, f1H + (t1H / 2), pz); col1.rotation.y = rotY;
        let col2 = new THREE.Mesh(pColGeo2, MATS.metal); col2.position.set(px, f1H + t1H + (t2H / 2), pz); col2.rotation.y = rotY;
        let col3 = new THREE.Mesh(pColGeo3, MATS.metal); col3.position.set(px, f1H + t1H + t2H + (t3H / 2), pz); col3.rotation.y = rotY;

        col1.userData.layer = col2.userData.layer = col3.userData.layer = 'first_floor';
        towerGrp.add(col1, col2, col3);
    };

    // Main Body Flat Faces
    for(let i = 0; i < 59; i++) {
        addTaperedCol(pColStartX + i * spaceColX, cz - flOuter + pColSize/2, 0); // North Face
        addTaperedCol(pColStartX + i * spaceColX, cz + flOuter - pColSize/2, 0); // South Face
        addTaperedCol(cx - fwOuter + pColSize/2, pColStartZ + i * spaceColZ, 0); // West Face
        addTaperedCol(cx + fwOuter - pColSize/2, pColStartZ + i * spaceColZ, 0); // East Face
    }

    // ==========================================
    // MECHANICAL GAP TRIDENTS & COLUMNS
    // ==========================================
    let archH_mech = typH * 1.1; 
    let topTrColW = pColSize * 0.6;
    
    let mechBaseW = topTrColW / 2; 
    let mechTrDepth = topTrColW;   

    let mechTridentGeoX = createTridentGeo(spaceColX, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    let mechTridentGeoZ = createTridentGeo(spaceColZ, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    
    const createHalfTridentGeo = (spaceSpan, height, colW, baseW, depth) => {
        let shape = new THREE.Shape();
        shape.moveTo(0, 0); 
        shape.lineTo(0, height);
        shape.lineTo(colW/2, height);
        shape.lineTo(colW/2, height * 0.2);
        shape.bezierCurveTo(colW/2, height * 0.4, spaceSpan - colW/2, height * 0.6, spaceSpan - colW/2, height);
        shape.lineTo(spaceSpan + colW/2, height);
        shape.bezierCurveTo(spaceSpan + colW/2, height * 0.6, baseW, height * 0.4, baseW, 0);
        shape.lineTo(0, 0); 
        
        let geo = new THREE.ExtrudeGeometry(shape, { depth: depth, bevelEnabled: false });
        geo.translate(0, 0, -depth / 2); 
        return geo;
    };

    let mechHalfTridentGeoX = createHalfTridentGeo(spaceColX, archH_mech, topTrColW, mechBaseW, mechTrDepth);
    let mechHalfTridentGeoZ = createHalfTridentGeo(spaceColZ, archH_mech, topTrColW, mechBaseW, mechTrDepth);

    let mechColGeo = new THREE.BoxGeometry(topTrColW, mechGapHeight, mechTrDepth);
    extraGeoms.push(mechTridentGeoX, mechTridentGeoZ, mechHalfTridentGeoX, mechHalfTridentGeoZ, mechColGeo);

    const addMechGapAssembly = (px, pz, rotY, isXFace, colIndex) => {
        const trGeo = isXFace ? mechTridentGeoX : mechTridentGeoZ;
        const halfTrGeo = isXFace ? mechHalfTridentGeoX : mechHalfTridentGeoZ;

        let col = new THREE.Mesh(mechColGeo, MATS.metal);
        col.position.set(px, mechGapStart + mechGapHeight / 2, pz);
        col.rotation.y = rotY;
        col.userData.layer = 'first_floor';
        towerGrp.add(col);

        if (colIndex > 0 && colIndex < 58) {
            if (colIndex % 2 === 0) {
                let archTop = new THREE.Mesh(trGeo, MATS.metal);
                archTop.position.set(px, topFloorStart - archH_mech, pz);
                archTop.rotation.set(0, rotY, 0);
                archTop.userData.layer = 'first_floor';
                towerGrp.add(archTop);

                let archBottom = new THREE.Mesh(trGeo, MATS.metal);
                archBottom.position.set(px, mechGapStart + archH_mech, pz);
                archBottom.rotation.set(Math.PI, rotY, 0);
                archBottom.userData.layer = 'first_floor';
                towerGrp.add(archBottom);
            }
        }
        else if (colIndex === 0) {
            let s = isXFace ? 1 : -1;
            let archTop = new THREE.Mesh(halfTrGeo, MATS.metal);
            archTop.position.set(px, topFloorStart - archH_mech, pz);
            archTop.rotation.set(0, rotY, 0);
            archTop.scale.x = s;
            archTop.userData.layer = 'first_floor';
            towerGrp.add(archTop);

            let archBottom = new THREE.Mesh(halfTrGeo, MATS.metal);
            archBottom.position.set(px, mechGapStart + archH_mech, pz);
            archBottom.rotation.set(Math.PI, rotY, 0);
            archBottom.scale.x = isXFace ? s : -s;
            archBottom.userData.layer = 'first_floor';
            towerGrp.add(archBottom);
        }
        else if (colIndex === 58) {
            let s = isXFace ? -1 : 1;
            let archTop = new THREE.Mesh(halfTrGeo, MATS.metal);
            archTop.position.set(px, topFloorStart - archH_mech, pz);
            archTop.rotation.set(0, rotY, 0);
            archTop.scale.x = s; 
            archTop.userData.layer = 'first_floor';
            towerGrp.add(archTop);

            let archBottom = new THREE.Mesh(halfTrGeo, MATS.metal);
            archBottom.position.set(px, mechGapStart + archH_mech, pz);
            archBottom.rotation.set(Math.PI, rotY, 0);
            archBottom.scale.x = isXFace ? s : -s; 
            archBottom.userData.layer = 'first_floor';
            towerGrp.add(archBottom);
        }
    };

    for(let i = 0; i < 59; i++) {
        addMechGapAssembly(pColStartX + i * spaceColX, cz - flOuter + pColSize/2, 0, true, i);
        addMechGapAssembly(pColStartX + i * spaceColX, cz + flOuter - pColSize/2, 0, true, i);
        addMechGapAssembly(cx - fwOuter + pColSize/2, pColStartZ + i * spaceColZ, Math.PI/2, false, i);
        addMechGapAssembly(cx + fwOuter - pColSize/2, pColStartZ + i * spaceColZ, Math.PI/2, false, i);
    }

    // ==========================================
    // CHAMFER PLATES (2" thick FULL HEIGHT outer plates)
    // ==========================================
    let plateThickOuter = 2;
    let plateW = chamfer * Math.SQRT2; 
    let chamferPlateGeo = new THREE.BoxGeometry(plateW, towerH, plateThickOuter);
    extraGeoms.push(chamferPlateGeo);

    let offsetD = (pColSize / 2) + (plateThickOuter / 2);
    let invSqrt2 = Math.SQRT1_2;

    const addChamferPlate = (mx, mz, normX, normZ, rotY) => {
        let plate = new THREE.Mesh(chamferPlateGeo, MATS.metal);
        let px = mx + offsetD * normX;
        let pz = mz + offsetD * normZ;
        
        plate.position.set(px, towerH / 2, pz);
        plate.rotation.y = rotY;
        plate.userData.layer = 'first_floor';
        towerGrp.add(plate);
    };

    addChamferPlate(cx + fwOuter - chamfer/2 - pColSize/2, cz - flOuter + chamfer/2 + pColSize/2, invSqrt2, -invSqrt2, -Math.PI/4);
    addChamferPlate(cx - fwOuter + chamfer/2 + pColSize/2, cz - flOuter + chamfer/2 + pColSize/2, -invSqrt2, -invSqrt2, Math.PI/4);
    addChamferPlate(cx + fwOuter - chamfer/2 - pColSize/2, cz + flOuter - chamfer/2 - pColSize/2, invSqrt2, invSqrt2, Math.PI/4);
    addChamferPlate(cx - fwOuter + chamfer/2 + pColSize/2, cz + flOuter - chamfer/2 - pColSize/2, -invSqrt2, invSqrt2, -Math.PI/4);

    // ==========================================
    // TRUE X-BRACED HAT TRUSS (INNER CORE & RADIALS)
    // ==========================================

    let hatTrussPts = [];

    let hatBottom = mechGapStart;
    let hatTop = towerH - 24; // Just beneath roof framing

    // Inside face of perimeter spandrel plates
    let hatOuterX = fwOuter - pColSize - plateThick;
    let hatOuterZ = flOuter - pColSize - plateThick;

    // Generate arrays mapping every single core column exact coordinate
    let cPx = [];
    for(let i=0; i<5; i++) cPx.push(coreStartX + i * ((coreW - cColSize) / 4));
    let cPz = [];
    for(let j=0; j<9; j++) cPz.push(coreStartZ + j * ((coreL - cColSize) / 8));

    // 1. CORE HAT BRACING: Bind all 47 internal columns together with chords & X-Bracing
    // X-Axis Core Connections
    for(let j=0; j<9; j++) {
        for(let i=0; i<4; i++) {
            let x1 = cPx[i], x2 = cPx[i+1], z = cPz[j];
            hatTrussPts.push(
                new THREE.Vector3(x1, hatTop, z), new THREE.Vector3(x2, hatTop, z), // Top Chord
                new THREE.Vector3(x1, hatBottom, z), new THREE.Vector3(x2, hatBottom, z), // Bottom Chord
                new THREE.Vector3(x1, hatBottom, z), new THREE.Vector3(x2, hatTop, z), // X-Diag 1
                new THREE.Vector3(x1, hatTop, z), new THREE.Vector3(x2, hatBottom, z)  // X-Diag 2
            );
        }
    }
    // Z-Axis Core Connections
    for(let i=0; i<5; i++) {
        for(let j=0; j<8; j++) {
            let x = cPx[i], z1 = cPz[j], z2 = cPz[j+1];
            hatTrussPts.push(
                new THREE.Vector3(x, hatTop, z1), new THREE.Vector3(x, hatTop, z2), // Top Chord
                new THREE.Vector3(x, hatBottom, z1), new THREE.Vector3(x, hatBottom, z2), // Bottom Chord
                new THREE.Vector3(x, hatBottom, z1), new THREE.Vector3(x, hatTop, z2), // X-Diag 1
                new THREE.Vector3(x, hatTop, z1), new THREE.Vector3(x, hatBottom, z2)  // X-Diag 2
            );
        }
    }

    // 2. RADIAL TRUSSES: Core perimeter columns outwards to building perimeter
    // North Face (j = 0)
    for(let i=0; i<5; i++) {
        let x = cPx[i], z = cPz[0], pZ = cz - hatOuterZ;
        hatTrussPts.push(
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(x, hatTop, pZ), // Top Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(x, hatBottom, pZ), // Bottom Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(x, hatTop, pZ), // X-Diag 1
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(x, hatBottom, pZ)  // X-Diag 2
        );
    }
    // South Face (j = 8)
    for(let i=0; i<5; i++) {
        let x = cPx[i], z = cPz[8], pZ = cz + hatOuterZ;
        hatTrussPts.push(
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(x, hatTop, pZ), // Top Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(x, hatBottom, pZ), // Bottom Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(x, hatTop, pZ), // X-Diag 1
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(x, hatBottom, pZ)  // X-Diag 2
        );
    }
    // West Face (i = 0)
    for(let j=0; j<9; j++) {
        let x = cPx[0], z = cPz[j], pX = cx - hatOuterX;
        hatTrussPts.push(
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(pX, hatTop, z), // Top Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(pX, hatBottom, z), // Bottom Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(pX, hatTop, z), // X-Diag 1
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(pX, hatBottom, z)  // X-Diag 2
        );
    }
    // East Face (i = 4)
    for(let j=0; j<9; j++) {
        let x = cPx[4], z = cPz[j], pX = cx + hatOuterX;
        hatTrussPts.push(
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(pX, hatTop, z), // Top Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(pX, hatBottom, z), // Bottom Chord
            new THREE.Vector3(x, hatBottom, z), new THREE.Vector3(pX, hatTop, z), // X-Diag 1
            new THREE.Vector3(x, hatTop, z), new THREE.Vector3(pX, hatBottom, z)  // X-Diag 2
        );
    }

    // ==========================================
    // WIDE FLANGE PROFILE
    // ==========================================
    let wfSize = 24; 
    let flThick = 4;
    let webThick = 4;

    let wfShape = new THREE.Shape();
    wfShape.moveTo(-wfSize/2,-wfSize/2);
    wfShape.lineTo(wfSize/2,-wfSize/2);
    wfShape.lineTo(wfSize/2,-wfSize/2+flThick);
    wfShape.lineTo(webThick/2,-wfSize/2+flThick);
    wfShape.lineTo(webThick/2,wfSize/2-flThick);
    wfShape.lineTo(wfSize/2,wfSize/2-flThick);
    wfShape.lineTo(wfSize/2,wfSize/2);
    wfShape.lineTo(-wfSize/2,wfSize/2);
    wfShape.lineTo(-wfSize/2,wfSize/2-flThick);
    wfShape.lineTo(-webThick/2,wfSize/2-flThick);
    wfShape.lineTo(-webThick/2,-wfSize/2+flThick);
    wfShape.lineTo(-wfSize/2,-wfSize/2+flThick);
    wfShape.closePath();

    // ==========================================
    // CREATE MEMBERS (Instanced Geometry Fix)
    // ==========================================
    // Generate ONE single beam geometry perfectly aligned along the Z axis 
    let baseBeamGeo = new THREE.ExtrudeGeometry(wfShape, { depth: 1, bevelEnabled: false });
    baseBeamGeo.translate(0, 0, -0.5); // Center the origin so scaling distorts it evenly
    extraGeoms.push(baseBeamGeo);

    for (let i = 0; i < hatTrussPts.length; i += 2) {
        let p1 = hatTrussPts[i];
        let p2 = hatTrussPts[i + 1];

        let dist = p1.distanceTo(p2);
        let mid = new THREE.Vector3().addVectors(p1, p2).multiplyScalar(0.5);

        let beamMesh = new THREE.Mesh(baseBeamGeo, MATS.metal);
        
        // Position at midpoint
        beamMesh.position.copy(mid);
        
        // Point the geometry at the target node (locking the Y-axis upward mathematically)
        beamMesh.lookAt(p2);
        
        // Scale the Z depth out to exactly reach both nodes
        beamMesh.scale.set(1, 1, dist);
        
        beamMesh.userData.layer = 'first_floor';
        towerGrp.add(beamMesh);
    }

    // ==========================================
    // NORTH TOWER ROOF ANTENNA MAST & SPIRE
    // ==========================================
    if (isNorthTower) {
        let roofTop = towerH + rh;
        
        // Heavy lattice base representation
        let mBaseW = bldgW * 0.15;
        let mBaseH = typH * 3;
        let mBaseGeo = new THREE.BoxGeometry(mBaseW, mBaseH, mBaseW);
        let mBase = new THREE.Mesh(mBaseGeo, MATS.metal);
        mBase.position.set(cx, roofTop + mBaseH / 2, cz);
        mBase.userData.layer = 'first_floor';
        towerGrp.add(mBase);
        extraGeoms.push(mBaseGeo);

        // Main structural mast cylinder
        let mCylH = typH * 15;
        let mCylR = mBaseW * 0.35;
        let mCylGeo = new THREE.CylinderGeometry(mCylR * 0.6, mCylR, mCylH, 16);
        let mCyl = new THREE.Mesh(mCylGeo, MATS.metal);
        mCyl.position.set(cx, roofTop + mBaseH + mCylH / 2, cz);
        mCyl.userData.layer = 'first_floor';
        towerGrp.add(mCyl);
        extraGeoms.push(mCylGeo);

        // Thin top spire
        let mSpireH = typH * 12;
        let mSpireR = mCylR * 0.3;
        let mSpireGeo = new THREE.CylinderGeometry(mSpireR * 0.1, mSpireR, mSpireH, 8);
        let mSpire = new THREE.Mesh(mSpireGeo, MATS.metal);
        mSpire.position.set(cx, roofTop + mBaseH + mCylH + mSpireH / 2, cz);
        mSpire.userData.layer = 'first_floor';
        towerGrp.add(mSpire);
        extraGeoms.push(mSpireGeo);

        // Lower transmission ring array
        let ringGeo1 = new THREE.CylinderGeometry(mCylR * 1.5, mCylR * 1.5, 12, 16);
        let ring1 = new THREE.Mesh(ringGeo1, MATS.metal);
        ring1.position.set(cx, roofTop + mBaseH + mCylH * 0.3, cz);
        ring1.userData.layer = 'first_floor';
        towerGrp.add(ring1);
        extraGeoms.push(ringGeo1);

        // Upper transmission ring array
        let ringGeo2 = new THREE.CylinderGeometry(mCylR * 1.2, mCylR * 1.2, 12, 16);
        let ring2 = new THREE.Mesh(ringGeo2, MATS.metal);
        ring2.position.set(cx, roofTop + mBaseH + mCylH * 0.7, cz);
        ring2.userData.layer = 'first_floor';
        towerGrp.add(ring2);
        extraGeoms.push(ringGeo2);
    }

    return towerGrp;
}