Autodesk Forge Viewer缩放到边界框 [英] Autodesk forge viewer zooming to bounding box

查看:89
本文介绍了Autodesk Forge Viewer缩放到边界框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下的边界框对象:

I have a bounding box object as below:

bb = {
  "min": {
    "x": -6.637446403503418,
    "y": -19.579801559448242,
    "z": -0.22575747966766357
  },
  "max": {
    "x": 10.237555503845215,
    "y": 19.15947914123535,
    "z": 9.774243354797363
  }
}

我想缩放到此边界框,并以相机为中心.

I want to zoom to this bounding box and make camera as centre.

推荐答案

您只需调用 viewer.navigation.fitBounds(立即,界限)即可.

  • 第一个参数 immediate (立即)表示相机位置将如果将即时设置为假,则为新位置设置动画.
  • 第二个参数 bounds 表示要适合的边界框.
  • The first argument, immediate, means that camera position will animate to the new location if immediate is set as false.
  • The second argument, bounds, stands for the bounding box to fit.

记住要将您的边界框转换为 THREE.Box3对象.

Remember to convert your bounding box to THREE.Box3 object.

您可以在此处参考有关API文档: https://developer.autodesk.com/zh-CN/docs/viewer/v2/reference/javascript/navigation/

You can refer here for the API document: https://developer.autodesk.com/en/docs/viewer/v2/reference/javascript/navigation/

这篇关于Autodesk Forge Viewer缩放到边界框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