从 hitTest.face.normal 获取全局法线 [英] Getting global normal from hitTest.face.normal

查看:20
本文介绍了从 hitTest.face.normal 获取全局法线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行 hitTest 以在面法线上创建剖面.为了获得全局法线,我必须对 hitTest.face.normal 进行一些修改.它似乎几乎工作,但我的结果似乎与实际正常情况略有不同,所以我认为我做错了什么:

I am doing a hitTest to create a section plane on a face normal. To get the global normal I have to do some reworking of the hitTest.face.normal. It seems to almost work, but my result seems to be slightly off from the actual normal, so I am thinking I am doing something wrong:

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)

如图所示,我的结束剖切面与实际平面略有偏离

任何人都可以看到乘坐飞机的方式可能会出现什么问题,或者有没有人有更好的方法来找到全局法线?

Can anyone see what might be off in that way of getting the plane, or do anyone have a better way of finding the global normal?

先谢谢你!

推荐答案

你能分享更多关于正常人脸应该是什么样子的细节吗?以下是查看器的上下文菜单 Section Plane 如何根据面部命中点创建截面的代码片段.可能会有帮助.

Could you share more details on what the face normal should be? Here is the code snippet how the viewer's context menu Section Plane creates the section plane based on the face hit point. It might help.

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);
}

这篇关于从 hitTest.face.normal 获取全局法线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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