查看: 1610|回复: 5

请问如何选择Box的点,线,面

[复制链接]

该用户从未签到

发表于 2011-3-10 18:43:23 | 显示全部楼层 |阅读模式
大家好,一个BOX有6个面,12条边,8个顶点,选择BOX是简单的,怎样可以实现选择box的点,选线,选面操作呢?谢谢大家

该用户从未签到

发表于 2011-3-11 08:48:27 | 显示全部楼层
LinesegmentIntersector返回的计算结果包括了当前被选中的Triangle的信息,您可以据此来实现模型细部的选中操作

该用户从未签到

 楼主| 发表于 2011-3-11 17:23:08 | 显示全部楼层
array,我查过LinesegmentIntersector并没有找到相关的函数呀,只是得到nodepath,麻烦你能不能讲得详细点或者简单写几行代码介绍下用法,谢谢

该用户从未签到

发表于 2011-3-14 08:45:40 | 显示全部楼层
您只要列出Intersection结构体的内容,就能够发现哪个成员量与我说的有关了

该用户从未签到

 楼主| 发表于 2011-3-14 19:24:53 | 显示全部楼层
struct Intersection
        {
            Intersection():
                ratio(-1.0),
                primitiveIndex(0) {}
        
            bool operator < (const Intersection& rhs) const { return ratio < rhs.ratio; }

            typedef std::vector<unsigned int>   IndexList;
            typedef std::vector<double>         RatioList;

            double                          ratio;
            osg::NodePath                   nodePath;
            osg::ref_ptr<osg:rawable>     drawable;
            osg::ref_ptr<osg::RefMatrix>    matrix;
            osg::Vec3d                      localIntersectionPoint;
            osg::Vec3                       localIntersectionNormal;
            IndexList                       indexList;
            RatioList                       ratioList;
            unsigned int                    primitiveIndex;
            
            const osg::Vec3d& getLocalIntersectPoint() const { return localIntersectionPoint; }
            osg::Vec3d getWorldIntersectPoint() const { return matrix.valid() ? localIntersectionPoint * (*matrix) : localIntersectionPoint; }
            
            const osg::Vec3& getLocalIntersectNormal() const { return localIntersectionNormal; }
            osg::Vec3 getWorldIntersectNormal() const { return matrix.valid() ? osg::Matrix::transform3x3(osg::Matrix::inverse(*matrix),localIntersectionNormal) : localIntersectionNormal; }
        };
我看过了,没发现你说的呀?array,能不能再明确点呀?或者提供了简单的例子呀?谢谢!

该用户从未签到

发表于 2011-3-16 08:23:14 | 显示全部楼层
have some tests with indexList
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表