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

Clipping mode and initial zoom level #165

Closed
Kevin-Mattheus-Moerman opened this issue May 30, 2020 · 2 comments
Closed

Clipping mode and initial zoom level #165

Kevin-Mattheus-Moerman opened this issue May 30, 2020 · 2 comments

Comments

@Kevin-Mattheus-Moerman
Copy link

I have a shape with units in mm (and it is a residual limb segment for a below knee amputee so about the side of a foot/leg). From this animation you can see that the initial zoom state is not great and also view clipping prevents me from viewing the geometry when I attempt to zoom out.

  1. Could the initial zoom level (and horizontal grid field size) be based on the visualized entities in an automated way? Alternatively how can I set the axis limits/units/or initial zoom state?

  2. Can clipping be turned off? Or can one change the zoom mode such that we do not "fly through" but "zoom at" (ever closer without cutting)?

Thanks.

Peek 2020-05-30 08-57

Code I used:

using MeshCat
using MeshIO, FileIO
using Colors
using GeometryTypes: vertices

vis = Visualizer()
open(vis)
cube = load("/home/kevin/Desktop/temp/ampscan/tests/stl_file.stl")
setobject!(vis[:mesh], cube)
@rdeits
Copy link
Owner

rdeits commented May 31, 2020

Hm, that's a good point. I think you'll have a better experience all around if you rescale your objects to be ~unit scale. In your case, you can probably do:

setobject!(vis[:mesh], 
    HomogenousMesh(0.001 .* vertices(cube), faces(cube))

But if that's not an option, then at least some of this can be fixed programmatically. You can change the clipping behavior by changing the "far" property of the default camera. You would do that by running:

julia> setprop!(vis["/Cameras/default/rotated/<object>"], "far", 10000)

Likewise you can control the initial position of the camera (without affecting its field of view) by changing its "position" attribute (see https://github.com/rdeits/meshcat#camera-control ):

julia> setprop!(vis["/Cameras/default/rotated/<object>"], "position", [1000, 0, 0])

The grid is slightly trickier: it doesn't seem to handle property updates correctly, so I'm not sure how to scale it programmatically. You can just hide it if it's annoying:

julia> setvisible!(vis["/Grid"], false)

@ferrolho
Copy link
Collaborator

Closing this issue due to inactivity and because options for addressing the issue have been listed in the comment above.

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

3 participants