Changeset 2822 for trunk/packages/vizservers/nanovis/ConvexPolygon.h
- Timestamp:
- Mar 7, 2012, 12:21:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/ConvexPolygon.h
r2798 r2822 17 17 #define _CONVEX_POLYGON_H_ 18 18 19 #include <assert.h> 20 #include <vector> 21 19 22 #include "Vector4.h" 20 23 #include "Plane.h" 21 #include <assert.h>22 #include <vector>23 24 24 25 typedef std::vector<Vector4> VertexVector; 25 26 typedef std::vector<Vector4> TexVector; 26 27 27 class ConvexPolygon { 28 class ConvexPolygon 29 { 28 30 public: 29 31 VertexVector vertices; 30 32 TexVector texcoords; 31 33 int volume_id; //which volume this polygon slice belongs to 32 33 ConvexPolygon(); 34 35 ConvexPolygon() 36 {} 37 34 38 ConvexPolygon(VertexVector vertices); 35 36 void transform(Mat4x4 mat); 37 void translate(Vector4 shift); 38 39 40 void transform(const Mat4x4& mat); 41 42 void translate(const Vector4& shift); 43 39 44 // Clips the polygon, retaining the portion where ax + by + cz + d >= 0 40 void clip(Plane &clipPlane, bool copy_to_texcoords); 45 void clip(Plane& clipPlane, bool copy_to_texcoords); 46 41 47 void Emit(bool use_texture); 42 void Emit(bool use_texture, Vector3& shift, Vector3& scale); 48 49 void Emit(bool use_texture, const Vector3& shift, const Vector3& scale); 50 43 51 void copy_vertices_to_texcoords(); 44 52 45 void set_id(int v_id) { 46 volume_id = v_id; 47 }; 48 void append_vertex(Vector4 vert) { 49 vertices.push_back(vert); 53 void set_id(int v_id) 54 { 55 volume_id = v_id; 50 56 } 51 void insert_vertex(unsigned int index, Vector4 vert) { 52 assert(index<vertices.size()); 53 vertices.insert(vertices.begin() + index, vert); 57 58 void append_vertex(const Vector4& vert) 59 { 60 vertices.push_back(vert); 54 61 } 55 bool is_retained(Vector4 point, Vector4 plane) { 56 return ((point * plane) >= 0); 62 63 void insert_vertex(unsigned int index, const Vector4& vert) 64 { 65 assert(index<vertices.size()); 66 vertices.insert(vertices.begin() + index, vert); 67 } 68 69 bool is_retained(const Vector4& point, const Vector4& plane) 70 { 71 return ((point * plane) >= 0); 57 72 } 58 73 };
Note: See TracChangeset
for help on using the changeset viewer.