当前位置: 首页 > news >正文

盘锦做网站选哪家seo公司多少钱

盘锦做网站选哪家,seo公司多少钱,宿迁软件开发公司,电商 网站建设开发环境: Windows 11 家庭中文版Microsoft Visual Studio Community 2019VTK-9.3.0.rc0vtk-example demo解决问题: 创建一个带有背景图层和前景图层的渲染窗口,知识点:1. 画布转image;2. 渲染图层设置;3.…

开发环境:

  1. Windows 11 家庭中文版
  2. Microsoft Visual Studio Community 2019
  3. VTK-9.3.0.rc0
  4. vtk-example

demo解决问题: 创建一个带有背景图层和前景图层的渲染窗口,知识点:1. 画布转image;2. 渲染图层设置;3. 相机位置、焦点、距离等属性设置

在这里插入图片描述

  1. 构造imageData对象:程序检查是否提供了输入图像文件名。如果提供了,则使用VTK库中的vtkImageReader2类来读取图像数据,并将其存储在imageData对象中。如果没有提供,则创建一个带有三种颜色的矩形图像。程序使用vtkImageCanvasSource2D类来创建一个画布,并使用其FillBox、FillTriangle和FillTube方法在画布上绘制三种颜色的形状。然后,使用canvasSource->GetOutput()方法获取画布上的图像数据,并将其存储在imageData对象中。

  2. 创建了一个vtkImageActor对象imageActor,并将其设置为显示imageData中的图像数据。然后,程序创建了一个vtkRenderer对象backgroundRenderer,并将其设置为显示imageActor中的图像数据。程序还创建了一个vtkSuperquadricSource对象superquadricSource,并使用其SetPhiRoundness和SetThetaRoundness方法设置超椭球体的形状。然后,程序创建了vtkPolyDataMapper和vtkActor对象来显示超椭球体,并使用colors->GetColor3d方法设置超椭球体的颜色。

  3. 程序创建了一个vtkRenderer对象sceneRenderer,并将其设置为显示超椭球体。然后,程序创建了一个vtkRenderWindow对象renderWindow,并将其设置为显示backgroundRenderer和sceneRenderer中的内容。程序还使用renderWindow->SetWindowName方法设置窗口名称。

  4. 创建了一个vtkRenderWindowInteractor对象renderWindowInteractor,并使用renderWindowInteractor->SetRenderWindow方法将其与renderWindow关联。然后,程序将超椭球体添加到sceneRenderer中,将imageActor添加到backgroundRenderer中。

  5. 程序调用renderWindow->Render方法以确定背景相机的位置。程序使用imageData->GetOrigin、imageData->GetSpacing和imageData->GetExtent方法获取图像数据的原点、间距和范围等信息。然后,程序设置相机的位置、焦点和平行比例等参数以使背景相机填充渲染器中的图像。


prj name: BackgroundImage

