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?
|
|