1. 4*4矩阵类vtkMatrix4x4

  接口函数:void SetElement(int i, int j, double value),i行、j列的值为value

 #ifndef INITIAL_OPENGL
#define INITIAL_OPENGL
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
VTK_MODULE_INIT(vtkRenderingFreeType)
#endif
#include <iostream>
using namespace std;
#include<vtkSmartPointer.h>
#include<vtkPerspectiveTransform.h>
#include <vtkMatrix4x4.h>
#include <vtkTransform.h> int main()
{
vtkSmartPointer<vtkMatrix4x4> m=vtkSmartPointer<vtkMatrix4x4>::New();
double ma[][]={{,,,},
{,,,},
{,,,},
{,,,}};
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
//void SetElement(int i, int j, double value),i行、j列的值为value
m->SetElement(i,j,ma[i][j]);
}
}
//普通变换
vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
transform->SetMatrix(m);
double p[]={,,};//原始点
double normalProjection[];//投影变换后的点坐标
transform->TransformPoint(p,normalProjection);
cout<<"Original point :"<<p[]<<","<<p[]<<","<<p[]<<endl;
cout<<"Standard projection:"<<normalProjection[]<<","<<normalProjection[]<<","<<normalProjection[]<<endl;
//透视投影变换
double perspectiveProjection[];
vtkSmartPointer<vtkPerspectiveTransform>perspectiveTransform=vtkSmartPointer<vtkPerspectiveTransform>::New();
perspectiveTransform->SetMatrix(m);
perspectiveTransform->TransformPoint(p,perspectiveProjection);
cout<<"Perspective projection:"<<perspectiveProjection[]<<","<<perspectiveProjection[]<<","<<perspectiveProjection[]<<endl;
return ;
}
#ifndefINITIAL_OPENGL
#defineINITIAL_OPENGL
#include<vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
VTK_MODULE_INIT(vtkRenderingFreeType)
#endif
#include<iostream>
usingnamespacestd;
#include<vtkSmartPointer.h>
#include<vtkPerspectiveTransform.h>
#include<vtkMatrix4x4.h>
#include<vtkTransform.h>

intmain()
{
vtkSmartPointer<vtkMatrix4x4>m=vtkSmartPointer<vtkMatrix4x4>::New();
doublema[][]={{,,,},
{,,,},
{,,,},
{,,,}};
for(inti=;i<;i++)
{
for(intj=;j<;j++)
{
//voidSetElement(inti,intj,doublevalue),i行、j列的值为value
m->SetElement(i,j,ma[i][j]);
}
}
//普通变换
vtkSmartPointer<vtkTransform>transform=vtkSmartPointer<vtkTransform>::New();
transform->SetMatrix(m);
doublep[]={,,};//原始点
doublenormalProjection[];//投影变换后的点坐标
transform->TransformPoint(p,normalProjection);
cout<<"Originalpoint:"<<p[]<<","<<p[]<<","<<p[]<<endl;
cout<<"Standardprojection:"<<normalProjection[]<<","<<normalProjection[]<<","<<normalProjection[]<<endl;
//透视投影变换
doubleperspectiveProjection[];
vtkSmartPointer<vtkPerspectiveTransform>perspectiveTransform=vtkSmartPointer<vtkPerspectiveTransform>::New();
perspectiveTransform->SetMatrix(m);
perspectiveTransform->TransformPoint(p,perspectiveProjection);
cout<<"Perspectiveprojection:"<<perspectiveProjection[]<<","<<perspectiveProjection[]<<","<<perspectiveProjection[]<<endl;
return;
}

												

