Note that there are some explanatory texts on larger screens.

plurals
  1. POFilling in gaps for outlines
    primarykey
    data
    text
    <p>I'm using an algorithm to generate quads. These become outlines. The algorithm is:</p> <pre><code> void OGLENGINEFUNCTIONS::GenerateLinePoly(const std::vector&lt;std::vector&lt;GLdouble&gt;&gt; &amp;input, std::vector&lt;GLfloat&gt; &amp;output, int width) { output.clear(); if(input.size() &lt; 2) { return; } int temp; float dirlen; float perplen; POINTFLOAT start; POINTFLOAT end; POINTFLOAT dir; POINTFLOAT ndir; POINTFLOAT perp; POINTFLOAT nperp; POINTFLOAT perpoffset; POINTFLOAT diroffset; POINTFLOAT p0, p1, p2, p3; for(unsigned int i = 0; i &lt; input.size() - 1; ++i) { start.x = static_cast&lt;float&gt;(input[i][0]); start.y = static_cast&lt;float&gt;(input[i][1]); end.x = static_cast&lt;float&gt;(input[i + 1][0]); end.y = static_cast&lt;float&gt;(input[i + 1][1]); dir.x = end.x - start.x; dir.y = end.y - start.y; dirlen = sqrt((dir.x * dir.x) + (dir.y * dir.y)); ndir.x = static_cast&lt;float&gt;(dir.x * 1.0 / dirlen); ndir.y = static_cast&lt;float&gt;(dir.y * 1.0 / dirlen); perp.x = dir.y; perp.y = -dir.x; perplen = sqrt((perp.x * perp.x) + (perp.y * perp.y)); nperp.x = static_cast&lt;float&gt;(perp.x * 1.0 / perplen); nperp.y = static_cast&lt;float&gt;(perp.y * 1.0 / perplen); perpoffset.x = static_cast&lt;float&gt;(nperp.x * width * 0.5); perpoffset.y = static_cast&lt;float&gt;(nperp.y * width * 0.5); diroffset.x = static_cast&lt;float&gt;(ndir.x * 0 * 0.5); diroffset.y = static_cast&lt;float&gt;(ndir.y * 0 * 0.5); // p0 = start + perpoffset - diroffset //p1 = start - perpoffset - diroffset //p2 = end + perpoffset + diroffset // p3 = end - perpoffset + diroffset p0.x = start.x + perpoffset.x - diroffset.x; p0.y = start.y + perpoffset.y - diroffset.y; p1.x = start.x - perpoffset.x - diroffset.x; p1.y = start.y - perpoffset.y - diroffset.y; p2.x = end.x + perpoffset.x + diroffset.x; p2.y = end.y + perpoffset.y + diroffset.y; p3.x = end.x - perpoffset.x + diroffset.x; p3.y = end.y - perpoffset.y + diroffset.y; output.push_back(p2.x); output.push_back(p2.y); output.push_back(p0.x); output.push_back(p0.y); output.push_back(p1.x); output.push_back(p1.y); output.push_back(p3.x); output.push_back(p3.y); } } </code></pre> <p>The problem is that there are then gaps as seen here: <a href="http://img816.imageshack.us/img816/2882/eeekkk.png" rel="nofollow noreferrer">http://img816.imageshack.us/img816/2882/eeekkk.png</a></p> <p>There must be a way to fix this. I see a pattern but I just cant figure it out. There must be a way to fill the missing inbetweens. Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload