创建一个靠着一个对象的剖面 [英] Create a section plane leaning against one object

查看:74
本文介绍了创建一个靠着一个对象的剖面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个垂直截面平面,该平面靠着所选对象.例如选择一个这样的对象

I need to create a vertical section plane leaning against a selected object. For example selecting an object like this

我需要使剖面平面靠着对象的最长边

I need to get a section plane leaning against the longest side of the object

我使用的是版本7.16的查看器,在右键单击选择中提供了剖切面"选项,但它无法正常工作.

I'm using the viewer version 7.16 that offers a Section plane option in the right click selection but it works incorrectly.

我正在使用frags.getWordBounds方法获取围绕对象的框,并使用一些三角函数计算了方向,但是我猜这不是正确的方法,因为我无法确定正确的对象方向:

I am using the frags.getWordBounds method to get the box "around" the object and, using a little trigonometry, I have calculated the orientation, but I guess it's not the right approach because I cannot determine the right object direction:

+-------------+
|.           *|
| .         * |
|  .       *  |
|   .     *   |
|    .   *    |
|     . *     | is my object the dot or the asterisk?
|      *      |
|     * .     |
|    *   .    |
|   *     .   |
|  *       .  |
| *         . |
|*           .|
+-------------+

预先感谢您的支持.

推荐答案

在创建自己的横断面工具时,我遇到了类似的问题.您可以在这里看到问题:从hitTest.face.normal获取全局法线

I had a similar issue when creating my own section plane tool. You can see question here: Getting global normal from hitTest.face.normal

不确定您是否要创建自己的,但如果我是我,发现有两件事对我来说至关重要:

Not sure if you are creating you own, but if you are i found that two things were crucial for me:

onst normal = this.hitTest.face.normal.clone();
normal.transformDirection( this.hitTest.object.matrixWorld );

const currentFragId = this.hitTest.fragId;
const renderProxy = this.viewer.impl.getRenderProxy(this.viewer.model,currentFragId);

第一个代码段从对象空间到世界空间都恢复正常,第二个代码段似乎重新计算了hitTest中收到的片段.

The first snippet gets world normal from object space to world space, second snippet seems to recalculate the fragment received in hitTest.

这篇关于创建一个靠着一个对象的剖面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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