- Timestamp:
- Apr 2, 2008, 8:14:30 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vizservers/nanovis/ConvexPolygon.h
r415 r982 1 1 2 /* 2 3 * ---------------------------------------------------------------------- … … 18 19 #include "Vector4.h" 19 20 #include "Plane.h" 21 #include <assert.h> 20 22 #include <vector> 21 23 … … 25 27 class ConvexPolygon { 26 28 public: 27 VertexVector vertices; 28 TexVector texcoords; 29 int volume_id; //which volume this polygon slice belongs to 29 VertexVector vertices; 30 TexVector texcoords; 31 int volume_id; //which volume this polygon slice belongs to 32 33 ConvexPolygon(); 34 ConvexPolygon(VertexVector vertices); 35 36 void transform(Mat4x4 mat); 37 void translate(Vector4 shift); 38 39 // Clips the polygon, retaining the portion where ax + by + cz + d >= 0 40 void clip(Plane &clipPlane, bool copy_to_texcoords); 41 void Emit(bool use_texture); 42 void Emit(bool use_texture, Vector3& shift, Vector3& scale); 43 void copy_vertices_to_texcoords(); 30 44 31 ConvexPolygon(); 32 ConvexPolygon(VertexVector vertices); 33 34 void append_vertex(Vector4 vert); 35 void insert_vertex(unsigned int index, Vector4 vert); 36 void transform(Mat4x4 mat); 37 void translate(Vector4 shift); 38 39 // Clips the polygon, retaining the portion where ax + by + cz + d >= 0 40 void clip(Plane &clipPlane, bool copy_to_texcoords); 41 void Emit(bool use_texture); 42 void Emit(bool use_texture, Vector3& shift, Vector3& scale); 43 void copy_vertices_to_texcoords(); 44 void set_id(int v_id); 45 void set_id(int v_id) { 46 volume_id = v_id; 47 }; 48 void append_vertex(Vector4 vert) { 49 vertices.push_back(vert); 50 } 51 void insert_vertex(unsigned int index, Vector4 vert) { 52 assert(index<vertices.size()); 53 vertices.insert(vertices.begin() + index, vert); 54 } 55 bool is_retained(Vector4 point, Vector4 plane) { 56 return ((point * plane) >= 0); 57 } 45 58 }; 46 59
Note: See TracChangeset
for help on using the changeset viewer.