上海网站建设,迈/沧州网站优化公司

上海网站建设,迈,沧州网站优化公司,有了域名如何做网站,自动城市定位装修网站建设1、结果 2、完整C代码 #include <sstream> #include <iomanip> #include <iostream> #include <vector> #include <random> #include <cmath> #include <functional> #include <osgViewer/viewer> #include <osgDB/Read…

1、结果
在这里插入图片描述
在这里插入图片描述
2、完整C++代码

#include <sstream>
#include <iomanip>
#include <iostream>
#include <vector>
#include <random>
#include <cmath>
#include <functional>
#include <osgViewer/viewer>
#include <osgDB/ReadFile>
#include <osg/Texture3D>
#include <osg/Texture1D>
#include <osgDB/FileUtils>
#include <osg/Billboard>
#include <osg/TexGenNode>
#include <osg/ClipNode>
#include <osgDB/WriteFile>
#include <osg/Point>
#include <osg/ShapeDrawable>
#include <osg/PositionAttitudeTransform>
#include <osg/MatrixTransform>
#include <osgGA/TrackballManipulator>
#include <osg/ComputeBoundsVisitor>
#include <osg/TransferFunction>
#include <array>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/StateSetManipulator>
#include <osgUtil/SmoothingVisitor>
const std::string DATA_PATH = R"(..\data\)";
const std::string SHADER_PATH = R"(..\shaders\)";
const float RADIUS = 35;//设置热力点的影响半径
struct Point { int x, y; float value; };
// 生成随机数
int getRandomInt(int min, int max) {return min + std::rand() % (max - min + 1);
}// 颜色插值(用于热力图渐变)
osg::Vec4 lerpColor(float value) {value = osg::clampBetween(value, 0.0f, 1.0f);  // 确保 value 在 [0, 1] 范围内osg::Vec4 colors[] = {osg::Vec4(49/255.0, 54/255.0, 149/255.0, value),osg::Vec4(69/255.0, 117/255.0, 180/255.0, value),osg::Vec4(116/255.0, 173/255.0, 209/255.0, value),osg::Vec4(171/255.0, 217/255.0, 233/255.0, value),osg::Vec4(224/255.0, 243/255.0, 248/255.0, value),osg::Vec4(255/255.0, 255/255.0, 191/255.0, value),osg::Vec4(254/255.0, 224/255.0, 144/255.0, value),osg::Vec4(253/255.0, 174/255.0, 97/255.0, value),osg::Vec4(244/255.0, 109/255.0, 67/255.0, value),osg::Vec4(215/255.0, 48/255.0, 39/255.0, value),osg::Vec4(165/255.0, 0.0, 38/255.0, value)};//osg::Vec4 colors[] = {//    osg::Vec4(50 / 255.0, 136 / 255.0, 189 / 255.0, value),   //    osg::Vec4(102 / 255.0, 194 / 255.0, 165 / 255.0, value),//    osg::Vec4(171 / 255.0, 221 / 255.0, 164 / 255.0, value),//    osg::Vec4(230 / 255.0, 245 / 255.0, 152 / 255.0, value),//    osg::Vec4(254 / 255.0, 224 / 255.0, 139 / 255.0, value),//    osg::Vec4(253 / 255.0, 174 / 255.0, 97 / 255.0, value),//    osg::Vec4(244 / 255.0, 109 / 255.0, 67 / 255.0, value),//    osg::Vec4(213 / 255.0, 62 / 255.0, 79 / 255.0, value),//};int numColors = sizeof(colors) / sizeof(colors[0]);float t = value * (numColors - 1);      // 乘以 (数量-1)int index = static_cast<int>(t);// 处理边界情况,避免越界if (index >= numColors - 1) {return colors[numColors - 1];       // 直接返回最后一个颜色}t -= index;// 提取 t 的小数部分,作为插值比例return colors[index] * (1 - t) + colors[index + 1] * t;
}std::vector<Point> generateData(int width, int height, int pointCount)
{std::vector<Point> points;for (int i = 0; i < pointCount; ++i) {points.push_back({ getRandomInt(10, width - 10), getRandomInt(10, height - 10), getRandomInt(0, 100) / 100.0f });}return points;
}// 生成热力图图像
osg::ref_ptr<osg::Image> generateHeatmap(int width, int height, std::vector<Point> points) {osg::ref_ptr<osg::Image> image = new osg::Image();image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE);std::vector<unsigned char> buffer(width * height * 4, 0); // 初始化RGBA缓冲区// 绘制点 (模拟圆形模糊)for (const auto& p : points) {for (int dx = -RADIUS; dx <= RADIUS; ++dx) {for (int dy = -RADIUS; dy <= RADIUS; ++dy) {int px = p.x + dx;//计算当前像素的x坐标int py = p.y + dy;//计算当前像素的y坐标//确保当前像素点在图像范围内if (px >= 0 && px < width && py >= 0 && py < height) {//计算该像素点与中心点的归一化距离float dist = std::sqrt(dx * dx + dy * dy) / RADIUS;//如果距离在热力点影响范围内if (dist <= 1.0f) {//计算当前像素在缓冲区中的索引int index = (py * width + px) * 4;//计算当前像素的影响强度float intensity = (1.0f - dist) * p.value;//叠加透明度float oldAlpha = buffer[index + 3] / 255.0f; // 读取背景透明度(归一化到0~1)float newAlpha = intensity + oldAlpha * (1.0f - intensity); // 计算混合透明度buffer[index + 3] = static_cast<int>(std::min(255.0f, newAlpha * 255)); // 更新透明度}}}}}// 颜色映射for (int i = 0; i < width * height; ++i) {float alpha = buffer[i * 4 + 3] / 255.0f; // 归一化透明度osg::Vec4 color = lerpColor(alpha);buffer[i * 4] = static_cast<unsigned char>(color.r() * 255);buffer[i * 4 + 1] = static_cast<unsigned char>(color.g() * 255);buffer[i * 4 + 2] = static_cast<unsigned char>(color.b() * 255);buffer[i * 4 + 3] = static_cast<unsigned char>(color.a() * 255);}// 复制数据到 osg::Imagememcpy(image->data(), buffer.data(), buffer.size());return image;
}// 生成高度图
osg::ref_ptr<osg::Image> generateHeightmap(int width, int height, std::vector<Point> points)
{osg::ref_ptr<osg::Image> image = new osg::Image;image->allocateImage(width, height, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);std::vector<float> heightBuffer(width * height, 0.0);//浮点型高度缓存// 计算高度影响(使用高斯衰减)for (const auto& p : points){for (int dx = -RADIUS; dx <= RADIUS; ++dx) {for (int dy = -RADIUS; dy <= RADIUS; ++dy) {int px = p.x + dx;int py = p.y + dy;if (px >= 0 && px < width && py >= 0 && py < height){float distance = std::sqrt(dx * dx + dy * dy);if (distance <= RADIUS) {float normalizedDist = distance / RADIUS;//高斯衰减系数float falloff = std::exp(-normalizedDist * normalizedDist * 4.0f);int index = py * width + px;heightBuffer[index] += falloff * p.value;}}}}}// 归一化处理float maxHeight = *std::max_element(heightBuffer.begin(), heightBuffer.end());std::vector<unsigned char> grayBuffer(width * height);for (int i = 0; i < width * height; ++i){float normalized = heightBuffer[i] / maxHeight;grayBuffer[i] = static_cast<unsigned char>(normalized * 255);}memcpy(image->data(), grayBuffer.data(), grayBuffer.size());return image;
}void generateHeatmapTexture()
{std::vector<Point> data = generateData(1024, 1024, 100);osg::ref_ptr<osg::Image> heatmap2dImage = generateHeatmap(1024, 1024, data);osg::ref_ptr<osg::Image> heightmapImage = generateHeightmap(1024, 1024, data);// 使用OSG保存图像if (osgDB::writeImageFile(*heatmap2dImage, "heatmap2d.png")) {std::cout << "Image saved as " << "heatmap_osg.png" << std::endl;}else {std::cerr << "Error saving image." << std::endl;}if (osgDB::writeImageFile(*heightmapImage, "heightmap.png")) {std::cout << "Image saved as " << "heightmap.png" << std::endl;}else {std::cerr << "Error saving image." << std::endl;}
}// 创建地形节点
osg::ref_ptr<osg::Node> createTerrain(osg::Image* heightmap, osg::Image* heatmap) {// 创建几何体osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry();osg::ref_ptr<osg::Geode> geode = new osg::Geode();geode->addDrawable(geometry);// 创建顶点数组osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array();const int width = heightmap->s();const int height = heightmap->t();const float terrainSize = 200.0f; // 地形物理尺寸const float heightScale = 50.0f;  // 高度缩放系数// 生成顶点数据unsigned char* heightData = heightmap->data();for (int y = 0; y < height; ++y) {for (int x = 0; x < width; ++x) {// 计算顶点位置(居中)float xPos = (x - width / 2.0f) * (terrainSize / width);float yPos = (y - height / 2.0f) * (terrainSize / height);float zPos = heightData[y * width + x] / 255.0f * heightScale;vertices->push_back(osg::Vec3(xPos, yPos, zPos));}}// 创建索引数组(三角形带)osg::ref_ptr<osg::DrawElementsUShort> indices =new osg::DrawElementsUShort(GL_TRIANGLES);for (int y = 0; y < height - 1; ++y) {for (int x = 0; x < width - 1; ++x) {// 创建两个三角形组成四边形int i0 = y * width + x;int i1 = i0 + 1;int i2 = i0 + width;int i3 = i2 + 1;indices->push_back(i1);indices->push_back(i2);indices->push_back(i0);indices->push_back(i3);indices->push_back(i2);indices->push_back(i1);}}// 设置几何体数据geometry->setVertexArray(vertices);geometry->addPrimitiveSet(indices);// 自动生成法线osgUtil::SmoothingVisitor::smooth(*geometry);// 创建纹理坐标数组osg::ref_ptr<osg::Vec2Array> texCoords = new osg::Vec2Array();for (int y = 0; y < height; ++y) {for (int x = 0; x < width; ++x) {// 归一化纹理坐标 [0,1]float u = static_cast<float>(x) / (width - 1);float v = static_cast<float>(y) / (height - 1);texCoords->push_back(osg::Vec2(u, v));}}geometry->setTexCoordArray(0, texCoords);// 应用纹理osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D();texture->setImage(heatmap);texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);osg::StateSet* stateset = geode->getOrCreateStateSet();stateset->setTextureAttributeAndModes(0, texture);stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);stateset->setMode(GL_BLEND, osg::StateAttribute::ON);return geode;
}osg::Geode* createHeatmap3D() {const int GRID_SIZE = 256;osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;osg::ref_ptr<osg::Vec2Array> texCoords = new osg::Vec2Array;for (int y = 0; y < GRID_SIZE; ++y) {for (int x = 0; x < GRID_SIZE; ++x) {float u = x / (GRID_SIZE - 1.0f);float v = y / (GRID_SIZE - 1.0f);vertices->push_back(osg::Vec3(u * 100 - 50, v * 100 - 50, 0)); // 居中显示texCoords->push_back(osg::Vec2(u, v));}}// 创建索引osg::ref_ptr<osg::DrawElementsUInt> indices =new osg::DrawElementsUInt(GL_TRIANGLES);for (int y = 0; y < GRID_SIZE - 1; ++y) {for (int x = 0; x < GRID_SIZE - 1; ++x) {int i0 = y * GRID_SIZE + x;int i1 = i0 + 1;int i2 = i0 + GRID_SIZE;int i3 = i2 + 1;indices->push_back(i1);indices->push_back(i2);indices->push_back(i0);indices->push_back(i3);indices->push_back(i2);indices->push_back(i1);}}geom->setVertexArray(vertices);geom->setTexCoordArray(0, texCoords);geom->addPrimitiveSet(indices);osgUtil::SmoothingVisitor::smooth(*geom);osg::Geode* geode = new osg::Geode;geode->addDrawable(geom);return geode;
}osg::Texture2D* createTexture(osg::Image* image) {osg::Texture2D* tex = new osg::Texture2D;tex->setImage(image);tex->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);tex->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);return tex;
}void setupStateSet(osg::Geode* geode) {osg::StateSet* ss = geode->getOrCreateStateSet();// 混合设置ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);ss->setMode(GL_BLEND, osg::StateAttribute::ON);std::vector<Point> data = generateData(256, 256, 100);osg::ref_ptr<osg::Image> heatmap2dImage1 = generateHeatmap(256, 256, data);osg::ref_ptr<osg::Image> heightmapImage1 = generateHeightmap(256, 256, data);struct Textures {osg::ref_ptr<osg::Texture2D> current;osg::ref_ptr<osg::Texture2D> next;float transition = 0.0f;bool updating = false;};Textures heightTex, heatmapTex;// 初始纹理heightTex.current = createTexture(heightmapImage1);heatmapTex.current = createTexture(heatmap2dImage1);data = generateData(256, 256, 200);osg::ref_ptr<osg::Image> heatmap2dImage2 = generateHeatmap(256, 256, data);osg::ref_ptr<osg::Image> heightmapImage2 = generateHeightmap(256, 256, data);heightTex.next = createTexture(heightmapImage2);heatmapTex.next = createTexture(heatmap2dImage2);osg::Program* program = new osg::Program;ss->setAttribute(program);program->addShader(osgDB::readRefShaderFile(osg::Shader::VERTEX, SHADER_PATH + R"(heatmap3d.vert)"));program->addShader(osgDB::readRefShaderFile(osg::Shader::FRAGMENT, SHADER_PATH + R"(heatmap3d.frag)"));ss->setAttributeAndModes(program);program->addBindAttribLocation("texCoord", osg::Drawable::TEXTURE_COORDS_0);// 绑定纹理单元ss->setTextureAttribute(0, heightTex.current);ss->setTextureAttribute(1, heightTex.next);ss->setTextureAttribute(2, heatmapTex.current);ss->setTextureAttribute(3, heatmapTex.next);// Uniform绑定ss->addUniform(new osg::Uniform("heightMap", 0));ss->addUniform(new osg::Uniform("nextHeightMap", 1));ss->addUniform(new osg::Uniform("heatmap", 2));ss->addUniform(new osg::Uniform("nextHeatmap", 3));ss->addUniform(new osg::Uniform("transitionProgress", 0.0f));
}osg::Timer_t startTime;
bool startSimulate = false;
class KeyboardEventHandler : public osgGA::GUIEventHandler {
public:KeyboardEventHandler(){}bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) override {if (ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN) {switch (ea.getKey()) {case 't':  if (!startSimulate){startTime = osg::Timer::instance()->tick();startSimulate = true;}return true;default:return false;}}return false;}private:
};class TimeUpdateCallback : public osg::NodeCallback
{
public:TimeUpdateCallback()  {}virtual void operator()(osg::Node* node, osg::NodeVisitor* nv){if (startSimulate){osg::StateSet* ss = node->getStateSet();if (ss){float time = osg::Timer::instance()->delta_s(startTime, osg::Timer::instance()->tick()) / 3.0f;time = osg::clampBetween(time, 0.0f, 1.0f);if (time == 1.0){std::random_device rd;  // 用于获取随机种子std::mt19937 gen(rd()); // 使用 Mersenne Twister 算法// 定义一个分布范围 [100, 200]std::uniform_int_distribution<> dis(100, 200);std::vector<Point> data = generateData(256, 256, dis(gen));osg::ref_ptr<osg::Image> heatmap2dImage = generateHeatmap(256, 256, data);osg::ref_ptr<osg::Image> heightmapImage = generateHeightmap(256, 256, data);ss->setTextureAttribute(0, ss->getTextureAttribute(1, osg::StateAttribute::TEXTURE));ss->setTextureAttribute(1, createTexture(heightmapImage));ss->setTextureAttribute(2, ss->getTextureAttribute(3, osg::StateAttribute::TEXTURE));ss->setTextureAttribute(3, createTexture(heatmap2dImage));ss->getUniform("transitionProgress")->set(0.0f);startTime = osg::Timer::instance()->tick();}elsess->getUniform("transitionProgress")->set(time);}traverse(node, nv);}}};int preview3DHeatmapWithAnimate()
{osg::Geode* geode = createHeatmap3D();setupStateSet(geode);geode->setUpdateCallback(new TimeUpdateCallback());osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;osg::ref_ptr<osg::Group> group = new osg::Group;group->addChild(geode);viewer->setSceneData(group);viewer->addEventHandler(new osgGA::StateSetManipulator(viewer->getCamera()->getOrCreateStateSet()));viewer->addEventHandler(new osgViewer::StatsHandler());osg::ref_ptr<KeyboardEventHandler> keyboardHandler = new KeyboardEventHandler;viewer->addEventHandler(keyboardHandler);return viewer->run();
}int preview3DHeatmap()
{std::vector<Point> data = generateData(256, 256, 100);osg::ref_ptr<osg::Image> heatmap2dImage = generateHeatmap(256, 256, data);osg::ref_ptr<osg::Image> heightmapImage = generateHeightmap(256, 256, data);osg::ref_ptr<osg::Node> node = createTerrain(heightmapImage, heatmap2dImage);osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;osg::ref_ptr<osg::Group> group = new osg::Group;group->addChild(node);viewer->setSceneData(group);viewer->addEventHandler(new osgGA::StateSetManipulator(viewer->getCamera()->getOrCreateStateSet()));viewer->addEventHandler(new osgViewer::StatsHandler());return viewer->run();
}int preview2DHeatmap() {std::vector<Point> data = generateData(256, 256, 100);osg::ref_ptr<osg::Image> heatmap2dImage = generateHeatmap(256, 256, data);// 创建带纹理的四边形几何体osg::ref_ptr<osg::Geometry> quad = osg::createTexturedQuadGeometry(osg::Vec3(-1.0f, -1.0f, 0.0f), // 左下角顶点osg::Vec3(2.0f, 0.0f, 0.0f),  // 宽度向量osg::Vec3(0.0f, 2.0f, 0.0f),  // 高度向量0.0f, 0.0f, 1.0f, 1.0f        // 纹理坐标 (左下角到右上角));osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;texture->setImage(heatmap2dImage);osg::ref_ptr<osg::StateSet> stateSet = quad->getOrCreateStateSet();stateSet->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);// 创建Geode并添加几何体osg::ref_ptr<osg::Geode> geode = new osg::Geode;geode->addDrawable(quad);// 创建场景图根节点osg::ref_ptr<osg::Group> root = new osg::Group;root->addChild(geode);// 创建并设置ViewerosgViewer::Viewer viewer;viewer.setSceneData(root);return viewer.run();
}int main()
{//return preview2DHeatmap();//return preview3DHeatmap();return preview3DHeatmapWithAnimate();
}

3、着色器代码

//heatmap3d.vert
#version 110
/* GLSL 1.10需要显式声明精度 (OpenGL ES要求) */
#ifdef GL_ES
precision highp  float;
#endif
/* 自定义 uniforms */
uniform sampler2D heightMap;
uniform sampler2D nextHeightMap;
uniform float transitionProgress;
attribute vec2 texCoord;
// 输入纹理坐标属性(对应几何体的第0层纹理)
varying vec2 vTexCoord;void main() {float x = gl_Vertex.x;float y = gl_Vertex.y;vTexCoord = texCoord;// 使用 texture2D 代替 texture 函数float currentHeight = texture2D(heightMap, texCoord.xy).r * 50.0;float nextHeight = texture2D(nextHeightMap, texCoord.xy).r * 50.0;// 高度插值计算float finalHeight = mix(currentHeight, nextHeight, transitionProgress);// 坐标变换vec4 pos = vec4(x, y, finalHeight, 1.0);gl_Position = gl_ModelViewProjectionMatrix * pos;
}
//heatmap3d.frag
#version 110
/* GLSL 1.10需要显式声明精度 (OpenGL ES要求) */
#ifdef GL_ES
precision mediump float;
#endifuniform sampler2D heatmap;
uniform sampler2D nextHeatmap;
uniform float transitionProgress;
varying vec2 vTexCoord;void main() {// 使用texture2D替代texture函数vec4 currentColor = texture2D(heatmap, vTexCoord);vec4 nextColor = texture2D(nextHeatmap, vTexCoord);// 使用gl_FragColor替代自定义输出gl_FragColor = mix(currentColor, nextColor, transitionProgress);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/73713.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Pycharm 社区版安装教程

找到安装包双击安装文件---点击下一步 一般路径是&#xff1a;C:\Rambo\Software\Development 选择完成后就是如下地址&#xff1a; C:\Rambo\Software\Development\PyCharm Community Edition 2024.3.3 点击上述3个位置就可以了----下一步 等待安装就可以了---完成后点击完成…

Mermaid 子图 + 拖拽缩放:让流程图支持无限细节展示

在技术文档、项目管理和可视化分析中&#xff0c;流程图是传递复杂逻辑的核心工具。传统流程图往往静态且难以适应细节展示&#xff0c;而 Mermaid 与 svg-pan-zoom 的结合&#xff0c;则为这一痛点提供了完美解决方案。本文将深入解析如何通过 Mermaid 的子图&#xff08;subg…

Nature | TabPFN:表格基础模型用于小规模数据分析

表格数据是按行和列组织的电子表格形式&#xff0c;在从生物医学、粒子物理到经济学和气候科学等各个科学领域中无处不在 。基于表格其余列来填充标签列缺失值的基本预测任务&#xff0c;对于生物医学风险模型、药物研发和材料科学等各种应用至关重要。尽管深度学习彻底改变了从…

stable Diffusion 中的 VAE是什么

在Stable Diffusion中&#xff0c;VAE&#xff08;Variational Autoencoder&#xff0c;变分自编码器&#xff09;是一个关键组件&#xff0c;用于生成高质量的图像。它通过将输入图像编码到潜在空间&#xff08;latent space&#xff09;&#xff0c;并在该空间中进行操作&…

从零开始 | C语言基础刷题DAY3

❤个人主页&#xff1a;折枝寄北的博客 目录 1.打印3的倍数的数2.从大到小输出3. 打印素数4.打印闰年5.最大公约数 1.打印3的倍数的数 题目&#xff1a; 写一个代码打印1-100之间所有3的倍数的数字 代码&#xff1a; int main(){int i 0;for (i 1; i < 100; i){if (i % …

QT5.15.2加载pdf为QGraphicsScene的背景

5.15.2使用pdf 必须要安装QT源码&#xff0c;可以看到编译器lib目录已经有pdf相关的lib文件&#xff0c;d是debug 1.找到源码目录&#xff1a;D:\soft\QT\5.15.2\Src\qtwebengine\include 复制这两个文件夹到编译器的包含目录中:D:\soft\QT\5.15.2\msvc2019_64\include 2.找…

MCP 开放协议

本文翻译整理自&#xff1a; https://modelcontextprotocol.io/introduction 文章目录 简介一、关于 MCP二、为什么选择MCP&#xff1f;通用架构 三、开始使用1、快速入门2、示例 四、教程五、探索 MCP六、贡献和支持反馈贡献支持和反馈 服务器开发者一、构建服务器1、我们将要…

GaussDB备份数据常用命令

1、常用备份命令gs_dump 说明&#xff1a;是一个服务器端工具&#xff0c;可以在线导出数据库的数据&#xff0c;这些数据包含整个数据库或数据库中指定的对象&#xff08;如&#xff1a;模式&#xff0c;表&#xff0c;视图等&#xff09;&#xff0c;并且支持导出完整一致的数…

ctfshow-萌新赛刷题笔记

1. 给她 启动靶机&#xff0c;发现是sql注入&#xff0c;尝试后发现被转义\&#xff0c;思路到这里就断了&#xff0c;再看题目给她&#xff0c;想到git.有可能是.git文件泄露&#xff0c;dirsearch扫描一下果然是&#xff0c;用GitHack看一下git备份文件&#xff0c;得到hint…

Transformer:GPT背后的造脑工程全解析(含手搓过程)

Transformer&#xff1a;GPT背后的"造脑工程"全解析&#xff08;含手搓过程&#xff09; Transformer 是人工智能领域的革命性架构&#xff0c;通过自注意力机制让模型像人类一样"全局理解"上下文关系。它摒弃传统循环结构&#xff0c;采用并行计算实现高…

MySQL高频八股——事务过程中Undo log、Redo log、Binlog的写入顺序(涉及两阶段提交)

大家好&#xff0c;我是钢板兽&#xff01; 在上一篇文章中&#xff0c;我分别介绍了 Undo Log、Redo Log 和 Binlog 在事务执行过程中的作用与写入机制。然而&#xff0c;实际应用中&#xff0c;这三种日志的写入是有先后顺序的。因此&#xff0c;本篇文章将深入探讨它们的写…

AI自动文献综述——python先把知网的文献转excel

第一步 Refworks转excel 下载以后是个txt文件, 帮我把这个txt文件转excel,用函数形式来写便于我后期整理成软件 提取 其中的 标题,作者,单位,关键词,摘要。 分别存入excel列。 import re import pandas as pddef extract_and_convert(txt_file_path, output_excel_path…

树莓派学习:环境配置

目录 树莓派镜像工具下载 树莓派环境配置 通过Putty连接树莓派 使用树莓派的VNC 在树莓派上面进行简单的编程工作 C语言输出”hello 树莓派” Python输出”hello 树莓派” 总结与思考 树莓派镜像工具下载 在开始配置树莓派环境之前&#xff0c;首先需要下载树莓派镜像…

STC89C52单片机学习——第22节: LED点阵屏显示图形动画

写这个文章是用来学习的,记录一下我的学习过程。希望我能一直坚持下去,我只是一个小白,只是想好好学习,我知道这会很难&#xff0c;但我还是想去做&#xff01; 本文写于&#xff1a;2025.03.16 51单片机学习——第22节: LED点阵屏显示图形&动画 前言开发板说明引用解答和…

浅谈数据分析及数据思维

目录 一、数据分析及数据分析思维&#xff1f;1.1 数据分析的本质1.2 数据分析思维的本质1.2.1 拥有数据思维的具体表现1.2.2 如何培养自己的数据思维1.2.2.1 书籍1.2.2.2 借助工具1.2.2.3 刻意练习 二、数据分析的价值及必备能力&#xff1f;2.1 数据分析的价值2.1.1 现状分析…

Cursor的使用感受,帮你使用好自动化编程工具,整理笔记

使用感受 说实话&#xff0c;我觉得cursor还是好用的&#xff0c;可能我刚开始使用&#xff0c;没有使用的非常的熟练&#xff0c;运用也没有非常的透彻&#xff0c;总体体验还是不错的&#xff0c;在使用它时&#xff0c;我优先考虑&#xff0c;前端页面功能复用的时候&#…

SSM框架——Spring面试题

Spring常见面试题 Spring框架中的单例bean是线程安全的吗 不是线程安全的 Spring框架中有一个Scope注解&#xff0c;默认的值就是singleton&#xff0c;单例的。 因为一般在spring的bean的中都是注入无状态的对象&#xff0c;没有线程安全问题&#xff0c;如果在bean中定义了可…

20250317笔记本电脑在ubuntu22.04下使用acpi命令查看电池电量

20250317笔记本电脑在ubuntu22.04下使用acpi命令查看电池电量 2025/3/17 18:05 百度&#xff1a;ubuntu查看电池电量 百度为您找到以下结果 ubuntu查看电池电量 在Ubuntu操作系统中&#xff0c;查看电池电量通常可以通过命令行或者图形界面来完成。下面是一些常见的方法&…

SpringBoot第三站:配置嵌入式服务器使用外置的Servlet容器

目录 1. 配置嵌入式服务器 1.1 如何定制和修改Servlet容器的相关配置 1.server.port8080 2. server.context-path/tx 3. server.tomcat.uri-encodingUTF-8 1.2 注册Servlet三大组件【Servlet&#xff0c;Filter&#xff0c;Listener】 1. servlet 2. filter 3. 监听器…

C# WPF编程-启动新窗口

C# WPF编程-启动新窗口 新建窗口&#xff1a; 工程》添加》窗口 命名并添加新的窗口 这里窗口名称为Window1.xaml 启动新窗口 Window1 win1 new Window1(); win1.Show(); // 非模态启动窗口win1.ShowDialog(); // 模态启动窗口 模态窗口&#xff1a;当一个模态窗口被打开时&a…