Triangle.h
Go to the documentation of this file.
1 /*
2 * ==========================================================================
3 * This file is part of the implementation of
4 *
5 * <FrameFab: Robotic Fabrication of Frame Shapes>
6 * Yijiang Huang, Juyong Zhang, Xin Hu, Guoxian Song, Zhongyuan Liu, Lei Yu, Ligang Liu
7 * In ACM Transactions on Graphics (Proc. SIGGRAPH Asia 2016)
8 ----------------------------------------------------------------------------
9 * class: Triangle
10 *
11 * Description:
12 *
13 * Version: 2.0
14 * Created: Oct/20/2015
15 *
16 * Author: Xin Hu, Yijiang Huang, Guoxian Song
17 * Company: GCL@USTC
18 * Citation: This file use some geometric API and objects from
19 * Title: Geometric Tools Engine
20 * a library of source code for computing in the fields of
21 * mathematics, graphics, image analysis, and physics.
22 * Code Version: 3.2.6
23 * Availability: http://www.geometrictools.com/index.html
24 ----------------------------------------------------------------------------
25 * Copyright (C) 2016 Yijiang Huang, Xin Hu, Guoxian Song, Juyong Zhang
26 * and Ligang Liu.
27 *
28 * FrameFab is free software: you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
32 *
33 * FrameFab is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
37 *
38 * You should have received a copy of the GNU General Public License
39 * along with FrameFab. If not, see <http://www.gnu.org/licenses/>.
40 * ==========================================================================
41 */
42 
43 #pragma once
45 
46 class Triangle : public Polyface
47 {
48 public:
50  {
51  vert_list_.push_back(point(1, 0, 0));
52  vert_list_.push_back(point(0, 1, 0));
53  vert_list_.push_back(point(0, 0, 1));
54  Normal_();
55  }
56 
58  {
59  vert_list_.push_back(v0);
60  vert_list_.push_back(v1);
61  vert_list_.push_back(v2);
62  Normal_();
63  }
64 
66  {
67  vert_list_.push_back(Trans(v0));
68  vert_list_.push_back(Trans(v1));
69  vert_list_.push_back(Trans(v2));
70  Normal_();
71  }
72 
73  ~Triangle() {}
74 
75 public:
76  void Print()
77  {
78  point _v0 = v0();
79  point _v1 = v1();
80  point _v2 = v2();
81 
82  std::cout << _v0.x() << ", " << _v0.y() << ", " << _v0.z() << std::endl;
83  std::cout << _v1.x() << ", " << _v1.y() << ", " << _v1.z() << std::endl;
84  std::cout << _v2.x() << ", " << _v2.y() << ", " << _v2.z() << std::endl;
85  }
86 
87  void Render(WireFrame* ptr_frame, double alpha)
88  {
89 // glBegin(GL_TRIANGLES);
90 // glColor4f(1.0, 1.0, 0, alpha);
91 // glNormal3fv(normal_);
92 // glVertex3fv(ptr_frame->Unify(v0()));
93 // glVertex3fv(ptr_frame->Unify(v1()));
94 // glVertex3fv(ptr_frame->Unify(v2()));
95 // glEnd();
96  }
97 
98  void Add(point base)
99  {
100  for (int i = 0; i < vert_list_.size(); i++)
101  {
102  vert_list_[i] += base;
103  }
104  }
105 };
106 
void Print()
Definition: Triangle.h:76
Triangle()
Definition: Triangle.h:49
GLfloat GLfloat GLfloat alpha
trimesh::point point
Definition: WireFrame.h:51
vector< point > vert_list_
Definition: Polyface.h:109
GLfloat GLfloat v1
reference x()
Definition: Vec.h:194
Triangle(GeoV3 v0, GeoV3 v1, GeoV3 v2)
Definition: Triangle.h:65
point v1()
Definition: Polyface.h:74
void Add(point base)
Definition: Triangle.h:98
void Normal_()
Definition: Polyface.h:94
reference y()
Definition: Vec.h:203
GLfloat v0
point v2()
Definition: Polyface.h:79
~Triangle()
Definition: Triangle.h:73
GLfloat GLfloat GLfloat v2
void Render(WireFrame *ptr_frame, double alpha)
Definition: Triangle.h:87
point Trans(GeoV3 V)
Definition: Polyface.h:60
reference z()
Definition: Vec.h:212
point v0()
Definition: Polyface.h:69
Triangle(point v0, point v1, point v2)
Definition: Triangle.h:57


choreo_task_sequence_planner
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:03:14