void clipDisplay()
{
GLdouble eqn[4] = { 0.0, 1.0, 1.0, 0.0 };
GLdouble eqn2[4] = { 1.0, 0.0, 0.0, 0.0 };//两个裁剪平面系数
glColor3f(1.0, 1.0, 1.0);
glPushMatrix();
static float z = 0, k = 0.0;
static float a = 0;
//glTranslatef(0.0, z -= 0.001, 0);//裁剪前进行变化,对裁剪平面产生影响,裁剪平面跟随移动
//clip 裁剪
glClipPlane( GL_CLIP_PLANE0, eqn );
glEnable(GL_CLIP_PLANE0);
//clip 裁剪
glClipPlane(GL_CLIP_PLANE1,eqn2);
glEnable(GL_CLIP_PLANE1);
glTranslatef(0.0, k += 0.001, 0);
glRotatef(a += 0.1, 1.0, 1.0, 1.0);//裁剪后变换,不会对裁剪平面产生影响,裁剪平面不会移动
//绘制球体
GLUquadricObj* qobj = gluNewQuadric(); //二次曲面对象
gluSphere(qobj, 1.0, 20, 16);
glPopMatrix();
}相关推荐
OpenGL之裁剪与颜色混合
裁剪 在OpenGL中提⾼渲染的⼀种方式:只刷新屏幕上发生变化的部分,OpenGL 允许将要进⾏行渲染的窗⼝只去指定⼀个裁剪框; 基本原理:⽤于渲染时限制绘制区域,通过此技术可以再屏幕(帧缓冲)指定一个矩形区域。启用剪裁测试之后,不在此矩形区域内的⽚元被丢弃,只有在此矩形区域内的片元才有可能进⼊帧缓冲,因此实际达到的效果就是在屏幕上开辟了一个⼩窗口,可以再其中进行指定内容的绘制; 裁剪函数: // 开启裁剪测试 glEnable(GL_SCISSOR_TEST); // 关闭裁
OpenGL之裁剪平面
在OpenGL中,除了视景体的6个裁剪面(左、右、顶、底、远和近)外,我们还可以指定最多6个裁剪面。 我们知道,一个平面,它是由Ax+By+Cz+D = 0这个三元一次函数构成。是怎么样一个平面,就由这个函数的系数决定。 那么,有这样一个函数: void glClipPlane(GLenum plane, const GLdouble* equation); 这个函数就是用来指定裁剪面的。
使用MID360在室内快速定位
在预构建的点云地图中实现实时3D全球定位。通过融合FAST-LIO的低频全局定位(约0.5~0.2Hz)和高频里程计,整个系统的计算效率很高。消除里程计的累计误差初始定位可以通过RVIZ的粗略手动估计或来自另一个传感器/算法的姿势来提供。
《OpenGL编程指南》 笔记五 视口变换、剪切与反馈
文章目录第五章 视口变换、剪切与反馈5.1 观察视图5.1.1 视图模型5.1.2 相机模型视锥体视锥体的剪切5.1.3 正交视图模型5.2 用户变换5.2.1 矩阵乘法的回顾5.2.2 齐次坐标进阶:什么是齐次坐标5.2.3 线性变换与矩阵平移缩放旋转透视投影正交投影5.2.4 法线变换5.2.5 OpenGL矩阵OpenGL中的矩阵行与列 第五章 视口变换、剪切与反馈 5.1 观察视图 将三...
Verilog使用inout信号的方法
在FPGA的设计过程中,有时候会遇到双向信号(既能作为输出,也能作为输入的信号叫双向信号)。比如,IIC总线中的SDA信号就是一个双向信号,QSPI Flash的四线操作的时候四根信号线均为双向信号。在Verilog中用关键字inout定义双向信号,这里总结一下双向信号的处理方法。 实际上,双向信号的本质是由一个三态门组成的,三态门...
使用同一个时钟源clki,做两个二分频时钟,得到div2_clk1和div2_clk2,这两个时钟都能跟源时钟clki同步,但是div2_clk1和div2_clk2的相位可能是相同的,也可能是反相
比如,触发器1的初始Q为0,而触发器2的初始Q为1(这可能由于芯片制造工艺的微小差异、上电过程的随机性、或没有全局复位信号导致)。这句话的意思是:虽然div2_clk1和div2_clk2都是由同一个妈妈(clki)生出来的,频率也都是妈妈的一半,但它们“起步”的时刻可能不同。所以,上面那段话是在提醒你注意这种潜在的、由分频产生的时钟相位关系的不确定性,这在异步电路设计或时钟管理中是必须考虑的关键因素。结果:div2_clk1和div2_clk2的波形完全重合,它们的上升沿和下降沿都发生在同一时刻。
OpenGL窗口,视口,裁剪区域
OpenGL基础,窗口 视口 裁剪区域的区别
基于STM32L4XX 、HAL库的ATD5984步进电机驱动器驱动程序应用设计
一、简介: ATD5984是一款内部集成了译码器的微特步进电机 驱动器,能使双极步进电机以全、半、1/4、/1/8、1/16 和1/32步进模式工作。步进模式由逻辑输入管脚MSx选 择。其输出驱动能力达到28V±1.6A。 译码器是ATD5984易于使用的关键,通过STEP管脚 输入一个脉冲就可以使电机完成一次步进,省去了相序 表,高频控制线及复杂的编程接口,使其更适于没有复 杂的微处理器或微处理器负担过重的场合。 在步进操作期间,ATD5984的内部电路可以自动
NeHe OpenGL Lesson26 – Clipping & Reflections Using The Stencil Buffer
This sample shows us how to display a reflection effect with stencil buffer and plane clipping in OpenGL. The stencil buffer usually goes with the depth buffer in the display card, and also call...
【YOLOv8科研级创新】集成HS-FPN特征融合网络,让Neck模块在参数量锐减100W的同时精度跃升
打开确保模型解析器能识别HS_FPN模块。通过将HS-FPN集成到YOLOv8中,我们实现了一个“轻量级多尺度特征融合+精准检测”的目标检测模型。这个改进不仅在工程上能提升多尺度、细粒度场景的检测效果并降低部署成本,更在科研上提供了“选择性轻量级特征融合”的创新思路——这种思路可以延伸到其他检测网络(如Faster R-CNN、SSD)的Neck模块改进中,帮你在论文中打造独特的研究点。
在 SAP 中启用应收/应付“代扣税(Withholding Tax)”功能,本质上是激活并配置“扩展代扣税(Extended Withholding Tax)”模型
摘要:SAP中启用应收/应付代扣税功能需完成3个层级12个核心步骤:1)全局激活公司代码代扣税功能;2)配置代扣税规则、税率和科目,包括定义税种类型、代码、总账科目等;3)在供应商/客户主数据中关联代扣税设置。完成后系统可在发票或付款环节自动计算并过账代扣税,支持多税种并行计算和税率年度调整,最终生成税务报表。常见问题排查需检查公司代码激活状态和主数据配置。(149字)
OpenGL视点变换,模型变换,投影变换,视口变换详解
http://blog.csdn.net/yhb5566/article/details/7714319 OpenGL视点变换,模型变换,投影变换,视口变换详解 作者:luck_net | 出处:博客园 | 2012/2/22 14:46:49 | 阅读112次 OpenGL通过相机模拟、可以实现计算机图形学中最基本的三维变换,即几何变换、
python实现马丁策略(股市) (附完整源码)
python实现马丁策略(股市) (附完整源码)
三维裁剪(OpenGL)glClipPlane(GLenum plane, const GLdouble *equation)
在opengl里的裁减函数实现很容易, //void glClipPlane(GLenum plane, const GLdouble *equation); //定义一个裁剪平面。equation参数指向平面方程Ax + By + Cz + D = 0的4个系数。 //equation = (0, - 1,0, 0),前三个参数(0, - 1, 0)可以理解为法线向下, //只有向下的,
使用 Python 爬取网易云音乐歌单数据(完整教程)
随着在线音乐平台的普及,网易云音乐(NetEase Cloud Music)凭借其个性化的推荐算法和丰富的用户互动,吸引了大量用户。网易云音乐的歌单中包含了丰富的音乐数据,包括歌曲名、歌手、专辑、播放量、评论数等信息。通过爬取这些数据,可以对音乐流行趋势进行分析,挖掘音乐推荐策略,甚至训练个性化推荐模型。网易云音乐的 API 并未官方开放,但开发者通过抓包和逆向分析,找到了若干可用接口。✅ 数据清洗与存储(CSV/数据库)✅ 网易云音乐 API 接口分析。✅ 网易云音乐接口解析。✅ 同步与异步爬取实现。
Statistics and Machine Learning Toolbox
Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具
计算机图形学の多边形裁剪算法(openGL)
二维图形裁剪算法: 参考博客: https://blog.csdn.net/m0_46359746/article/details/106392352 Liang-Barsky 线段裁剪算法: //Liang-Barsky 线段裁剪算法 class wcPt2D { public: GLfloat x,y; public: /* Default Constructor:initalize position 48(0.0,0.0).*/ wcPt2D(){ x=y=0.0; } wc
温度PID控制PLC程序
温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值
OpenGL3.3-裁剪
如何裁剪 判断点与裁剪平面的关系 这是一个三维空间 plane是裁剪平面 P是裁剪平面上的一个点 n是裁剪平面的法线 判断线与裁剪平面的关系 其实从上面我们就能知道 分别通过两个点和裁剪平面的关系我们能知道正负值 这样我们就能知道关系了 当线和裁剪平面相交时 我们应该做的是求交点 然后通过交点裁剪出位于裁剪平面内部的三角形 例如 求点I I = Q1 + t × (Q2-Q1) 如何在四维裁剪 比如我们要对(x,y,z)这个点进行(1,-1)(1,-1)(1,-1)这三个维度进行裁剪 转到(x,y,
深度学习工具包 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")
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
opengl clip plane
红宝书上关于 clipplane 的简单例子. 值得注意的是, clip plane 本身也会受到矩阵变换的影响. 比如 x=0 平面, 表示 x<0 的东西被剪裁掉. 但是,如果在定义这个 clip plane 之前,用了 glTranslatef(-5.0,0,0),x = 0 平面则表示 x<-5 的东西被剪裁掉. #include void init() {
OpenCASCADE PCurve of Topological Face
OpenCASCADE PCurve of Topological Face eryar@163.com Abstract. OpenCASCADE provides a class BRepBuilderAPI_MakeFace to build topological faces. A face maybe built from a surface, elementary surfac...
OpenGl中使用裁剪面缩放图形
编者:李国帅 qq:9611153 微信lgs9611153 时间:2018/11/28 背景原因: 在图形绘制中,需要用到把获取的数据(数据范围-10,10)放入绘图平面,但是由于OpenGL默认坐标值只能从-1到1。直接显示数据矩阵显然不行,那就需要用到缩放。 所需资源: Opengl,vc等开发工具 解决方案: 通用的解决方法就是使用裁剪面的移动来实现。 首先,...
1070



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



