the distance between two points of the object , using IFCviewerAPI

Viewed 32

I would like to calculate the distance between two points of the object by clicks. I use IFCviewerAPI.

1 Answers

This solution is for Three.js in general, so it'll work in any Three.js app, including web-ifc-three and web-ifc-viewer (like in your case).

first of all, you shall find the position of both points in the 3D space (x, y, z), let's assume there's two pointA and pointB each has (x, y, z) values

Math.pow(Math.pow( (pointB.x - pointA.x), 2) + Math.pow( (pointB.y - pointA.y),2) + Math.pow( (pointB.z - pointA.z),2), 0.5)

While this solution is super basic, you need to know that you might find issues in performance while scaling this code to multiple points.

Related