Facet Data Issue

I figured out how to get the vertices that make up a facet:

let index = mesh.getClosestFacetAtCoordinates(x, y, z);
let facetPosition = BABYLON.Vector3.Zero();
mesh.getFacetPositionToRef(index, facetPosition);

let positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
let indices = mesh.getIndices();

let v1x = indices[index * 3] * 3;
let v1y = v1x + 1;
let v1z = v1x + 2;

let v2x = indices[index * 3 + 1] * 3;
let v2y = v2x + 1;
let v2z = v2x + 2;

let v3x = indices[index * 3 + 2] * 3;
let v3y = v3x + 1;
let v3z = v3x + 2;

let vert1 = BABYLON.Vector3.Zero();
let vert2 = BABYLON.Vector3.Zero();
let vert3 = BABYLON.Vector3.Zero();

vert1.x = positions[v1x];
vert1.y = positions[v1y];
vert1.z = positions[v1z];

vert2.x = positions[v2x];
vert2.y = positions[v2y];
vert2.z = positions[v2z];

vert3.x = positions[v3x];
vert3.y = positions[v3y];
vert3.z = positions[v3z];

let wm = mesh.getWorldMatrix();
BABYLON.Vector3.TransformCoordinatesToRef(vert1, wm, vert1);
BABYLON.Vector3.TransformCoordinatesToRef(vert2, wm, vert2);
BABYLON.Vector3.TransformCoordinatesToRef(vert3, wm, vert3);

//check facet position
let fpx = (vert1.x + vert2.x + vert3.x)/3;
let fpy = (vert1.y + vert2.y + vert3.y)/3;
let fpz = (vert1.z + vert2.z + vert3.z)/3;
	
if(facetPosition.x != fpx || facetPosition.y != fpy || facetPosition.z != fpz){
    //something went wrong
}