naurril / SUSTechPOINTS

3D Point Cloud Annotation Platform for Autonomous Driving
GNU General Public License v3.0
783 stars 206 forks source link

Centre of rotation #164

Open GurveerSohal opened 10 months ago

GurveerSohal commented 10 months ago

Is there a way to change the centre of rotation for the loaded pointcloud?

If I have a large point cloud, it's hard to navigate that because the centre of rotation seems to be fixed. Also, if the coordinates of the pointcloud are far from the centre, it's hard to rotate too.

Is there anywhere in the code I can get started on changing this?

naurril commented 10 months ago

Did you try reset view in context menu?

GurveerSohal commented 10 months ago

Did you try reset view in context menu?

Yes, but the centre of rotation seems to be fixed away from the point cloud itself. Large point clouds work fine if we change their coordinates to be centred around the centre of the circle ruler

naurril commented 10 months ago

'reset view' simply computes the centroid of points as the center, you can modify it to meet your needs, search resetview in editor.js

On Tue, Aug 22, 2023, 23:09 Gurveer Sohal @.***> wrote:

Did you try reset view in context menu?

Yes, but the centre of rotation seems to be fixed away from the point cloud itself. Large point clouds work fine if we change their coordinates to be centred around the centre of the circle ruler

— Reply to this email directly, view it on GitHub https://github.com/naurril/SUSTechPOINTS/issues/164#issuecomment-1688380517, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZKCDSF57PSPDTDKXW4WK3XWTDR3ANCNFSM6AAAAAA3Y2Y5E4 . You are receiving this because you commented.Message ID: @.***>

GurveerSohal commented 10 months ago

I saw that, but is there anywhere you define the centre of rotation for the camera itself?

naurril commented 10 months ago

you can set it when the main camera is initialized

https://github.com/naurril/SUSTechPOINTS/blob/522d1daef1e829f433cada6f420189ab3daee249/public/js/view.js#L80

On Wed, Aug 23, 2023, 00:11 Gurveer Sohal @.***> wrote:

I saw that, but is there anywhere you define the centre of rotation for the camera itself?

— Reply to this email directly, view it on GitHub https://github.com/naurril/SUSTechPOINTS/issues/164#issuecomment-1688507942, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZKCDQSK54HNGXJS6AZ46DXWTK27ANCNFSM6AAAAAA3Y2Y5E4 . You are receiving this because you commented.Message ID: @.***>

GurveerSohal commented 10 months ago

Thanks!

GurveerSohal commented 10 months ago

When you pan using right click, it changes the centre of rotation (we checked using a console log in view.render()). I saw that the right click event is handled in handle_right_click() in editor.js, but I don't see where the drag event is handled. Can you please tell me where it is?

naurril commented 10 months ago

the camera operations including pan are handled by OrbitControls

GurveerSohal commented 10 months ago

Thanks! We found that ussing the following: this.viewManager.mainView.orbit.target.set(pos.x, pos.y, center.z); in resetView() results in the desired behaviour for changing the center of rotation. (Changing the z value from 0 to center.z). However, using any of the following: this.viewManager.mainView.orbit.target.set(center.x, center.y, center.z); this.viewManager.mainView.orbit.target.set(pos.x, pos.y, pos.z); results in some problems, we are unsure of why yet.