Re: Problems with Polyline

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Your code seems to work fine, make sure you're not doing anything that may
erase the ployline; also make sure you're using a visible color

What BernhaSC said is absolutely true, but it holds only in more advanced
graphics libraries (Like DirectX and OpenGL), not in a simple one like GDI

Abdo Haji-Ali
Programmer
In|Framez

"pagates" <pagates@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AC7D9CF0-774F-4402-95A3-63D79DDF6B66@xxxxxxxxxxxxxxxx
> An interesting theory, but it doesn't seem to be correct (if I undertand
> you
> correctly, because I don't remember a lot of my vector math), for two
> reasons:
> - If I reverse the vertices in the code, the same behavior exists
> - There is a specific point in the display where this behavior is
> exhibited. If a polygon is drawn above this line, it is drawn completely.
> If it is drawn below this line, it is completely invisible. Most
> interestingly, if the polygon bisects this line, the portion above will be
> drawn, but the portion below the line is invisible.
>
> Your theory may still be valid, in that there may be a mathematical reason
> for this behavior, but it isn't as "simple" as reversing the vertices.
>
> Also, note that a "polygon" may be as simple as a single line (two end
> points).
>
> "BernhaSC" wrote:
>
>> If you can scroll the view point around, I bet you could see the polygon
>> from
>> the backside. The polygon is there, but not rendered b/c the dot-product
>> of
>> the vectors is negative (thus it's back-facing). Try reversing the order
>> of
>> verticies -- Use the right-hand rule and curl your fingers in the order
>> the
>> verticies are specified. if your thumb points to the screen, it wont be
>> rendered.
>>
>> --
>> --
>> --BernhaSC
>> --
>> --And the end of all our exploring Will be to arrive where we started
>> --And know the place for the first time. -- TS Eliot
>>
>>
>> "pagates" wrote:
>>
>> > Hello All,
>> >
>> > We are having problems with the drawing of a Polygon or Polyline. In
>> > certain situations, all or part of the polygon will "disappear." That
>> > is, it
>> > will still be there, but it will be invisible.
>> >
>> > Here is the basic code:
>> > int CGraphic::MultiLine(POINT *points,int npoints,int foreground,int
>> > width,int closed) {
>> > CPen pen;
>> > CPen *oldpen;
>> >
>> > // NOTE: m_CDC is CDC*
>> > pen.CreatePen(PS_SOLID,width,GetColor(foreground));
>> > oldpen = m_cdc->SelectObject(&pen);
>> >
>> > m_cdc->Polyline(points,npoints);
>> > if (closed)
>> > {
>> > m_cdc->MoveTo(points[0].x,points[0].y);
>> > m_cdc->LineTo(points[npoints-1].x,points[npoints-1].y);
>> > }
>> >
>> > m_cdc->SelectObject(oldpen);
>> > return 0;
>> > }
>> >
>> > I have seen discussions where the bounding rectangle size and/or the
>> > x/y
>> > coordinates are > 32K boundaries, but this does not seem to be an issue
>> > in
>> > this case.
>> >
>> > Has anybody heard of such an issue, or beter yet, have a workaround?
>> >
>> > Thanks,
>> > PAGates


.



Relevant Pages

  • RE: Problems with Polyline
    ... correctly, because I don't remember a lot of my vector math), for two reasons: ... If a polygon is drawn above this line, ... but it isn't as "simple" as reversing the vertices. ...
    (microsoft.public.vc.language)
  • Re: Problems with Polyline
    ... If a polygon is drawn above this line, ... but the portion below the line is invisible. ... With sufficient thrust, pigs fly just fine. ...
    (microsoft.public.vc.language)
  • Polygrams and primes
    ... If n is the number of vertices of a regular polygon, then p_n, the ... (A regular polygram is a train of equal diagonals inside the polygon; ... it touches each vertex once, is radially symmetrical, and can be drawn ... except Sloane's indices begin with n=1 rather than n=3 for a triangle. ...
    (sci.math)
  • Re: Ordering edges
    ... Right now I'm reversing the edge order to get a desired order. ... is this algorithm correct in all cases? ... Edge order in a polygon needs a reference to be meaningful; ...
    (comp.graphics.algorithms)
  • Re: Hypercube in lisp (newbie)
    ... Now a beautiful window pops up immediately, but no polygon is drawn, ... Prev by Date: ...
    (comp.lang.lisp)