osg osgUtil::LineSegmentIntersector
#ifdef _WIN32
#include <Windows.h>
#endif // _WIN32 #include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/CompositeViewer>
#include <osgDB/ReadFile>
#include <osg/Geode>
#include <osg/Node>
#include <osgGA/TrackballManipulator>
#include <osg/GraphicsContext>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/Image>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/TexGen>
#include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform>
#include <osg/AnimationPath>
#include <osg/Matrixd> #include <osgGA/GUIEventHandler>
#include <osgGA/CameraManipulator>
#include <osgGA/StandardManipulator>
#include <osgGA/OrbitManipulator>
#include <osgGA/TrackballManipulator>
#include <osgUtil/IntersectionVisitor>
#include <osgUtil/LineSegmentIntersector> //创建盒子
osg::ref_ptr<osg::Geode> createBox()
{
osg::ref_ptr<osg::Geode> geode1 = new osg::Geode;
geode1->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0,0.0,0.0),10.0,8.0,6.0)));
geode1->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0, 0.0, 0.0), 0.1, 0.1, )));
return geode1;
} int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
osg::ref_ptr<osg::Group> group1 = new osg::Group;
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build1.OSGB");
//group1->addChild(node1.get()); osg::ref_ptr<osgUtil::LineSegmentIntersector> lineSegmentIntesector = new osgUtil::LineSegmentIntersector(osg::Vec3(,,),osg::Vec3(,,-));
osg::ref_ptr<osgUtil::IntersectionVisitor> intersectionVisitor1 = new osgUtil::IntersectionVisitor(lineSegmentIntesector); group1->addChild(createBox());
group1->accept(*intersectionVisitor1.get()); osgUtil::LineSegmentIntersector::Intersections intersections;
//输出交点
if (lineSegmentIntesector->containsIntersections())
{
intersections = lineSegmentIntesector->getIntersections();
osgUtil::LineSegmentIntersector::Intersections::iterator iter;
for (iter = intersections.begin(); iter != intersections.end(); ++iter)
{
std::cout << "x:"<<iter->getWorldIntersectPoint().x() << " y:" << iter->getWorldIntersectPoint().y() << " z:" << iter->getWorldIntersectPoint().z() << std::endl;
}
} viewer1->setSceneData(group1.get());
viewer1->setUpViewInWindow(, , , , ); return viewer1->run();
}

osg osgUtil::LineSegmentIntersector的更多相关文章
- osg实例介绍
osg实例介绍 转自:http://blog.csdn.net/yungis/article/list/1 [原]osgmotionblur例子 该例子演示了运动模糊的效果.一下内容是转自网上的:原理 ...
- osg 路径 动画 效果
osg 路径 动画 效果 转自:http://blog.csdn.net/zhuyingqingfen/article/details/8248157 #include <osg/Group&g ...
- osg项目经验1<MFC+OSG中模型点选效果>
点选主要是重载osg的GUIEventHandler, class CPickHandler : public osgGA::GUIEventHandler{ //自定义回调函数名:CPickHand ...
- OSG选取点云坐标不准的解决办法
一.默认的相机和所有模型求交的方式 1.1 传统的模型与屏幕点求交的方法如下: osgViewer::View* viewer = dynamic_cast<osgViewer::View*&g ...
- osg编译日志-release
1>------ 已启动生成: 项目: ZERO_CHECK, 配置: Release x64 ------1> Checking Build System1> CMake does ...
- osg fbx模型点击节点,对应节点染色
class CPickHandler :public osgGA::GUIEventHandler { public: CPickHandler(osgViewer::Viewer *viewer) ...
- osg 加载 fbx文件
#ifdef _WIN32 #include <Windows.h> #endif // _WIN32 #include <osg/Group> #include <os ...
- osg 添加 fbx插件 osg中编译fbx
使用osg加载fbx模型,需要自己编译fbx插件,编译流程与插件使用案例如下 代码地址:https://github.com/shelltdf/osgFBX CMake Error: The foll ...
- osg Shader 着色器
#ifdef _WIN32 #include <Windows.h> #endif // _WIN32 #include <osg/Group> #include <os ...
随机推荐
- charles 手机证书下载安装
本文参考:charles 手机证书下载安装 本文的Charles,适应windows/MAC/IOS/Android,避免抓包HTTPS失败和乱码: 用的版本是V4.1.2,其它版本原理类似: cha ...
- 【蜂窝】at+qcfg="band"的计算和使用
查询附件 Quectel_EC25_LTE_模块产品规格书_V1.6 可知当前的蜂窝模块所对应的band频带是什么? eg.1 EC25-AU 当前选择4G 优先, FDD LTE 可看手册QCFG命 ...
- PAT基础级-钻石段位样卷2-7-6 帅到没朋友 (20 分)
当芸芸众生忙着在朋友圈中发照片的时候,总有一些人因为太帅而没有朋友.本题就要求你找出那些帅到没有朋友的人. 输入格式: 输入第一行给出一个正整数N(≤),是已知朋友圈的个数:随后N行,每行首先给出一个 ...
- JDBC课程2--实现Statement(用于执行SQL语句)--使用自定义的JDBCTools的工具类静态方法,包括insert/update/delete三合一
/**JDBC课程2--实现Statement(用于执行SQL语句) * 1.Statement :用于执行SQL语句的对象: * 1): 通过Connection 的createStatement( ...
- 搭建Git服务器环境----Git hooks代码自动部署
引言:自己想搭一套git的服务端环境,不想用github码云等.经多方资料整合,实验总结,以下是亲测有效的方式.可用于公司日常开发 一.搭建Git环境 ① 安装 Git Linux 做为服务器端系统, ...
- NOSQL数据库简介
什么是NoSQL?泛指非关系型的数据库不支持SQL语法存储结构跟传统关系型数据库中的那种关系表完全不同,nosql中存储的数据都是Key-Value(即键值对关系)形式NoSQL的世界中没有一种通用的 ...
- Spring Boot学习--spring-boot-starter-parent及starters(转)
在官方文档的第三部分的13块讲述了引用的管理,官方推荐的是使用Maven和Gradle. 我一直在用的是maven,而且使用maven有些优势–spring-boot-starter-parent,这 ...
- Greenplum table 之 appendonly表
一.压缩表 1.appendonly压缩表的数据视图为pg_appendonly 2.appendonly在Greenplum后也可更新与删除
- asp.net利用webuploader实现超大文件分片上传、断点续传
ASP.NET上传文件用FileUpLoad就可以,但是对文件夹的操作却不能用FileUpLoad来实现. 下面这个示例便是使用ASP.NET来实现上传文件夹并对文件夹进行压缩以及解压. ASP.NE ...
- LA、Remember the Word (字典树, 简单dp)
传送门 题意: 给你一个初始串 S,strlen(s) <= 3e5 然后给你 n 个单词. n <= 4000, 每个单词的长度不超过 100 : 问你这个初始串,分割成若干个单词的 ...