#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkImageActor.h>
#include <vtkImageCanvasSource2D.h>
#include <vtkImageData.h>
#include <vtkImageReader2.h>
#include <vtkImageReader2Factory.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkSuperquadricSource.h>#include <array>int main(int argc, char* argv[])
{vtkNew<vtkNamedColors> colors;vtkSmartPointer<vtkImageData> imageData;// Verify input arguments.if (argc > 1){// Read the imagevtkNew<vtkImageReader2Factory> readerFactory;vtkSmartPointer<vtkImageReader2> imageReader;imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));imageReader->SetFileName(argv[1]);imageReader->Update();imageData = imageReader->GetOutput();}else{std::array<double, 3> drawColor1{0, 0, 0};std::array<double, 3> drawColor2{0, 0, 0};std::array<double, 3> drawColor3{0, 0, 0};auto color1 = colors->GetColor3ub("warm_grey").GetData();auto color2 = colors->GetColor3ub("DarkCyan").GetData();auto color3 = colors->GetColor3ub("LightCoral").GetData();for (auto i = 0; i < 3; ++i){drawColor1[i] = color1[i];drawColor2[i] = color2[i];drawColor3[i] = color3[i];}vtkNew<vtkImageCanvasSource2D> canvasSource;canvasSource->SetExtent(0, 100, 0, 100, 0, 0);canvasSource->SetScalarTypeToUnsignedChar();canvasSource->SetNumberOfScalarComponents(3);canvasSource->SetDrawColor(drawColor1.data());canvasSource->FillBox(0, 100, 0, 100);canvasSource->SetDrawColor(drawColor2.data());canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);canvasSource->SetDrawColor(drawColor3.data());canvasSource->FillTube(75, 75, 0, 75, 5.0);canvasSource->Update();imageData = canvasSource->GetOutput();}// Create an image actor to display the image.vtkNew<vtkImageActor> imageActor;imageActor->SetInputData(imageData);// Create a renderer to display the image in the background.vtkNew<vtkRenderer> backgroundRenderer;// Create a superquadric.vtkNew<vtkSuperquadricSource> superquadricSource;superquadricSource->SetPhiRoundness(1.1);superquadricSource->SetThetaRoundness(.2);// Create a mapper and actor.vtkNew<vtkPolyDataMapper> superquadricMapper;superquadricMapper->SetInputConnection(superquadricSource->GetOutputPort());vtkNew<vtkActor> superquadricActor;superquadricActor->SetMapper(superquadricMapper);superquadricActor->GetProperty()->SetColor(colors->GetColor3d("NavajoWhite").GetData());vtkNew<vtkRenderer> sceneRenderer;vtkNew<vtkRenderWindow> renderWindow;// Set up the render window and renderers such that there is// a background layer and a foreground layer.backgroundRenderer->SetLayer(0);backgroundRenderer->InteractiveOff();sceneRenderer->SetLayer(1);renderWindow->SetNumberOfLayers(2);renderWindow->AddRenderer(backgroundRenderer);renderWindow->AddRenderer(sceneRenderer);renderWindow->SetWindowName("BackgroundImage");vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;renderWindowInteractor->SetRenderWindow(renderWindow);// Add actors to the rendererssceneRenderer->AddActor(superquadricActor);backgroundRenderer->AddActor(imageActor);// Render once to figure out where the background camera will be.renderWindow->Render();// Set up the background camera to fill the renderer with the image.double origin[3];double spacing[3];int extent[6];imageData->GetOrigin(origin);imageData->GetSpacing(spacing);imageData->GetExtent(extent);vtkCamera* camera = backgroundRenderer->GetActiveCamera();camera->ParallelProjectionOn();double xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0];double yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1];// double xd = (extent[1] - extent[0] + 1)*spacing[0];double yd = (extent[3] - extent[2] + 1) * spacing[1];double d = camera->GetDistance();camera->SetParallelScale(0.5 * yd);camera->SetFocalPoint(xc, yc, 0.0);camera->SetPosition(xc, yc, d);// Render again to set the correct view.renderWindow->Render();// Interact with the window.renderWindowInteractor->Start();return EXIT_SUCCESS;
}
http://www.hkea.cn/news/93609/

相关文章:

  • 建设银行深分行圳招聘网站做游戏推广一个月能拿多少钱
  • 北京网站建设及推广招聘关键词排名代做
  • 对网站建设的意见建议网络营销推广的方法有哪些
  • 爬虫网站怎么做怎样才能在百度上面做广告宣传
  • 网站页码南昌做seo的公司有哪些
  • 网络设计方案包括哪些深圳百度推广seo公司
  • 亚马逊跨境电商开店站长工具seo综合查询5g
  • 网站怎么做百度快照logo百度快照优化推广
  • 山西网站建设排名seo技术培训山东
  • 日韩系成人影片成首选网站如何优化推广
  • 网站到期续费通知搜索风云排行榜
  • 网站公司说我们做的网站服务器不够用哪个杭州seo好
  • 类似淘宝网站建设费用杭州哪家seo公司好
  • 装修网站怎样做seo专员很难吗
  • 无锡网站外包如何接广告赚钱
  • 英文网站制作 官网淘宝标题优化网站
  • 电力建设网站网络推广网站的方法
  • 如何做网站窗口网站优化网络推广seo
  • 营销型网站建设效果网络营销策划推广方案
  • 专业的网站搭建多少钱网站seo优化价格
  • 广州公司网站设计制作win10优化大师官网
  • 做调查哪个网站比较可靠百度指数查询
  • 怎么在建设厅网站报名广州网站优化服务
  • 怎么用dw做静态网站b站好看的纪录片免费
  • 济南网站建设那家好网站制作公司有哪些
  • 域名和网站名不一样营销公司
  • discuz做电影网站免费网站seo
  • 惠民建设局网站明年2024年有疫情吗
  • 卫龙的网站是谁做的今日的新闻
  • 厚街找人做网站动态网站设计