vtkTransform实例 1的更多相关文章

  1. 最近学习工作流 推荐一个activiti 的教程文档

    全文地址:http://www.mossle.com/docs/activiti/ Activiti 5.15 用户手册 Table of Contents 1. 简介 协议 下载 源码 必要的软件 ...

  2. js-静态、原型、实例属性

    本篇来说一下js中的属性: 1.静态属性 2.原型属性 3.实例属性 静态属性: function klass(){} var obj=new klass(); klass.count=0; klas ...

  3. ZIP压缩算法详细分析及解压实例解释

    最近自己实现了一个ZIP压缩数据的解压程序,觉得有必要把ZIP压缩格式进行一下详细总结,数据压缩是一门通信原理和计算机科学都会涉及到的学科,在通信原理中,一般称为信源编码,在计算机科学里,一般称为数据 ...

  4. EntityFramework Core 1.1是如何创建DbContext实例的呢?

    前言 上一篇我们简单讲述了在EF Core1.1中如何进行迁移,本文我们来讲讲EF Core1.1中那些不为人知的事,细抠细节,从我做起. 显式创建DbContext实例 通过带OnConfiguri ...

  5. redis集成到Springmvc中及使用实例

    redis是现在主流的缓存工具了,因为使用简单.高效且对服务器要求较小,用于大数据量下的缓存 spring也提供了对redis的支持: org.springframework.data.redis.c ...

  6. 流程开发Activiti 与SpringMVC整合实例

    流程(Activiti) 流程是完成一系列有序动作的概述.每一个节点动作的结果将对后面的具体操作步骤产生影响.信息化系统中流程的功能完全等同于纸上办公的层级审批,尤其在oa系统中各类电子流提现较为明显 ...

  7. UWP开发之Template10实践:本地文件与照相机文件操作的MVVM实例(图文付原代码)

    前面[UWP开发之Mvvmlight实践五:SuspensionManager中断挂起以及复原处理]章节已经提到过Template10,为了认识MvvmLight的区别特做了此实例. 原代码地址:ht ...

  8. echarts+php+mysql 绘图实例

    最近在学习php+mysql,因为之前画图表都是直接在echart的实例demo中修改数据,便想着两相结合练习一下,通过ajax调用后台数据画图表. 我使用的是echart3,相比较第二版,echar ...

  9. 【HanLP】HanLP中文自然语言处理工具实例演练

    HanLP中文自然语言处理工具实例演练 作者:白宁超 2016年11月25日13:45:13 摘要:HanLP是hankcs个人完成一系列模型与算法组成的Java工具包,目标是普及自然语言处理在生产环 ...

随机推荐

  1. Would Your Work Habits Change if You Were Paid by the Job?

    原文地址:http://success-sys.com/2016/09/26/would-your-work-habits-change-if-you-were-paid-by-the-job/ A ...

  2. mysql数据库主从及主主复制配置演示

    实验系统:CentOS 6.6_x86_64 实验前提:提前准备好编译环境,防火墙和selinux都关闭 实验说明:本实验共有2台主机,IP分配如拓扑 实验软件:mariadb-10.0.20 实验拓 ...

  3. Nginx+PHP On windows

    前期准备 Nginx 下载 http://nginx.org/   PHP下载 PHP Windows binaries       问题 问题1: opened a DOS window to la ...

  4. [转]Code! MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on (C#)

    本文转自:https://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-o ...

  5. Practical oral English

    1.如果你继续发烧,我就去请医生过来If your fever continues, I'll send for the doctor.2.在这么大的停车场里,我是永远都找不到我的车的I'll nev ...

  6. noip2016十连测题解

    以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #incl ...

  7. IE6读取不到样式文件bug

    早年的东东,贴出来充一下数吧~ 问题描述 在一个弹层优化需求中,完成了修改后,刷一下其他(除IE6外)浏览器,很给力,展现都一个样: 再刷下IE6,傻眼了: 初步分析 IE6问题多我知道,不过像这样的 ...

  8. [LeetCode] Total Hamming Distance 全部汉明距离

    The Hamming distance between two integers is the number of positions at which the corresponding bits ...

  9. [LeetCode] Android Unlock Patterns 安卓解锁模式

    Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total ...

  10. [LeetCode] Word Search II 词语搜索之二

    Given a 2D board and a list of words from the dictionary, find all words in the board. Each word mus ...