Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting coordinates after setting position of pointcloud to (0, 0, 0) #660

Open
Justin-Akridge opened this issue Jun 29, 2024 · 0 comments

Comments

@Justin-Akridge
Copy link

Justin-Akridge commented Jun 29, 2024

I am trying to add in objects that were taken out of aerial lidar data so the coordinates are very high. I have to set the position of the pointcloud to zero in order to prevent the objects from flickering back forth (I assume is caused by arithmetic issues with large floating point numbers).

How can I convert the location of the objects in the load_poles function to match the new x, y, and z? The coordinates below represent the same location of a pole in the potree viewer before and after the conversion caused by setting the position of the pointcloud to (0,0,0).

//583,213.43 / 4,387,191.17 / 220.77
//39.79 / 83.30 / 2.86
async function loadPointCloud() {
    const metadata = await fetchMetadata(id);
    Potree.loadPointCloud(`${metadata}`, id, e => {
        pointCloud = e.pointcloud;
        pointCloud.position.set(0,0,0)
        viewer.scene.addPointCloud(pointCloud);
    })
}

function load_poles() {
  const poles = await response.json();    // these poles are very high coordinates. ex:   583,213.43 / 4,387,191.17 / 220.77
  poles.forEach(location => {
         const start = new THREE.Vector3(
              location.start_point[0],
              location.start_point[1],
              location.start_point[2]
        );
  
        const end = new THREE.Vector3(
              location.end_point[0],
              location.end_point[1],
              location.end_point[2]
        );
        addLineToScene(viewer, start, end);
   })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant