osg总结一:osg视察器NodeVistor 使用注意事项及剖析

OSG Examples(osgintersection)解析 OSG Examples(osgintersection)解析 效果 本例子主要是讲解在osg中怎么使用线相交(LineSegmentIntersector),来计算与地形等具有lod以及pagelod功能节点的交点。对于普通节点的相交计算使用LineSegmentIntersector就可以得到所有的交点信息,但是对于具有lod功能的节点普通的线相交计算只能计算到与当前lod等级的节点的交点信息,更高lod等级的更加精确的交点信息是得不到的。Osg为了提供类似的功能,在osgSim中定义了几种特. 阅读详情

不废话直接上!

1、osg::NodeVistor
继承模式:

NodeVistor
Object
Referenced

osg::Node
继承方式:

Node
Object
Referenced

2、要想监视某个物,必须要有一个方法
osg所有节点的监视方式,由继承于父亲节点即(osg::Node)与监视器(osg::NodeVistor)合并使用的方法来完成,那么入口呢?使用方式呢?

osg::Node提供了虚函数入口方式

  1. virtual void accept(NodeVisitor& nv);
  2. virtual void ascend(NodeVisitor& nv);
  3. virtual void traverse(NodeVisitor& /nv/) {}

在NodeVistort提供了很多apply方法,使用自带接口都是具有目的性的,其中osg视察器已经定义了很多,可以从其中选择一个适合当前要做的操作,比如计算节点包络框,也可以利用c++特性,继承NodeVisitor来实现自己节点想要的操作;
virtual void accept(NodeVisitor& nv);
定义:
void Node::accept(NodeVisitor& nv)
{
//判断Node是否要遍历操作;其中最为关键,也是最为方便的决定此
//模型是否要被操作取决于 node.getNodeMask(),相当于Node的遍历的开关
if (nv.validNodeMask(this))
{
// 加入父节点
nv.pushOntoNodePath(this);
// 调用视察器方法
nv.apply(this);
// 使用完毕踢出
nv.popFromNodePath();
}
}
** virtual void ascend(NodeVisitor& nv);

向上遍历
irtual void traverse(NodeVisitor& /nv/) {}
向下遍历

osg探究补充:Node::accept(NodeVisitor& nv)及NodeVisitor简介 前言 在前几节中,我自己觉得讲的比较粗糙,因为实在是时间上不是很充足,今天我想弥补一下,希望不是亡羊补牢。我们在osgViewer::Viewer::eventTraversal()函数中经常看到这么两个函数:camera->accept(*_eventVisitor);以及getSceneData()->accept(*_eventVisitor);今天我们第一步就是要介绍一下这两... 阅读详情

相关推荐

OSGVIEW查看器

支持3dmax转IVE文件以及读取IVE等操作,查看IVE文件

OSG 节点访问器(NodeVisitor)

OSG 节点访问器(NodeVisitor) 前言:学习OSG还有点痛苦,大概是对于新东西学起来都是痛苦的吧! osg::NodeVisitor 类: ※ NodeVisitor( TraversalModel tm);     构造函数;传入参数为节点树的遍历方式:     TRAVERSE_NONE, 仅当前节点;     TRAVERSE_PARE

MissXy_的博客 3748

【路由交换】思科5506防火墙三区域互通

思科 5506 inside outside dmz 互通

baidu_22774701的博客 6206

10、osg::AnimationPath,osg::NodeVisitor类

一、osg::AnimationPath类 1、AnimationPath ()       AnimationPath (const AnimationPath &ap, const CopyOp &copyop=CopyOp::SHALLOW_COPY) 说明:构造函数,第二个构建函数为从已知值来构造新的AnimationPath. 2、bool getMatrix (double

sxj的专栏 2683

帕塞瓦尔定理(Parseval‘s theorem)的证明

帕塞瓦尔定理(Parseval's theorem)表明了信号在时域和频域上的能量相等。

weixin_42428226的博客 2万+

5.44GHz超高精度!STM32G474的HRTIM时钟配置避坑指南

本文深入解析STM32G474内置高分辨率定时器的时钟配置要点,帮助工程师避开常见陷阱。文章详细阐述了从系统时钟到5.44GHz等效时基的路径,重点分析了预分频器乘法器、周期计算溢出、影子寄存器同步等关键配置,并结合实测波形对比,确保HRTIM在电机控制、数字电源等精密应用中发挥极限性能。

book8的博客 523

OSG的节点访问类NodeVisitor应用

应用场景: 在类A的函数中中定义了数个osg::MatrixTransform类的对象,想要在类B中得到这几个对象的接口指针,就捡起了NodeVisitor类的用法。 使用节点访问类的几个要注意的点 1.需要被遍历的节点调用 accept方法,将遍历器加入自身,然后该节点会反过来调用该遍历器中的apply方法,开始遍历,在每一次遍历前会选择合适的apply重载函数进行遍历,需要实现一些功能可以在a...

qq_36881934的博客 1211

QGis二次开发 —— 2、第一个程序 - 加载栅格tif与矢量shp文件(附源码)

QGis二次开发 —— 2、第一个程序 - 加载栅格tif与矢量shp文件(附源码)

1100

osg第16讲(NodeVisitor遍历器)

osg

qq970767225的博客 1202

**Coffin-Manson 模型**在半导体功率循环测试中的理论背景、数学形式、应用场景,以及如何使用 **C#** 编程语言进行具体实现

Coffin-Manson 模型最初用于描述金属材料在低周疲劳(Low-Cycle Fatigue, LCF)下的寿命,后来被广泛应用于半导体功率器件(如 IGBT、MOSFET)的可靠性分析,特别是在功率循环测试中。如果你有具体数据(如 CSV 文件)、更复杂的模型要求(如 Bayerer 模型)或特定可视化需求,请提供,我可以进一步优化代码或添加功能!以下代码实现基本模型 ( N_f = A \cdot (\Delta T_j)^{-n} ) 的拟合,生成拟合曲线并预测寿命。我会结合你之前提到的。

专注于前沿技术的探索与实践,热衷于从代码逻辑、架构设计到行业应用等多维度深挖技术本质。期待在技术之路上与你共同成长~ 481

全网最全-DA14531-全球最小-BLE从入门到精通开发教程

本教程主要适用于低功耗产品,DA14531它体积小,非常适用于对体积敏感的设备,如无线可穿戴、传感器、助听器等设备。本文经过作者发大量时间来记录开发项目的调试方法,里面有许多笔者开发心得体会,旨在让读者工程师快速上手,减少摸索时间,提高软件质量。读者对象本文档主要适用以下工程师:嵌入式系统工程师单片机软件工程师IOT固件工程师BLE固件工程师。

hejinwu1314的博客 5138

OSG程序设计之osg::NodeVisitor

  本文所有内容来自《OpenSceneGraph三维渲染引擎设计与实践》一书。   本文主要讨论的是OSG中节点的访问。   对于节点的访问是从节点接收一个访问器开始的,用户执行某个节点的accept()函数,将一个具体的访问器对象传递给节点。   第二步,节点反过来执行访问器的apply()函数,并将自身传入访问器。   这两步的实现过程可以用一行十分简单的函数代码来表达: vo...

weixin_34310785的博客 533

一种基于机载LiDAR点云电力线自动提取方法

文章目录一、引言二、算法实现2.1实现步骤2.2实现代码 一、引言 二、算法实现 2.1实现步骤 (1)首先采用首先采用高程滤波方法去除地面点和低矮地物点,滤波后的点云数据中除电力线点云外还含部分杆塔点、高植被点和噪声点。 (2)根据点云空间维度特征提取电力线点,使用空间密度聚类的方法实现单根电力线精确分离。 2.2实现代码 在这里插入代码片 ...

dayuhaitang1的博客 5172

九、OSG学习笔记-NodeVisitor节点遍历器

OsgStudy/NodeVisitor · CuiQingCheng/OsgStudy - 码云 - 开源中国。八、OSG学习笔记--优快云博客。

weixin_36323170的博客 574

深度学习工具包 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');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

OSG中对于Node、NodeVisitor、Callback三者关系与的梳理

OSG中对于Node、NodeVisitor、Callback三者关系与运转的梳理

etrotva_的博客 2198

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

【OSG】NodeVisitor

实现代码 #include <osgViewer/Viewer> #include <osgDB/ReadFile> #include <osg/MatrixTransform> #include <osg/NodeVisitor> #include <iostream> #include <osg/Geode> #inclu...

不会游泳的程序猿 565

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

通过NodeVisitor遍历OSG节点

通过NodeVisitor遍历OSG节点 遍历场景中的节点,可用于在场景渲染的时候找到需要的节点 原理概述 OSG::Node节点中有Node::accept(NodeVisitor& nv)方法,NodeVisitor中有nv.apply()方法,根据不同节点类型重载apply()方法,实现对不同类型节点的操作,可以实现对当前节点/当前节点的父节点/当前节点的子节点的访问。 OSG中的NodeVisitor实际上采用观察者模式(Observer Pattern) 方式实现。 观察者模式 意图: 对

周陽讀書 2182

OSG:先导篇 访问器机制

一.简介 osg::NodeVisitor 类是设计模式 Visitor (观察者模式)的实现,osg::NodeVisitor 类继承自 osg::Reference 类 osg::NodeVisitor是一个虚基类,在程序中无法实例化 osg::NodeVisitor中主要有 apply():决定了遍历的方式,可以获得各个节点的属性,也可以修改节点属性          ...

weixin_30716141的博客 324

osg示例解析之osgcamera(1)

osgcamera示例的解析

Frank的专栏 1万+

<7> 场景图形的工作机制 - 1

Referenced 、ref_ptr、osg::NodeVisitor 顶点访问器示例代码 纹理访问器示例代码 节点访问器示例代码

liangfei868的博客 1499

[osg]节点遍历nodevisitor浅析

参考:https://www.cnblogs.com/hzhg/archive/2010/12/17/1908764.html   OSG中节点的访问使用的是一种访问器模式。一个典型的访问器涉及抽象访问者角色(Visitor), 具体访问者(Concrete Visitor), 节点角色(Node)。 OSG中访问者角色为NodeVisitor类,其基本结构如下:   NodeVisitor(T...

weixin_34381687的博客 807

【OSG学习笔记】Day 37: NodeVisitor(顶点访问器)

本文详细介绍了OSG(OpenSceneGraph)中的顶点访问器(Vertex Visitor)技术。顶点访问器基于访问者设计模式,实现了场景结构与操作逻辑的解耦,开发者无需修改引擎源码即可遍历、提取和修改模型顶点数据。文章从设计思想、继承关系、核心API、实战代码和使用场景五个维度进行解析。核心API包括accept()、apply()、traverse()和validNodeMask(),并提供了完整的顶点提取访问器示例代码。顶点访问器广泛应用于数据导出、模型修改、碰撞检测、网格优化和统计分析等场景,

u012739527的博客 585

osg节点访问器

定义好三维的节点场景之后,有时会需要访问其中的节点,包括从头至尾的访问,或者从先向上的访问,这样就需要一个访问器。 osg::NodeVisitor就是这样的一个访问器。它遍历场景节点有几种方式: TRAVERSE_NONE - 仅访问当前节点,不继续遍历 TRAVERSE_PARENTS - 向父节点推进 TRAVERSE_ALL_CHILDREN - 向子节点推进 函数: void tra...

wb175208的专栏 1020

OSG学习:OSG组成(二)——场景树

以下内容来自:  1、《OpenSceneGraph三维渲染引擎编程指南》肖鹏 刘更代 徐明亮 清华大学出版社;  2、《OpenSceneGraph3.0三维视景仿真技术开发详解》国防工业出版社 3、《OpenSceneGraph三维渲染引擎设计与实践》王锐 钱学雷 清华大学出版社 4、自己的总结,包括图。 一 概述   OSG采用包围体层次(Bounding Volume Hi...

韶光 1万+

OSG笔记:NodeVisitor原理

模仿OSG的NodeVisitor机制实现简易访问者模式(Visitor Pattern) Node.h #pragma once #include <iostream> #include <vector> #include "NodeVisitor.h" #include "NodeCallback.h" class NodeVisitor; class Node { ...

Housz的博客 1778
上一篇: c/c++经验总结大全——#、##含义经典使用方式
下一篇: Python总结——(一)Python变量命名规则
赶潮儿
博客等级 码龄9年 2粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值