first commit
This commit is contained in:
86
CS4451/proj5/Subdivision.h
Normal file
86
CS4451/proj5/Subdivision.h
Normal file
@@ -0,0 +1,86 @@
|
||||
#ifndef _SUBDIVISION_H_
|
||||
#define _SUBDIVISION_H_
|
||||
|
||||
#include <vector>
|
||||
#include "structs.h"
|
||||
|
||||
class Subdivision {
|
||||
|
||||
public:
|
||||
|
||||
static inline Subdivision* getInstance() {
|
||||
return & m_instance;
|
||||
}
|
||||
|
||||
void performSubdivision(char type);
|
||||
|
||||
private:
|
||||
|
||||
static Subdivision m_instance;
|
||||
std::vector<Adjacency> adjacencies;
|
||||
std::vector<Adjacency> labels;
|
||||
std::vector<int> pointDegrees;
|
||||
|
||||
std::vector<Point> *newPoints;
|
||||
std::vector<Triangle> *newTriangles;
|
||||
|
||||
inline Subdivision() {
|
||||
d3_loop_center_weight = 7. / 16;
|
||||
d3_loop_neighbor_weight = 3. /16;
|
||||
dn_loop_center_weight = 5. / 8;
|
||||
|
||||
loop_edge_adjacent_weight = 3. / 8;
|
||||
loop_edge_opposite_weight = 1. / 8;
|
||||
|
||||
bfly_edge_adjacent_weight = .5;
|
||||
bfly_edge_opposite_weight = 1. / 8;
|
||||
bfly_edge_far_weight = -1 / 16.;
|
||||
|
||||
}
|
||||
|
||||
float d3_loop_center_weight;
|
||||
float d3_loop_neighbor_weight;
|
||||
float dn_loop_center_weight;
|
||||
inline float dn_loop_neighbor_weight(int n) {
|
||||
return (float) ( 3. / (8 * n) );
|
||||
}
|
||||
|
||||
float loop_edge_adjacent_weight;
|
||||
float loop_edge_opposite_weight;
|
||||
|
||||
float bfly_edge_adjacent_weight;
|
||||
float bfly_edge_opposite_weight;
|
||||
float bfly_edge_far_weight;
|
||||
|
||||
//Step 1
|
||||
void calculateVertexDegree();
|
||||
|
||||
//Step 2
|
||||
void calculateIncidentTriangles();
|
||||
|
||||
//Step 3
|
||||
void generateAdjacencyTable();
|
||||
|
||||
//Step 4
|
||||
void generateLabels();
|
||||
void applyToAdjacent(Triangle& tdest,
|
||||
int tdest_index,
|
||||
int edgeVertex1,
|
||||
int edgeVertex2,
|
||||
int ui_current);
|
||||
|
||||
//Step 5
|
||||
void generateNewVertices();
|
||||
void generateNewTriangles();
|
||||
|
||||
//Step 6
|
||||
void generateNewVertexCoords(char type);
|
||||
void splitTriangles();
|
||||
void loopSubdivide();
|
||||
void butterflySubdivide();
|
||||
|
||||
Point pointOppositeTo(Triangle &t, int in1, int in2, std::vector<Point> *points);
|
||||
Point farOppositePoints(Triangle &tAdj, int in1, int in2);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user