Re: Problems with Polyline
- From: "Abdo Haji-Ali" <ahali@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Dec 2005 18:09:51 +0200
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
.
- References:
- RE: Problems with Polyline
- From: pagates
- RE: Problems with Polyline
- Prev by Date: RE: Problems with Polyline
- Next by Date: Re: Convert LPDWORD to a string?
- Previous by thread: RE: Problems with Polyline
- Next by thread: Re: Problems with Polyline
- Index(es):
Relevant Pages
|