473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Coordinator [pls help]

MAY
Hi,

In a form, i draw a straight line, the start point is, for example (23, 43)
and the end point is (243, 342). I want to check each points on that
straight line as to perform some GDI+ calculation, what equation can do
that? (as i know there has an equation called "straight line equation" but
dont know how to use it) Or there have other alternatives? how can i do
that? Can post some simple code? Thx millions.

Regards,

MAY
Nov 16 '05 #1
4 1141

"MAY" <pa****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

In a form, i draw a straight line, the start point is, for example (23, 43)
and the end point is (243, 342). I want to check each points on that
straight line as to perform some GDI+ calculation, what equation can do
that? (as i know there has an equation called "straight line equation" but
dont know how to use it) Or there have other alternatives? how can i do
that? Can post some simple code? Thx millions.

Regards,

MAY


The first problem is definition: exactly when is a point "on the line"?
Do you define points with integer coordinates or with floats (in .Net you
have both Point and PointF)?
With "the line" do you mean the mathematical line through those two
points or do you mean the collection of pixels used to render the
mathematical line in a specific width? (what about anti-aliasing,
where a pixel can be "partially-used"?)

Hans Kesting

Nov 16 '05 #2
"MAY" wrote :
Hi,

In a form, i draw a straight line, the start point is, for example (23, 43) and the end point is (243, 342). I want to check each points on that
straight line as to perform some GDI+ calculation, what equation can do
that? (as i know there has an equation called "straight line equation" but
dont know how to use it) Or there have other alternatives? how can i do
that? Can post some simple code? Thx millions.


Hi,

Have you had a look on my answer in your last thread ?

--
Francois Beaussier
Fr******@3ie.org.remove
Nov 16 '05 #3
MAY
hi all,

I want get points of a line (interger) and the "line" is mathematical line.
I have written a code but it cant do what i expected. Here is the part of
the code;

MAY
//set points
int x1=pt1.X , y1=pt1.Y ;
int x2=pt2.X , y2=pt2.Y;
//start and end point
Point s;
Point e;
//set the left hand side point as start
if(x1<x2)
{
s=new Point(x1, y1);
e=new Point(x2, y2);
}
else
{
s=new Point(x2, y2);
e=new Point(x1, y1);
}
//slope
long m=0;

//calculate slope
if((e.Y - s.Y )!=0 && (e.X -s.X)!=0)
{
try
{
m=(e.Y - s.Y )/(e.X - s.X);
}
catch(Exception edx)
{
Console.WriteLine("Dividen by zero!");
}
}
//calculate y-intersect
long b=(s.Y )-(m * s.X);

//get all points on this line
for(int i=s.X ; i<=e.X ; i++)
{
long j=(m * i) +b;

//point(i, j)
this.checkpoint(new Point(i, Convert.ToInt32(j))));

}

}


"Francois Beaussier" <Fr******@3ie.org.invalid> ¦b¶l¥ó
news:O$******************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
"MAY" wrote :
Hi,

In a form, i draw a straight line, the start point is, for example (23,

43)
and the end point is (243, 342). I want to check each points on that
straight line as to perform some GDI+ calculation, what equation can do
that? (as i know there has an equation called "straight line equation" but dont know how to use it) Or there have other alternatives? how can i do
that? Can post some simple code? Thx millions.


Hi,

Have you had a look on my answer in your last thread ?

--
Francois Beaussier
Fr******@3ie.org.remove

Nov 16 '05 #4
"MAY" wrote :
hi all,

I want get points of a line (interger) and the "line" is mathematical line. I have written a code but it cant do what i expected. Here is the part of
the code;


Try this :

http://perso.3ie.org/yannick.lejeune...50787387959147

It is based on the bresenham algorithm.

--
Francois Beaussier
Fr******@3ie.org.remove
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Amy Lewis | last post by:
I recently moved my Windows 2003 server from one domain into another. After the move I have noticed that some of my .asp pages won't load. I get a server 500 error. When I look in the event log...
2
by: Vencz Istv?n | last post by:
I have a web application installed on Windows 2003 Standard Edition with SP1, it accesses a SQL Servet 2000 database installed on Windows 2000 Server, the two computers are not in the same domain....
1
by: manish | last post by:
Hi, I am a fresher in the programming field i.e although I have done programming at the basic level but at professional level I am very new and I am facing many problems. These probllems are...
0
by: Mark Berkhoff | last post by:
Hi, The db2 fault monitor coordinator (db2fmcd) that monitors the fault monitors of my db2 instances does not seem to restart the fault monitor (db2fmd) when it exits. We use db2 v8.1 fixpack...
3
by: bangaw | last post by:
i'm currently using c++ on windowsXP, unistd.h doesnt work for windows what other substitute for it could i use to replace it Pls. Help me Pls pls the code goes as follows #include <stdio.h>...
0
by: Jeff Rush | last post by:
The PyCon organizers are looking for someone to volunteer as publicity coordinator for PyCon 2007. This year we have started planning sufficiently in advance that we'd like to get some press...
0
by: naheed javaid | last post by:
I m student and doing my final project. My project is related to screen capturing. my project captures screen and save the captured screen as bitmaps in a folder. while the screen recording audio...
17
by: Riaaaa | last post by:
Pls check my code for the stored procedure which i created for the companydetails including companyid P.K. Not Null int(4), companyname Not Null varchar (20), address varchar(30) where...
0
by: sonuindia88 | last post by:
Some common confusions .I am reading Ritchie and Deitel and practising questions from Yashwant Kanetkar...Here are some of the confusions i am having..your help is required.... Q1) ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.