473,486 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

finding the second coordinate

HI,

How do you find the other endpoint of a line given one endpoint and the
slope of the line.

Also how do you display the coordinate on the computer screen knowing
that the Y axis (of the raster display) runs in the reverse direction of
a normal graph.
ex: given two points
x1 = 100
y1 = 600

and given an angle
45 degrees ie the slope(m)of the line is 1
and given the distance of 206 units
how do I find x2 and y2(the other endpoint of the line)?

how do i display it on the computer screen.

thanks,
Ashutosh

Jul 19 '05 #1
6 2640

"Ashutosh Iddya" <u2******@anu.edu.au> wrote in message
news:3f********@clarion.carno.net.au...
HI,

How do you find the other endpoint of a line given one endpoint and the
slope of the line.

Also how do you display the coordinate on the computer screen knowing
that the Y axis (of the raster display) runs in the reverse direction of
a normal graph.
ex: given two points
x1 = 100
y1 = 600

and given an angle
45 degrees ie the slope(m)of the line is 1
and given the distance of 206 units
how do I find x2 and y2(the other endpoint of the line)?

how do i display it on the computer screen.

thanks,
Ashutosh


You need trigonometry, doesn't that get taught in schools any more?

radians = 45*PI/180;
x2 = x1 + 206*cos(radians);
y2 = y1 + 206*sin(radians);

You might need to change a + to a - depending on which way your axis goes.

Note that I convert 45 degrees to radians because sin and cos in C++ need an
angle in radians not degrees.

john
Jul 19 '05 #2
On Thu, 04 Sep 2003 16:25:12 +1000, Ashutosh Iddya <u2******@anu.edu.au> wrote:
How do you find the other endpoint of a line given one endpoint and the
slope of the line.
Sorry, that's not a C++ question.

Consult your primary school / secondary school / high school math
textbook (depending on the country), or try some other newsgroup.
Also how do you display the coordinate on the computer screen knowing
that the Y axis (of the raster display) runs in the reverse direction of
a normal graph.


In C++, use a graphics / GUI library.

There are quite a number of free, cross-platform C++ graphics / GUI
libraries.

A short list of free GUI libraries is available at
[http://www.utvikling.com/cppfaq/04/05/01/index.html].

Jul 19 '05 #3

"Alf P. Steinbach" <al***@start.no> wrote in message
news:3f**************@News.CIS.DFN.DE...
On Thu, 04 Sep 2003 16:25:12 +1000, Ashutosh Iddya <u2******@anu.edu.au> wrote:
How do you find the other endpoint of a line given one endpoint and the
slope of the line.


Sorry, that's not a C++ question.

Consult your primary school / secondary school / high school math
textbook (depending on the country), or try some other newsgroup.


High school text book is unlikely to tell him that he needs to convert his
angle to radians.

john
Jul 19 '05 #4
On Thu, 4 Sep 2003 07:35:41 +0100, "John Harrison" <jo*************@hotmail.com> wrote:

"Alf P. Steinbach" <al***@start.no> wrote in message
news:3f**************@News.CIS.DFN.DE...
On Thu, 04 Sep 2003 16:25:12 +1000, Ashutosh Iddya <u2******@anu.edu.au>

wrote:
>How do you find the other endpoint of a line given one endpoint and the
>slope of the line.


Sorry, that's not a C++ question.

Consult your primary school / secondary school / high school math
textbook (depending on the country), or try some other newsgroup.


High school text book is unlikely to tell him that he needs to convert his
angle to radians.


<ot>
My secondary school math textbook did (around 1978 or something).

But I thought the level in both secondary school and high school was
extremely low, and had been going downhill for some time, judging from
my sister's books (she's three years older) and my mother's books.

