Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
triangle.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file
11 /// @brief
12 /// @author
13 
14 
15 #ifndef INCLUDED_protocols_viewer_triangle_hh
16 #define INCLUDED_protocols_viewer_triangle_hh
17 
18 #include <numeric/xyzMatrix.fwd.hh>
19 // AUTO-REMOVED #include <numeric/xyzVector.io.hh>
20 #include <numeric/xyzVector.hh>
21 
22 
23 
24 namespace protocols {
25 namespace viewer {
26 
27 
28 // 88 bytes
29 class triangle {
30 public:
32  depth_ = 0;
33  }
34 
35  triangle( const numeric::xyzVector<float> vertices[], const numeric::xyzVector<float> normals[] ) {
36  for (int i=0; i<3; ++i) {
37  for (int j=0; j<3; ++j) {
38  vertices_[i][j] = (float)vertices[i][j];
39  normals_[i][j] = (float)normals[i][j];
40  }
41  }
42  center_ = 0.33333f * (vertices_[0]+vertices_[1]+vertices_[2]);
43  depth_ = 0;
44 
45  }
46 
47  triangle( const numeric::xyzVector<double> vertices[], const numeric::xyzVector<double> normals[] ) {
48  for (int i=0; i<3; ++i) {
49  for (int j=0; j<3; ++j) {
50  vertices_[i][j] = (float)vertices[i][j];
51  normals_[i][j] = (float)normals[i][j];
52  }
53  }
54  center_ = 0.33333f * (vertices_[0]+vertices_[1]+vertices_[2]);
55  depth_ = 0;
56  }
57 
58  // ASSUMES zdir IS NORMALIZED!!!!!!!
59  void update( const numeric::xyzVector_float &zdir ) {
60  //depth_ = numeric::dot( center_, zdir );
61  depth_ = center_.x() * zdir.x() + center_.y()*zdir.y() + center_.z()*zdir.z();
62  }
63 
64  float depth_;
65  numeric::xyzVector_float center_;
66  numeric::xyzVector_float vertices_[3], normals_[3];
67 };
68 
69 }
70 }
71 
72 #endif