由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
_Graphics版 - how to draw line in VC++
相关主题
Open Position: Mechanical Engineer in a top oil field servi (转载)Open Position: Mechanical Engineer in a top oil field servi (转载)
Open Position: Mechanical Engineer in a top oil field service company.关于微软的winrt
Open Position: Mechanical Engineer in a top oil field servi (转载)about windows 8
Open Position: Mechanical Engineer in a top oil field servpersonally feel msft's xmldom object very easy to
相关话题的讨论汇总
话题: line话题: draw话题: c++话题: ax
1 (共1页)
b****e
发帖数: 1180
1
I want to draw a line according to sth like, y=ax+b
how to draw it. and how to get the intersection point
of two lines?
G**T
发帖数: 388
2
lineto?

【在 b****e 的大作中提到】
: I want to draw a line according to sth like, y=ax+b
: how to draw it. and how to get the intersection point
: of two lines?

b****e
发帖数: 1180
3
No.
pDC->LineTo(CPoint());
what i want is a line without terminals
not segment...

【在 G**T 的大作中提到】
: lineto?
e*******e
发帖数: 812
4
dcd::SetPixel(x,y, colorref)

【在 b****e 的大作中提到】
: No.
: pDC->LineTo(CPoint());
: what i want is a line without terminals
: not segment...

b****e
发帖数: 1180
5
from ? to ? for x,y respectively?

【在 e*******e 的大作中提到】
: dcd::SetPixel(x,y, colorref)
e*******e
发帖数: 812
6
for(x=start;x y=ax+b;
pdc->SetPixel(x,y,RGB(0,0,0));

【在 b****e 的大作中提到】
: from ? to ? for x,y respectively?
b****e
发帖数: 1180
7
good...but how to get start and end ?
and how to get intersection?

【在 e*******e 的大作中提到】
: for(x=start;x: y=ax+b;
: pdc->SetPixel(x,y,RGB(0,0,0));

e*******e
发帖数: 812
8

whatever, depends on the display of the line
intersection to another line? 2d line equations
y=ax+b; y=cx+d;
intersection x=(d-b)/(a-x);

【在 b****e 的大作中提到】
: good...but how to get start and end ?
: and how to get intersection?

w****e
发帖数: 9
9

Maybe the below code segment helps. It creats the pixel coordinates for the
line segment between point (x1,y1) and (x2, y2).
Using SetPixel() instead of AddElement() in the code should draw a line like
you use LineTo in VC++.
/*------------Public Function---------------*/
/* create the line element for the line segment
* between point (x1,y1) and (x2, y2) */
PixelStruct*
CreateLineElement (int x1, int y1, int x2, int y2, int *element_num)
{
int index, i, j, dx, dy, x, y, tmp, err, x_inc,y_in

【在 b****e 的大作中提到】
: I want to draw a line according to sth like, y=ax+b
: how to draw it. and how to get the intersection point
: of two lines?

1 (共1页)
相关主题
about windows 8Open Position: Mechanical Engineer in a top oil field servi (转载)
personally feel msft's xmldom object very easy toOpen Position: Mechanical Engineer in a top oil field serv
Open Position: Mechanical Engineer in a top oil field servi (转载)Open Position: Mechanical Engineer in a top oil field servi (转载)
Open Position: Mechanical Engineer in a top oil field service company.关于微软的winrt
相关话题的讨论汇总
话题: line话题: draw话题: c++话题: ax