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);
    }

  • 相关阅读:
    jQuery表单验证以及将表单序列化为json对象小练习
    判断客户端浏览器是否安装了Flash插件
    css文本超出2行就隐藏并显示省略号
    jquery and js 判断一个元素是否存在
    jquery表单实时验证
    trigger()和triggerHandler()
    IE浏览器下面要实现滤镜(transparent),必须要加filter
    使用javascript判断浏览器类型
    web引入
    前端大纲********
  • 原文地址:https://www.cnblogs.com/lizhengjin/p/1547115.html
Copyright © 2011-2022 走看看