import { v3_compute_triangle_normal } from "../../../core/geom/3d/triangle/v3_compute_triangle_normal.js";

/**
 *
 * @param {number[]|Float32Array|Float64Array} out
 * @param {number} out_offset
 * @param {number} a
 * @param {number} b
 * @param {number} c
 * @param {number[]|Float32Array} positions
 */
export function geometry_construct_triangle_normal(out, out_offset, a, b, c, positions) {

    const a_address = a * 3;
    const b_address = b * 3;
    const c_address = c * 3;

    const ax = positions[a_address];
    const ay = positions[a_address + 1];
    const az = positions[a_address + 2];

    const bx = positions[b_address];
    const by = positions[b_address + 1];
    const bz = positions[b_address + 2];

    const cx = positions[c_address];
    const cy = positions[c_address + 1];
    const cz = positions[c_address + 2];

    v3_compute_triangle_normal(out, out_offset, ax, ay, az, bx, by, bz, cx, cy, cz);
}