第05章 17 Contour 过滤器介绍与例子
vtkContourFilter 是 VTK(Visualization Toolkit)中的一个关键类,用于从输入数据生成等值线或等值面。它是基于阈值的过滤器,可以从标量字段中提取等值线或等值面。vtkContourFilter 的核心功能是根据用户指定的值生成等值线或等值面,并将其表示为多边形网格。
vtkContourFilter 的主要功能
- 等值线/等值面生成:根据用户指定的等值(通常是标量值)生成等值线或等值面。
- 多重等值线/等值面:可以同时生成多个等值线或等值面。
- 支持多种数据类型:可以处理结构化网格、非结构化网格、点云等多种数据类型。
- 插值:在生成等值线/等值面时,支持插值操作,以确保生成的表面平滑。
vtkContourFilter 的常用方法
SetValue(int index, double value):设置第index个等值线的值为value。GenerateValues(int numContours, double range[2]):自动生成numContours个等值线,范围在range之间。SetInputData(vtkDataObject input):设置输入数据。Update():更新过滤器并生成输出数据。
vtkContourFilter 的衍生类
vtkContourFilter 是 VTK 中用于生成等值线/等值面的基础类。根据不同的应用场景和需求,VTK 提供了一些专门化的衍生类,这些类继承自 vtkContourFilter,并在其基础上进行了功能扩展或优化。以下是一些常见的 vtkContourFilter 衍生类:
1. vtkMarchingCubes
- 用途:用于从体积数据(如 CT 或 MRI 扫描数据)中提取等值面。
- 特点:使用 marching cubes 算法,能够生成高质量的多边形表面。
- 应用场景:医学图像处理、三维重建。
2. vtkDiscreteMarchingCubes
- 用途:专门用于处理离散数据(如标签映射数据),生成具有明确标签的等值面。
- 特点:生成的等值面具有清晰的边界,适用于分割结果的可视化。
- 应用场景:医学图像分割、地质数据可视化。
3. vtkFlyingEdges3D
- 用途:用于从三维体积数据中提取等值面。
- 特点:使用 flying edges 算法,相比于 marching cubes,计算速度更快,生成的表面质量更高。
- 应用场景:三维体积数据的实时渲染、体绘制。
4. vtkBandedPolyDataContourFilter
- 用途:用于生成带状等值线。
- 特点:可以生成多个连续的等值线,通常用于数据的可视化。
- 应用场景:气象数据中的等压线、地形数据中的等高线。
5. vtkSynchronizedTemplates3D
- 用途:用于从三维体积数据中生成等值面。
- 特点:使用同步模板算法,可以生成平滑的等值面。
- 应用场景:三维体积数据的可视化。
6. vtkSynchronizedTemplatesCutter3D
- 用途:类似于
vtkSynchronizedTemplates3D,但支持通过其他几何体进行切割。 - 特点:可以生成与特定几何体相交的等值面。
- 应用场景:定制化的三维数据可视化。
总结
vtkContourFilter 及其衍生类是 VTK 中用于生成等值线/等值面的核心工具。根据不同的应用场景和需求,用户可以选择合适的类来生成高质量的等值面。例如,vtkMarchingCubes 适用于医学图像中的三维重建,而 vtkFlyingEdges3D 则更适合实时渲染和体绘制。
1. vtkContourFilter
#include <vtkSmartPointer.h>
#include <vtkMarchingCubes.h>
#include <vtkNamedColors.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSampleFunction.h>
#include <vtkSphere.h>
#include <vtkContourFilter.h>int main(int, char *[])
{vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();sphere->SetCenter(0.0, 0.0, 0.0);sphere->SetRadius(1.0);vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();sample->SetImplicitFunction(sphere);sample->SetModelBounds(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5);sample->SetSampleDimensions(50, 50, 50);sample->SetCapping(true);sample->SetCapValue(100);sample->Update();vtkSmartPointer<vtkContourFilter> contourFilter = vtkSmartPointer<vtkContourFilter>::New();contourFilter->SetInputConnection(sample->GetOutputPort());contourFilter->GenerateValues(5, 0.0, 1.0); // 生成5个等值面contourFilter->Update();vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputConnection(contourFilter->GetOutputPort());mapper->ScalarVisibilityOff();vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();renderWindowInteractor->SetRenderWindow(renderWindow);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderWindow->Render();renderWindowInteractor->Start();return 0;
}
解释
- 生成隐式几何体:使用
vtkSphere生成一个球体。 - 采样函数:使用
vtkSampleFunction对球体进行采样,生成一个标量场。 - 等值面生成:使用
vtkContourFilter从采样结果中提取多个等值面。 - 渲染:使用 VTK 的渲染管道将等值面显示出来。
2. vtkMarchingCubes
#include <vtkSmartPointer.h>
#include <vtkNamedColors.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSampleFunction.h>
#include <vtkSphere.h>
#include <vtkMarchingCubes.h>int main(int, char *[])
{vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();sphere->SetCenter(0.0, 0.0, 0.0);sphere->SetRadius(1.0);vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();sample->SetImplicitFunction(sphere);sample->SetModelBounds(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5);sample->SetSampleDimensions(50, 50, 50);sample->SetCapping(true);sample->SetCapValue(100);sample->Update();vtkSmartPointer<vtkMarchingCubes> marchingCubes = vtkSmartPointer<vtkMarchingCubes>::New();marchingCubes->SetInputConnection(sample->GetOutputPort());marchingCubes->SetValue(0, 0.0); // 生成单个等值面marchingCubes->Update();vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputConnection(marchingCubes->GetOutputPort());mapper->ScalarVisibilityOff();vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();renderWindowInteractor->SetRenderWindow(renderWindow);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderWindow->Render();renderWindowInteractor->Start();return 0;
}
解释
- 生成隐式几何体:使用
vtkSphere生成一个球体。 - 采样函数:使用
vtkSampleFunction对球体进行采样,生成一个标量场。 - 等值面生成:使用
vtkMarchingCubes从采样结果中提取单个等值面。 - 渲染:使用 VTK 的渲染管道将等值面显示出来。
3. vtkDiscreteMarchingCubes
#include <vtkSmartPointer.h>
#include <vtkNamedColors.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSampleFunction.h>
#include <vtkSphere.h>
#include <vtkDiscreteMarchingCubes.h>int main(int, char *[])
{vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();sphere->SetCenter(0.0, 0.0, 0.0);sphere->SetRadius(1.0);vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();sample->SetImplicitFunction(sphere);sample->SetModelBounds(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5);sample->SetSampleDimensions(50, 50, 50);sample->SetCapping(true);sample->SetCapValue(100);sample->Update();vtkSmartPointer<vtkDiscreteMarchingCubes> discreteMarchingCubes = vtkSmartPointer<vtkDiscreteMarchingCubes>::New();discreteMarchingCubes->SetInputConnection(sample->GetOutputPort());discreteMarchingCubes->SetValue(0, 100); // 生成单个等值面discreteMarchingCubes->Update();vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputConnection(discreteMarchingCubes->GetOutputPort());mapper->ScalarVisibilityOff();vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();renderWindowInteractor->SetRenderWindow(renderWindow);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderWindow->Render();renderWindowInteractor->Start();return 0;
}
解释
- 生成隐式几何体:使用
vtkSphere生成一个球体。 - 采样函数:使用
vtkSampleFunction对球体进行采样,生成一个标量场。 - 等值面生成:使用
vtkDiscreteMarchingCubes从采样结果中提取单个离散等值面。 - 渲染:使用 VTK 的渲染管道将等值面显示出来。
4. vtkFlyingEdges3D
#include <vtkSmartPointer.h>
#include <vtkNamedColors.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSampleFunction.h>
#include <vtkSphere.h>
#include <vtkFlyingEdges3D.h>int main(int, char *[])
{vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();sphere->SetCenter(0.0, 0.0, 0.0);sphere->SetRadius(1.0);vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();sample->SetImplicitFunction(sphere);sample->SetModelBounds(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5);sample->SetSampleDimensions(50, 50, 50);sample->SetCapping(true);sample->SetCapValue(100);sample->Update();vtkSmartPointer<vtkFlyingEdges3D> flyingEdges = vtkSmartPointer<vtkFlyingEdges3D>::New();flyingEdges->SetInputConnection(sample->GetOutputPort());flyingEdges->GenerateValues(5, 0.0, 1.0); // 生成5个等值面flyingEdges->Update();vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputConnection(flyingEdges->GetOutputPort());mapper->ScalarVisibilityOff();vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();renderWindowInteractor->SetRenderWindow(renderWindow);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderWindow->Render();renderWindowInteractor->Start();return 0;
}
解释
- 生成隐式几何体:使用
vtkSphere生成一个球体。 - 采样函数:使用
vtkSampleFunction对球体进行采样,生成一个标量场。 - 等值面生成:使用
vtkFlyingEdges3D从采样结果中提取多个等值面。 - 渲染:使用 VTK 的渲染管道将等值面显示出来。
5. vtkBandedPolyDataContourFilter
#include <vtkSmartPointer.h>
#include <vtkNamedColors.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSampleFunction.h>
#include <vtkSphere.h>
#include <vtkBandedPolyDataContourFilter.h>int main(int, char *[])
{vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();sphere->SetCenter(0.0, 0.0, 0.0);sphere->SetRadius(1.0);vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();sample->SetImplicitFunction(sphere);sample->SetModelBounds(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5);sample->SetSampleDimensions(50, 50, 50);sample->SetCapping(true);sample->SetCapValue(100);sample->Update();vtkSmartPointer<vtkBandedPolyDataContourFilter> bandedContourFilter = vtkSmartPointer<vtkBandedPolyDataContourFilter>::New();bandedContourFilter->SetInputConnection(sample->GetOutputPort());bandedContourFilter->GenerateValues(5, 0.0, 1.0); // 生成5个带状等值线bandedContourFilter->Update();vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputConnection(bandedContourFilter->GetOutputPort());mapper->ScalarVisibilityOff();vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();renderWindowInteractor->SetRenderWindow(renderWindow);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderWindow->Render();renderWindowInteractor->Start();return 0;
}
解释
- 生成隐式几何体:使用
vtkSphere生成一个球体。 - 采样函数:使用
vtkSampleFunction对球体进行采样,生成一个标量场。 - 等值线生成:使用
vtkBandedPolyDataContourFilter从采样结果中提取多个带状等值线。 - 渲染:使用 VTK 的渲染管道将等值线显示出来。
6. vtkSynchronizedTemplates3D
#include <vtkSmartPointer.h>
#include <vtkNamedColors.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSampleFunction.h>
#include <vtkSphere.h>
#include <vtkSynchronizedTemplates3D.h>int main(int, char *[])
{vtkSmartPointer<vtkSphere> sphere = vtkSmartPointer<vtkSphere>::New();sphere->SetCenter(0.0, 0.0, 0.0);sphere->SetRadius(1.0);vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();sample->SetImplicitFunction(sphere);sample->SetModelBounds(-2.5, 2.5, -2.5, 2.5, -2.5, 2.5);sample->SetSampleDimensions(50, 50, 50);sample->SetCapping(true);sample->SetCapValue(100);sample->Update();vtkSmartPointer<vtkSynchronizedTemplates3D> syncTemplates = vtkSmartPointer<vtkSynchronizedTemplates3D>::New();syncTemplates->SetInputConnection(sample->GetOutputPort());syncTemplates->SetValue(0, 0.0); // 生成单个等值面syncTemplates->Update();vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputConnection(syncTemplates->GetOutputPort());mapper->ScalarVisibilityOff();vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetColor(colors->GetColor3d("MistyRose").GetData());vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();renderWindowInteractor->SetRenderWindow(renderWindow);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());renderWindow->Render();renderWindowInteractor->Start();return 0;
}
解释
- 生成隐式几何体:使用
vtkSphere生成一个球体。 - 采样函数:使用
vtkSampleFunction对球体进行采样,生成一个标量场。 - 等值面生成:使用
vtkSynchronizedTemplates3D从采样结果中提取单个等值面。 - 渲染:使用 VTK 的渲染管道将等值面显示出来。
这些示例代码展示了如何使用 vtkContourFilter 及其衍生类来生成等值线或等值面,并将其渲染出来。每个类都有其特定的应用场景和优势,可以根据具体需求选择合适的类。
相关文章:
第05章 17 Contour 过滤器介绍与例子
vtkContourFilter 是 VTK(Visualization Toolkit)中的一个关键类,用于从输入数据生成等值线或等值面。它是基于阈值的过滤器,可以从标量字段中提取等值线或等值面。vtkContourFilter 的核心功能是根据用户指定的值生成等值线或等值…...
【落羽的落羽 数据结构篇】顺序表
文章目录 一、线性表二、顺序表1. 概念与分类2. 准备工作3. 静态顺序表4. 动态顺序表4.1 定义顺序表结构4.2 顺序表的初始化4.3 检查空间是否足够4.3 尾部插入数据4.4 头部插入数据4.5 尾部删除数据4.6 头部删除数据4.7 在指定位置插入数据4.8 在指定位置删除数据4.9 顺序表的销…...
AI编程:如何编写提示词
这是小卷对AI编程工具学习的第2篇文章,今天讲讲如何编写AI编程的提示词,并结合实际功能需求案例来进行开发 1.编写提示词的技巧 好的提示词应该是:目标清晰明确,具有针对性,能引导模型理解问题 下面是两条提示词的对…...
DeepSeek-R1 论文解读 —— 强化学习大语言模型新时代来临?
近年来,人工智能(AI)领域发展迅猛,大语言模型(LLMs)为通用人工智能(AGI)的发展开辟了道路。OpenAI 的 o1 模型表现非凡,它引入的创新性推理时缩放技术显著提升了推理能力…...
高阶C语言|深入理解字符串函数和内存函数
文章目录 前言1.求字符串长度1.1 字符串长度函数:strlen模拟实现 2.长度不受限制的字符串函数2.1 字符串拷贝函数:strcpy模拟实现 2.2 字符串连接函数:strcat模拟实现 2.3 字符串比较函数:strcmp模拟实现 3.长度受限制的字符串函数…...
UE学习日志#17 C++笔记#3 基础复习3
19.2 [[maybe_unused]] 禁止编译器在未使用某些内容时发出警告 19.3 [[noreturn]] 永远不会把控制权返回给调用点 19.4 [[deprecated]] 标记为已弃用,仍然可以使用但是不鼓励使用 可以加参数表示弃用的原因[[deprecated("")]] 19.5 [[likely]]和[[un…...
团体程序设计天梯赛-练习集——L1-028 判断素数
前言 一道10分的题目,相对来说比较简单,思考的时候要仔细且活跃,有时候在写代码的时候一些代码的出现很多余,并且会影响最后的结果 L1-028 判断素数 本题的目标很简单,就是判断一个给定的正整数是否素数。 输入格式…...
从0开始使用面对对象C语言搭建一个基于OLED的图形显示框架(基础图形库实现)
目录 基础图形库的抽象 抽象图形 抽象点 设计我们的抽象 实现我们的抽象 测试 抽象线 设计我们的抽象 实现我们的抽象 绘制垂直的和水平的线 使用Bresenham算法完成任意斜率的绘制 绘制三角形和矩形 矩形 三角形 实现 绘制圆,圆弧和椭圆 继续我们的…...
创新创业计划书|建筑垃圾资源化回收
目录 第1部分 公司概况........................................................................ 1 第2部分 产品/服务...................................................................... 3 第3部分 研究与开发.................................................…...
反射、枚举以及lambda表达式
一.反射 1.概念:Java的反射(reflection)机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意方法和属性,既然能拿到那么&am…...
ROS应用之IMU碰撞检测与接触事件识别
前言 碰撞检测与接触事件识别是机器人与环境交互中的重要任务,尤其是在复杂的动态环境中。IMU(惯性测量单元)作为一种高频率、低延迟的传感器,因其能够检测加速度、角速度等动态变化而成为实现碰撞检测的核心手段之一。结合先进的…...
docker安装MySQL8:docker离线安装MySQL、docker在线安装MySQL、MySQL镜像下载、MySQL配置、MySQL命令
一、镜像下载 1、在线下载 在一台能连外网的linux上执行docker镜像拉取命令 docker pull mysql:8.0.41 2、离线包下载 两种方式: 方式一: -)在一台能连外网的linux上安装docker执行第一步的命令下载镜像 -)导出 # 导出镜…...
android安卓用Rime
之前 [1] 在 iOS 配置用上自改方案 [2],现想在安卓也用上。Rime 主页推荐了两个安卓平台支持 rime 的输入法 [3]: 同文 Tongwen Rime Input Method Editor,但在我的 Realme X2 Pro 上似乎有 bug:弹出的虚拟键盘只有几个 switcher…...
每日一博 - 三高系统架构设计:高性能、高并发、高可用性解析
文章目录 引言一、高性能篇1.1 高性能的核心意义 1.2 影响系统性能的因素1.3 高性能优化方法论1.3.1 读优化:缓存与数据库的结合1.3.2 写优化:异步化处理 1.4 高性能优化实践1.4.1 本地缓存 vs 分布式缓存1.4.2 数据库优化 二、高并发篇2.1 高并发的核心…...
C++ 中的引用(Reference)
在 C 中,引用(Reference)是一种特殊的变量类型,它提供了一个已存在变量的别名。引用在很多场景下都非常有用,比如函数参数传递、返回值等。下面将详细介绍 C 引用的相关知识。 1. 引用的基本概念和语法 引用是已存在…...
负荷预测算法模型
1. 时间序列分析方法 时间序列分析方法是最早被用来进行电力负荷预测的方法之一,它基于历史数据来构建数学模型,以描述时间与负荷值之间的关系。这种方法通常只考虑时间变量,不需要大量的输入数据,因此计算速度快。然而ÿ…...
【C语言】内存管理
【C语言】内存管理 文章目录 【C语言】内存管理1.概念2.库函数3.动态分配内存malloccalloc 4.重新调整内存的大小和释放内存reallocfree 1.概念 C 语言为内存的分配和管理提供了几个函数。这些函数可以在 <stdlib.h> 头文件中找到。 在 C 语言中,内存是通过…...
deepseek大模型本机部署
2024年1月20日晚,中国DeepSeek发布了最新推理模型DeepSeek-R1,引发广泛关注。这款模型不仅在性能上与OpenAI的GPT-4相媲美,更以开源和创新训练方法,为AI发展带来了新的可能性。 本文讲解如何在本地部署deepseek r1模型。deepseek官…...
动态规划DP 最长上升子序列模型 拦截导弹(题目分析+C++完整代码)
概览检索 动态规划DP 最长上升子序列模型 拦截导弹 原题链接 AcWiing 1010. 拦截导弹 题目描述 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。 但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每…...
缩位求和——蓝桥杯
1.题目描述 在电子计算机普及以前,人们经常用一个粗略的方法来验算四则运算是否正确。 比如:248153720248153720 把乘数和被乘数分别逐位求和,如果是多位数再逐位求和,直到是 1 位数,得 24814>145 156 56 而…...
告别bypy上传失败!用Aria2+百度云直链脚本,让服务器下载速度飙升5倍
告别bypy上传失败!用Aria2百度云直链脚本,让服务器下载速度飙升5倍 如果你经常需要将百度网盘中的大文件(比如几十GB的机器学习模型或数据集)传输到服务器上,一定对bypy的种种限制深有体会——速度慢、不稳定、大文件容…...
从 Spotlight 到 Raycast:一个 Mac 效率控的深度迁移与自定义指南
1. 为什么我从 Spotlight 迁移到 Raycast 作为一个用了十年Mac的老用户,我几乎每天都要和Spotlight打交道。从最初的简单文件搜索,到后来的计算器、词典功能,Spotlight确实帮了我不少忙。但直到去年发现Raycast,我才意识到原来Ma…...
【Hot 100 刷题计划】 LeetCode 138. 随机链表的复制 | C++ 链表深拷贝题解
LeetCode 138. 随机链表的复制 | C 哈希表 DFS 深拷贝题解 📌 题目描述 题目级别:中等 给你一个长度为 n 的链表,每个节点包含一个额外增加的随机指针 random ,该指针可以指向链表中的任何节点或空节点。 请你构造这个链表的深拷…...
PX4飞控系统深度探索:如何用开源技术打造智能无人机控制大脑
PX4飞控系统深度探索:如何用开源技术打造智能无人机控制大脑 【免费下载链接】PX4-Autopilot PX4 Autopilot Software 项目地址: https://gitcode.com/gh_mirrors/px/PX4-Autopilot 想象一下,你正站在一片开阔的试验场上,手里握着一架…...
STM32智能婴儿床系统设计与实现
基于STM32的智能婴儿床系统设计1. 项目概述1.1 系统架构本智能婴儿床系统采用模块化设计架构,以STM32F103RCT6微控制器为核心处理单元,集成多种传感器模块和执行机构。系统通过蓝牙与手机APP建立双向通信,实现环境参数监测、异常报警和远程控…...
告别B站评论区识人难题!这个免费工具让你一键掌握用户背景
告别B站评论区识人难题!这个免费工具让你一键掌握用户背景 【免费下载链接】bilibili-comment-checker B站评论区自动标注成分,支持动态和关注识别以及手动输入 UID 识别 项目地址: https://gitcode.com/gh_mirrors/bil/bilibili-comment-checker …...
FOC算法避坑指南:克拉克变换的‘等幅值’与‘等功率’到底怎么选?基于STM32的实测对比
FOC算法避坑指南:克拉克变换的‘等幅值’与‘等功率’到底怎么选?基于STM32的实测对比 在STM32平台上实现磁场定向控制(FOC)时,克拉克变换系数的选择往往让工程师陷入两难:究竟该用2/3(等幅值&…...
WSABuilds社区活动:线上线下聚会与开发者大会参与指南
WSABuilds社区活动:线上线下聚会与开发者大会参与指南 【免费下载链接】WSABuilds Run Windows Subsystem For Android on your Windows 10 and Windows 11 PC using prebuilt binaries with Google Play Store (MindTheGapps) and/or Magisk or KernelSU (root sol…...
Pixel Fashion Atelier基础教程:硬核8-Bit界面操作逻辑与非对称布局解析
Pixel Fashion Atelier基础教程:硬核8-Bit界面操作逻辑与非对称布局解析 1. 像素时装锻造坊简介 Pixel Fashion Atelier是一款基于Stable Diffusion与Anything-v5的图像生成工具,它彻底改变了传统AI工具的界面设计理念。这款工具将复古日系RPG的"…...
Qwen3-TTS部署案例:车载中控系统离线多语种导航语音引擎集成
Qwen3-TTS部署案例:车载中控系统离线多语种导航语音引擎集成 在智能座舱快速演进的今天,车载语音交互已从“能听清”迈向“听得懂、说得好、有温度”的新阶段。传统TTS方案常受限于网络依赖、语种覆盖窄、响应延迟高、方言适配弱等问题,难以…...
