inline osg::Geometry* createLine(const std::vector<osg::Vec3>& allPTs, osg::Vec4 color,
osg::PrimitiveSet::Mode model = osg::PrimitiveSet::LINE_STRIP, float nWidth = 2)
{
int nCount = allPTs.size();
osg::ref_ptr<osg::Geometry> pGeometry = new osg::Geometry();
osg::ref_ptr<osg::Vec3Array> pyramidVertices = new osg::Vec3Array;
pGeometry->setVertexArray(pyramidVertices.get());
for (int i = 0; i < allPTs.size(); i++)
{
pyramidVertices->push_back(allPTs[i]);
}
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
colors->push_back(color);
pGeometry->setColorArray(colors.get());
pGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
osg::ref_ptr<osg::DrawArrays> pyramidBase = NULL;
pyramidBase = new osg::DrawArrays(model, 0, allPTs.size());
pGeometry->addPrimitiveSet(pyramidBase.get());
//osgUtil::SmoothingVisitor::smooth(*pGeometry);
pGeometry->setUseVertexBufferObjects(true);
{
osg::StateSet* stateset = pGeometry->getOrCreateStateSet();
stateset->setAttributeAndModes(new osg::LineWidth(nWidth), osg::StateAttribute::ON);
stateset->setAttributeAndModes(new osg::Point(3));
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);
}
return pGeometry.release();
}
相关推荐
OSG开发笔记(十二):OSG基本几何图形、内置几何类型
若该文为原创文章,未经允许不得转载 原博主博客地址:https://blog.youkuaiyun.com/qq21497936 本文章博客地址:https://blog.youkuaiyun.com/qq21497936/article/details/96102001 目录 前言 基本几何图元(枚举) 内置几何类型(类) 球体 代码 效果 场景中X轴与Z轴长度不同的问题 问题代码 寻找问题原因 ...
osg设置线型
【代码】osg设置线型。
OSG绘制约束线
osg用约束线去掉想去掉三角网的区域,实现地形的裁剪和编辑,方便灵活。
OSG GEOMETRY类型和使用说明
OSG的几何绘制 osg 绘制使用的OpenGL的绘制过程 1. OSG绘制简单线 使用简单线绘制,使用OpenGL的绘制的线的能力过程 // create Geometry object to store all the vertices and lines primitive. osg::Geometry* linesGeom = new osg::Geometry(); //创建定点数据 osg::Vec3Array* vertices = new osg::Vec3Arra
C++画图软件(线、矩形、椭圆。修改线形、线宽、颜色)
C++画图软件(线、矩形、椭圆。修改线形、线宽、颜色) 仅供参考,希望对你有帮助
【学习笔记】OSG 基本几何图元
例:geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); 来指定要利用这些数据生成一个怎么样的形状。 该行代码中,使用DrawArrays类向Geometry类送入了新几何体的信息,即,该几何体是一个QUADS,它的顶点坐标从索引数组中读入,从第1个索引值开始,共读入4个索引值,组成一个四边形...
从二体运动到高精度轨道:STK与MATLAB联动的轨道外推算法演进史
本文探讨了轨道外推算法从二体运动到高精度轨道预报(HPOP)的演进历程,重点分析了STK与MATLAB协同仿真环境下的技术实现与应用。通过对比不同算法的精度与适用场景,展示了HPOP在卫星参数优化和轨道设计中的优势,为航天任务规划提供了高效解决方案。
osg基本绘制-线
osg绘制图形需要定义最基本的顶点坐标数组。 绘制几何图形需要osg::Geometry这个类,他就是负责几何体的绘制。 void create4Geo() { osg::ref_ptr<osg::Group> root = new osg::Group; osg::ref_ptr<osg::Geode> geode = new osg::Geode; root-&...
5分钟搞懂语义通信:如何用深度学习让AI理解你的真实意图?
本文深入解析了语义通信如何利用深度学习技术,实现从传统‘比特保真’到‘语义保真’的范式转移。通过介绍基于神经网络的端到端系统架构、编解码技术及实战案例,阐明AI如何理解并高效传递信息核心意图,为6G时代的人机交互奠定基础。
【电机驱动与运动控制】期末重点问题集合
问题1 梯形曲线和S形曲线各自的特点和区别,比较梯形和S形曲线位置、速度、加速度、加加速度的区别。 问题2 总惯量的计算包含哪几个部分? 哪几个部分需要进行折算? 在齿轮箱的输出侧(2号轴)总惯量需要折算到齿轮箱的输入侧(1号轴) 为什么需要折算? 齿轮箱比的存在使2号轴的转速和电机的转速不同 问题3 指出每个部分的名称。 每个部分的功能。 主磁极的励磁绕组:绝大部分直流电机都是由励磁绕组通以直流电建立主磁场; - 电枢铁心:在两个主磁极内表面之间,由硅钢片叠成的圆
string splite & create line
std::vector<std::string> Split(const string& src, const char& delim) { std::istringstream stream(src); std::string field; std::vector<std::string> result; while (std::getline(...
国科大学习资料--模式识别与机器学习(黄庆明)--期末复习题2(含答案)
国科大学习资料–模式识别与机器学习(黄庆明)–期末复习题2(含答案) 国科大学习资料–模式识别与机器学习(黄庆明)–期末复习题2(含答案) 国科大学习资料–模式识别与机器学习(黄庆明)–期末复习题2(含答案) ...
esmini多平台部署终极指南:Windows、Linux、Mac和Android的完整构建与运行教程
🚀 **esmini** 是一个开源的OpenSCENARIO XML场景播放器,它支持在Windows、Linux、Mac和Android等多个平台上进行交通场景仿真。无论您是自动驾驶开发者、交通仿真工程师还是研究人员,这份多平台部署指南将帮助您快速上手esmini的构建与运行。 ## 📦 环境准备与项目克隆 在开始构建之前,您需要准备以下基础环境: ### 1. 克隆项目仓库 首先,
8.DJI-PSDK:一站式项目功能开发总结(空中气象站项目/激光甲烷检测项目)
本文将以一篇文章的幅度快速完成: 项目一:空中气象站项目; 项目二:激光甲烷项目; 项目所使用的PSDK来源于第0章节末尾的百度网盘;解压:Payload-SDK-3.8.zip代码所在目录:双击打开: 修改打印串口和相关波特率,我们修改如下: 进行相关编译选项配置如下: :
【异常】安装OpenClaw遇到 Windows环境pnpm安装node-llama-cpp postinstall生命周期脚本执行失败完整解决方案
摘要: Windows环境下使用pnpm安装node-llama-cpp时,postinstall脚本执行失败(错误码3221225477),主要因缺少C++编译工具链或预构建二进制下载失败。解决方案: 基础排查:确保管理员权限、Node.js ≥18、路径无中文; 安装编译工具:推荐Visual Studio的“C++桌面开发”组件或windows-build-tools; 环境变量配置:强制CPU模式+国内镜像(NODE_LLAMA_CPP_FORCE_CPU=true,镜像地址替换为国内源); pnp
大型CAx(CAD/CAE/CAPP/CAM)工业软件开发中的关键组件
通过对FreeCAD、SALOME等多款代码的分析研究,发现这些软件在架构设计、模块实现等方面,存在许多相似(同)的技术思想。因此,有必要对这些共性、主流的技术予以总结分析。
rv1126如何切换720p和1080p
切换720p和1080p可以使用modetest,但是需要将这两种模式都添加到connector中去 添加一个新的mode到connector中去,其实内核中已经有相关接口了,需要做一些小改动。 1.不采用设备树的方式去配置,将720p和1080p的timing参数配置放在数组中。 2.这里的printer和设备树中的.compatible = "printer"一致。 3.将其添加到connector中去 static int panel_simple_get_fixed_modes(struct
VC++6.0实现DEM三维地形可视化:从数据到图形的底层原理与实践
三维地形可视化是地理信息系统和计算机图形学中的基础技术,其核心原理在于将数字高程模型数据转换为具有立体感的图形。该过程涉及数据解码、几何构建、坐标变换与渲染着色等关键技术环节。通过坐标变换流水线,三维空间中的地形点被投影至二维屏幕,并利用光照模型与颜色映射增强立体感,最终实现地形的直观表达。这一技术对于理解三维图形学底层逻辑、掌握空间数据可视化方法具有重要价值,广泛应用于GIS分析、虚拟仿真及游戏开发等领域。本文以经典的VC++6.0开发环境为例,结合GDI与OpenGL两种实现方案,详细拆解了DEM数据读
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
汉书HE8,好用的汇编代码编写工具
汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大
osg-04-基本几何图元-线宽
osg-04-基本几何图元-线宽
复分析 阿尔福斯(Ahlfors) 第三版答案 英文
答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案
osg画线_OSG 绘制直线、多段线
写在前面:翻了一遍国内的博客,我竟然没有找到关于 osg 绘制线段的相关代码,反而看到都是一些相同内容的网站,就这风气。osg::ref_ptr xfrom = getTransMatrix();osg::ref_ptr v1 = new osg::Vec3Array();// 增加点v1->push_back(calReferencePosition(_stackPoint));v1-&g...
NTscan扫描工具
ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。
OSG使用Geometry绘制自定义图形、更新修改绘制数据、绘制带边线图形(多 PrimitiveSet 绘制)
OSG使用Geometry绘制自定义图形、更新修改绘制数据、绘制带边线图形(多 PrimitiveSet 绘制)
osg::clipNode
这一段的功能主要是绘制线型的节点 //创建根节点 osg::Group* rootnode = new osg::Group; //创建状态集 osg::StateSet* stateset = new osg::StateSet; //设置多边形绘制方式为线型,正反面都绘制 osg::PolygonMode* polymod
osg中设置线宽和点的大小
#include <osg/LineWidth> #include <osg/Point> osg::ref_ptr<osg::StateSet> stateset = lineGeode->getOrCreateStateSet(); osg::ref_ptr<osg::LineWidth> lineWid = new osg:...
OSGEarth绘制Geometry:画线(一)
在OSGEarth中绘制线,首先考虑osgEarth::Annotation::FeatureNode。 功能描述如下: 1. 鼠标两次点击的点之间连线,为黄色的实线; 2. 最近一次点击的点和鼠标move到的点之间连线,为红色的虚线。 代码如下:drawline.hclass DrawLine : public HandleAdapter { public: DrawLine(Gr
OSG-基本几何图形
本文转至http://www.cnblogs.com/shapherd/archive/2010/08/10/osg.html 作者写的比较好,再次收藏,希望更多的人可以看到这个文章 互联网是是一个相互分形并学习的平台,我希望我每个人可以将我们认为有价值的东西,在不损害他人利益的情况下分享给更多的人。 基本绘制方法 首先来看一些OSG中的最基本的绘制路数。如果我们要绘制一个
4万+



被折叠的 条评论
为什么被折叠?



