zoukankan      html  css  js  c++  java
  • vtkMapper相关类的分析及重写vtkMapper实现自定义的一些效果 (1)vtkAbstractMapper3D

         This software is distributed WITHOUT ANY WARRANTY; without even
         the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
         PURPOSE.  See the above copyright notice for more information.

    =========================================================================*/
    #include "vtkAbstractMapper3D.h"
    #include "vtkDataSet.h"
    #include "vtkMath.h"

    vtkCxxRevisionMacro(vtkAbstractMapper3D, "$Revision: 1.19 $");

    // Construct with initial range (0,1).
    vtkAbstractMapper3D::vtkAbstractMapper3D()
    {
      vtkMath::UninitializeBounds(this->Bounds);//把包围盒初始化
      this->Center[0] = this->Center[1] = this->Center[2] = 0.0;
    }

    // Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
    void vtkAbstractMapper3D::GetBounds(double bounds[6])//返回此Mapper的包围盒
    {
      this->GetBounds();
      for (int i=0; i<6; i++)
        {
        bounds[i] = this->Bounds[i];
        }
    }

    double *vtkAbstractMapper3D::GetCenter()//得到包围盒的中心
    {
      this->GetBounds();
      for (int i=0; i<3; i++)
        {
        this->Center[i] = (this->Bounds[2*i+1] + this->Bounds[2*i]) / 2.0;
        }
      return this->Center;
    }

    double vtkAbstractMapper3D::GetLength()//得到包围盒对角线的长度,其实也是物体包围球的半径
    {
      double diff, l=0.0;
      int i;

      this->GetBounds();
      for (i=0; i<3; i++)
        {
        diff = this->Bounds[2*i+1] - this->Bounds[2*i];
        l += diff * diff;
        }
     
      return sqrt(l);
    }

    void vtkAbstractMapper3D::PrintSelf(ostream& os, vtkIndent indent)
    {
      this->Superclass::PrintSelf(os,indent);
    }

  • 相关阅读:
    Tomcat环境的搭建(web基础学习笔记一)
    子查询二(在HAVING子句中使用子查询)
    子查询一(WHERE中的子查询)
    分组统计查询(学习笔记)
    Oracle体系结构一(学习笔记)
    表分区(学习笔记)
    索引(学习笔记)
    序列(学习笔记)
    触发器七(复合触发器)(学习笔记)
    触发器六(系统触发器)(学习笔记)
  • 原文地址:https://www.cnblogs.com/lizhengjin/p/1547115.html
Copyright © 2011-2022 走看看