Education system is all downhill, at least in Norway... :-(
</ot>

Jul 19 '05 #5

"Alf P. Steinbach" <al***@start.no> wrote in message
news:3f**************@News.CIS.DFN.DE...
On Thu, 4 Sep 2003 07:35:41 +0100, "John Harrison" <jo*************@hotmail.com> wrote:

"Alf P. Steinbach" <al***@start.no> wrote in message
news:3f**************@News.CIS.DFN.DE...
On Thu, 04 Sep 2003 16:25:12 +1000, Ashutosh Iddya <u2******@anu.edu.au>
wrote:

>How do you find the other endpoint of a line given one endpoint and
the >slope of the line.

Sorry, that's not a C++ question.

Consult your primary school / secondary school / high school math
textbook (depending on the country), or try some other newsgroup.

High school text book is unlikely to tell him that he needs to convert

hisangle to radians.


<ot>
My secondary school math textbook did (around 1978 or something).


Amazing! It told you that the C standard library math routines require
angles in radians. I guess that was what set you on your path to become a
programmer.
But I thought the level in both secondary school and high school was
extremely low, and had been going downhill for some time, judging from
my sister's books (she's three years older) and my mother's books.

Education system is all downhill, at least in Norway... :-(
Same in the UK.
</ot>


john
Jul 19 '05 #6


Ashutosh Iddya wrote:
HI,

How do you find the other endpoint of a line given one endpoint and the
slope of the line.
The way you found the startpoint and the equation of the line.

Also how do you display the coordinate on the computer screen knowing
that the Y axis (of the raster display) runs in the reverse direction of
a normal graph.

Depends. For example, if you're programming a toaster, then you don't
have to worry about the display.

ex: given two points
x1 = 100
y1 = 600

and given an angle
45 degrees ie the slope(m)of the line is 1
and given the distance of 206 units
how do I find x2 and y2(the other endpoint of the line)?
If you knwo it's 206 units and you know the slope and the equation of
the line, what more do you need to know to get to the other end? If all
fails, try a bicyle!

how do i display it on the computer screen.

thanks,
Ashutosh


Sona

Jul 19 '05 #7

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

Similar topics

2
6059
by: Ashutosh Iddya | last post by:
HI, How do you find the other endpoint of a line given one endpoint and the slope of the line. Also how do you display the coordinate on the computer screen knowing that the Y axis (of the...
4
6339
by: spivee | last post by:
I'm having an odd type of issue. I want to be able to pass an element name in my javascript event and find the location of the element, be it a div, span, img whatever, specifically the top and...
8
1722
by: nescio | last post by:
hello, i have a script that finds the x and y from the mouse position, this works fine. but now i have an image in a layer : <div id='someLayer'> <img src='someImage.jpg'> </div>
1
2287
by: OtisUsenet | last post by:
Hello, Is there a way to use JavaScript to push a page element (a DIV block, for example) down the screen, so it sits at the bottom of the browser window. For example of a bad footer...
0
2674
by: peradino | last post by:
Hi I have a problem when I want to know how far my cursor is from the top of pictureBox. I can get mouse coordinate but it is screen coordinate. I can get the top position of my pictureBox...
9
5392
by: Eric.Gabrielson | last post by:
Hello, I am very knew to python and am attempting to write a program in python that a friend of mine is having to write in java. I am doing this for fun and would like some help as to how i can...
28
2629
by: galathaea | last post by:
On Mar 2, 11:29 pm, galath...@veawb.coop (galathaea) wrote: still being very naive about this whole crackpot / crank thing i accidentally let the engineer inside think too hard about this ...
10
3676
by: sklett | last post by:
I have a situation where I'm getting in Image that has a gray (solid, same color) background with a smaller white rectangle inside. The position is not always the same. What I need to do is...
0
2087
by: jigsmshah | last post by:
I need to print a text file .When i print it ,it is not printed exactly form 0,0 coordiante of the page. I mean the top most left corner.It is leaving some margin from top and from left.The code is...
4
4558
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
7123
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
7175
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...
1
6842
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
5430
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,...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.