Changeset 982 for trunk/vizservers


Ignore:
Timestamp:
Apr 2, 2008, 8:14:30 AM (16 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/vizservers/nanovis/ConvexPolygon.h

    r415 r982  
     1
    12/*
    23 * ----------------------------------------------------------------------
     
    1819#include "Vector4.h"
    1920#include "Plane.h"
     21#include <assert.h>
    2022#include <vector>
    2123
     
    2527class ConvexPolygon {
    2628public:
    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();
    3044
    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    }
    4558};
    4659
Note: See TracChangeset for help on using the changeset viewer.