DGtal  0.9.3
Public Member Functions | Data Fields
DGtal::Viewer3D< Space, KSpace >::CompFarthestPolygonFromCamera Struct Reference

#include <DGtal/io/viewers/Viewer3D.h>

Public Member Functions

bool operator() (typename Viewer3D< Space, KSpace >::PolygonD3D q1, typename Viewer3D< Space, KSpace >::PolygonD3D q2)
 

Data Fields

qglviewer::Vec posCam
 

Detailed Description

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
struct DGtal::Viewer3D< Space, KSpace >::CompFarthestPolygonFromCamera

Used to sort pixel from camera

Definition at line 938 of file Viewer3D.h.

Member Function Documentation

◆ operator()()

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
bool DGtal::Viewer3D< Space, KSpace >::CompFarthestPolygonFromCamera::operator() ( typename Viewer3D< Space, KSpace >::PolygonD3D  q1,
typename Viewer3D< Space, KSpace >::PolygonD3D  q2 
)
inline

Definition at line 941 of file Viewer3D.h.

References DGtal::Viewer3D< Space, KSpace >::closeEvent(), DGtal::Viewer3D< Space, KSpace >::domElement(), DGtal::Viewer3D< Space, KSpace >::draw(), DGtal::Viewer3D< Space, KSpace >::drawWithNames(), DGtal::Viewer3D< Space, KSpace >::helpString(), DGtal::Viewer3D< Space, KSpace >::init(), DGtal::Viewer3D< Space, KSpace >::initFromDOMElement(), DGtal::Viewer3D< Space, KSpace >::postSelection(), and DGtal::Display3D< Space, KSpace >::PolygonD3D::vertices.

943  {
944  double c1x=0.0, c1y=0.0, c1z=0.0;
945  double c2x=0.0, c2y=0.0, c2z=0.0;
946  for(unsigned int i=0; i< q1.vertices.size(); i++){
947  c1x+=q1.vertices.at(i)[0];
948  c1y+=q1.vertices.at(i)[1];
949  c1z+=q1.vertices.at(i)[2];
950  }
951  for(unsigned int i=0; i< q2.vertices.size(); i++){
952  c2x+=q2.vertices.at(i)[0];
953  c2y+=q2.vertices.at(i)[1];
954  c2z+=q2.vertices.at(i)[2];
955  }
956 
957  qglviewer::Vec center1 ( c1x/(double)q1.vertices.size(),c1y/(double)q1.vertices.size(), c1z/(double)q1.vertices.size() );
958  qglviewer::Vec center2 ( c2x/(double)q2.vertices.size(),c2y/(double)q2.vertices.size(), c2z/(double)q2.vertices.size() );
959 
960  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
961  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
962  return dist1>dist2;
963  }

Field Documentation

◆ posCam

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
qglviewer::Vec DGtal::Viewer3D< Space, KSpace >::CompFarthestPolygonFromCamera::posCam

Definition at line 940 of file Viewer3D.h.


The documentation for this struct was generated from the following file: