Created
January 4, 2011 19:37
-
-
Save vo/765273 to your computer and use it in GitHub Desktop.
Example for how to use m+2d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void simMKPusher::computeOffset() | |
{ | |
c_mksum mksum; | |
c_ply & p = getP(); | |
p.beginPoly(); | |
for (int i = 0; i < m_target_border.size; i++) | |
p.addVertex(m_target_border.data[i].x(), m_target_border.data[i].y()); | |
p.endPoly(); | |
c_ply & q = getQ(); | |
q.beginPoly(); | |
for (int i = 0; i < m_push_border.size; i++) | |
q.addVertex(m_push_border.data[i].x(), m_push_border.data[i].y()); | |
q.endPoly(); | |
mksum.build(p, q); | |
const vector<m_f_graph_node> & nodes = | |
mksum.getCurrentSegArrangement2d().getNodes(); | |
const vector<m_f_graph_edge> & edges = | |
mksum.getCurrentSegArrangement2d().getEdges(); | |
m_offset_border.allocate(edges.size()); | |
for (int i = 0; i < edges.size(); ++i) { | |
if (!edges[i].valid()) | |
continue; | |
const Point2d& s = nodes[edges[i].s].pos; | |
m_offset_border.data[i][0] = s[0]; | |
m_offset_border.data[i][1] = s[1]; | |
m_offset_border.data[i][2] = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment