three.js - 从 hitTest.face.normal 获取全局法线
问题描述
我正在做一个 hitTest 以在法线面上创建一个剖面。为了获得全球常态,我必须对hitTest.face.normal
. 它似乎几乎可以工作,但我的结果似乎与实际正常情况略有不同,所以我认为我做错了什么:
const normalMatrix = new THREE.Matrix3().getNormalMatrix( this.hitTest.object.matrixWorld );
const normal = this.hitTest.face.normal.clone().applyMatrix3( normalMatrix )
this.SectionExtension.tool.setSectionPlane(normal, this.hitTest.point)
谁能看到以这种方式获得飞机可能会出现什么问题,或者有没有人有更好的方法来找到全球常态?
先感谢您!
解决方案
你能分享更多关于面部正常应该是什么的细节吗?Section Plane
以下是查看器的上下文菜单如何根据面部命中点创建剖面的代码片段。它可能会有所帮助。
const selected = viewer.getSelection();
const intersection = viewer.impl.hitTest(status.canvasX, status.canvasY, false, selected);
// Ensure that the selected object is the on that recieved the context click.
if (intersection && intersection.face && selected.indexOf(intersection.dbId) !== -1) {
sectionExtension.tool.setSectionPlane(section, intersection.face.normal, intersection.point);
}
推荐阅读
- python - 使用python在目录中查找文件,如果多个文件显示匹配,则决定打开哪个文件
- java - Android 通知不执行任何操作
- ffmpeg - 我可以在一个带有 ffmpeg 的命令中使用 -crf 和 -s 选项吗
- regex - 正则表达式字符串邮件
- docker - Bitbucket Android 管道在 gradlew 上总是失败
- node.js - Sequelize-typescript 'HasManyCreateAssociationMixin' 不是函数
- python - 在列表列表中查找字典值的中位数
- c - 读取时传递到 pthread_create 的结构数据不正确
- linux - 使用 NFS 挂载包含多个硬盘驱动器挂载点的目录
- reactjs - How can I use useEffect in React to run some code only when the component first mounts, and some other code whenever an event occurs (repeatedly)?