Exploration of measurements in Potree and Three.js

As a newcomer and non-native English speaker, please bear with me.

Currently, I am working on displaying multiple point clouds simultaneously using the amazing Potree 1.4RC. However, I am looking to automatically read the height of a point cloud by analyzing all the points to detect the maximum dimension. So far, I have utilized the following code:

Var Potree.Measure areaMeasurement = new ( ) ;
areaMeasurement.addMarker (new THREE.Vector3 (0, 0 , 0)) ;
areaMeasurement.addMarker (new THREE.Vector3 ( -10 , 0 , 0 ) ) ;
viewer.measuringTool.addMeasurement ( areaMeasurement ) ;

However, my points are predefined. My main question is how can I determine the maximum height or width of a PointCloud without relying on the bounding box?

Furthermore, how can I obtain a spatial coordinate (e.g., Z) when provided with others (e.g., X and Y) in Potree or Three.js? Is it possible to automatically detect these maximum values and retrieve their coordinates?

Thank you in advance, Best regards.

Answer №1

To find the maximum width, you can calculate the squared distances between each pair (x, z) of points in your point cloud.

distanceSquared = (point1.x - point2.x) * (point1.x - point2.x) + (point1.z - point2.z) * (point1.z - point2.z);

Then, you just need to take the square root of the highest value to determine the maximum width.

As for the maximum height, it's simply the greatest y-coordinate among all the points.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Execute the code from https://github.com/akella/webgl-mouseover-effects on your local environment

I'm looking to create an image hover effect similar to the one on the website . The closest example I've found so far is on https://github.com/akella/webgl-mouseover-effects. I've downloaded and extracted the files, but when I try to run ...

Anticipated that the absence of a value would match the presence of an Object

Struggling with running AngularJS unit tests for $resource using Jasmine v2.0 and Karma v0.13, I managed to convert custom actions to newer syntax successfully. However, a specific type of test is giving me trouble, which I suspect is related to $httpBacke ...

Encountering an undefined response in API call using Fetch with Express Nuxt

I've hit a roadblock with a task involving Express, API, and Fetch. I'm utilizing Nuxt along with Shopify API endpoints to retrieve data such as orders. Below is my express API Endpoint which should return an array of objects (orders). const bod ...

Utilizing VueJS to choose an item from a list and exhibit it using a function

My goal is to retrieve the element I click on, displayed in a list, and then print this element using a method within my Vue instance through the mail-list tag in index.html. I have a Vue component that iterates over a JSON object and only displays two at ...

Enhanced password encryption on the client side using jQuery ajax and PHP [advanced technique]

I found a solution here on how to encrypt data in javascript and decrypt it on the server side. I am encountering an issue while trying to implement this with my ajax form submission. I attempted to integrate it into my code snippet below, but it's no ...

Unexpectedly, Ajax call is triggering additional callbacks

I am currently facing an issue with my AJAX request in the code below. The Chrome Inspector is showing that the callback function associated with the request is being called twice, resulting in the response being logged into the console twice. Additional ...

An error will be thrown if you try to pass an array attribute of an object as a prop to a React component

I'm trying to grasp why passing an array attribute of a data object into a Component as a prop is causing issues. Is this due to my understanding of how React functions, or are there potential pitfalls in this scenario? Any insight would be greatly ap ...

Enhance the aesthetic appeal of the imported React component with added style

I need assistance with applying different styles to an imported 'notification' component within my header component. The notification component has its own CSS style, but I want to display it in the header component with unique styling. How can I ...

What is the process for releasing an NPM package to the NPM registry rather than the GitHub registry?

I have developed an NPM package available at - (https://github.com/fyndreact/nitrozen) The package was successfully published on the Github registry (), but I am looking to publish it on the NPM registry. However, I cannot locate the package in the NPM r ...

Having trouble getting Node.js moment timezone conversion to work properly?

Here's the plan for the code below: creating objects that expire at midnight in different timezones. To achieve this, I need to determine the user's location and corresponding timezone first. Then, take the current date in that timezone and forma ...

Mapping the changes in the checkbox of a material tree node

Check out this demo on StackBlitz: Tree View I'm having issues with the tree not displaying as desired. I would like it to look like this: Manager Sublist Manager 1 Manager 2 Manager 3 Could you please review and provide some advic ...

Vertical scroll bar positioned on the left side of a DIV

Can a vertical scroll bar be placed on the left side of a DIV using CSS? What about JavaScript? ...

Trouble with $.getJSON while trying to obtain song tempo data with getSongBPM

Still learning the ropes, so bear with me. I am trying to retrieve the BPM of a song using the getSongBPM public API. However, I'm not seeing any data in the console. // Please note that the API key has been updated $.getJSON("https://api.getsongbp ...

Tips on Including Service in Angular Testing Specification File with Jasmin/Karma

I'm a beginner when it comes to writing unit tests for Angular. I have a scenario where I need to inject a service into my controller file (.ts). How can I go about injecting the service file in the spec file? Below is the code snippet: app.componen ...

The Hover Hover textbox stays in place once clicked on

I have implemented a search bar that displays a textbox when a user hovers over a button. I am looking to modify the code so that the textbox remains visible even after the user has clicked on it. This way, if the user accidentally moves their mouse away f ...

The message "The property 'layout' is not found on the type 'FC<WrapperProps>' in Next.js" is displayed

I encountered an error in my _app.tsx file when attempting to implement multiple layouts. Although the functionality is working as expected, TypeScript is throwing an error Here is the code snippet: import Layout from '@/components/layouts&apo ...

The JavaScript function is designed to only accept whole numbers as input

Whenever I invoke a JavaScript function and pass along 4 parameters, it only functions properly if the fourth parameter consists of integers exclusively. Below is the code snippet for my onchange function: onchange="weekchange(this, <?php echo $i ?> ...

Avoid Repeating an Animation with Jquery

When you continuously press a button that triggers a function with animation, the function is called multiple times and the animation plays one after another. How can you prevent the function from being triggered while the animation is still in progress? ...

Can the environment variables from the .env package be utilized in npm scripts?

I've integrated dotenv into my cypress project and defined variables in a .env file, as shown here: USER=Admin How can I utilize the env variable USER within my npm scripts? "scripts": { "cypress:open": "npx cypress ope ...

What is the best way to modify a current state object without causing an endless loop of redirects?

const useCase = (argument) => { const [value, setValue] React.useState(argument) React.useEffect(() => setValue({...value ...argument), [argument, value, setValue]) } The above code is currently causing an infinite loop due to setting the stat ...