You can map z value to y value like y = - z, do the stuff with offset, then map the result back to XZ plane, where z = -y.
For example:
var points3d = [ // initial points from XZ plane
new THREE.Vector3(0, 0, -1),
new THREE.Vector3(1, 0, -1),
new THREE.Vector3(1, 0, 0)
];
var points2d = points3d.map( p => {return new THREE.Vector2(p.x, -p.z);}); // to XY plane
// do the stuff with OffsetContour
// suppose, you've got points (of THREE.Vector2()) with offset in pointsOffset variable
var result3d = poinsOffset.map( p => {return new THREE.Vector3(p.x, 0, -p.y);}); // now put your offset points back on XZ plane
@prisoner849 that is right i did that but still some time that algorithm give me wrong offset and once i reverse the point it work fine so here my question how i determine that when i have to reverse the point or is there any way to make the points in the correct order.
Accpected output after reversing the shared points
In this algo, one scenerio arise that. Sometime my shift value is so large and also in that case the point for which i am getting a large shift that is incorrect, so it give me that point at a large distance.
Means for an example my square contour, looks like an pentagon sort of.