Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2005-08-02 19:33:15

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Finding x,y cordinates of a point on a circle

Hello guys, this looks like a great community.

I have a problem with finding the coridnates of a point.

To see better this is what i'm working on this http://www.swish-db.com/staff/bogdan/files/3dmove.html in flash. The lines connecting should not go from the back of the one on top to the "back" of the one on the bottom.

So someone suggested me to find the point where the line hits the surface.

I made this drawing while trying to find it:

So basicaly i know the center x and y, i know the radius and angle and i need to calculte points A x and y.

Thank you very much

Bogdan

Last edited by bogdan (2005-08-02 19:34:23)

Offline

## #2 2005-08-02 20:20:28

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

### Re: Finding x,y cordinates of a point on a circle

First, I'm renaming A as (p,q). 2 sets of x and y get confusing.
Secondly, I think all you need to do is drop a perpendicular from (p,q) down to the horizontal line, forming a right-angle triangle with a hypotenuse of r and angle of a. You can find the other 2 lengths of this triangle with trigonometry and to get your co-ordinates you would add these values to x and y.

So, the horizontal length would be r*cos a, meaning p is x+r*cos a and the vertical length is r*sin a, meaning q is y+r*sin a.
So, your co-ordinates of (p,q) are (x+r*cos a,y+r*sin a)

Oh, and your 3d move thing is very nice

Why did the vector cross the road?
It wanted to be normal.

Offline

## #3 2005-08-02 21:11:41

MathsIsFun
Registered: 2005-01-21
Posts: 7,659

### Re: Finding x,y cordinates of a point on a circle

I could watch that animation for ages! Save that version, just in case you improve it too much

Your question is in 2D, but your problem is in 3D. Are the connecting rectangles going to end up as tubes?

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

## #4 2005-08-02 23:01:03

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Re: Finding x,y cordinates of a point on a circle

@ mathsyperson

yes that makes sense, i'll see if that will do the thing. And thanks

@ MathsIsFun

actualy it is 2D becuase flash(swish in this case) doesn't support 3D and the 3D is faked here by making the z coordinate in function by x and y.

The initial planes were for them to be tubes but that means not to change this problem. And when i say tubes i mean a rectangle with gradient fill.

Bogdan

Offline

## #5 2005-08-02 23:10:16

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

### Re: Finding x,y cordinates of a point on a circle

MathsIsFun wrote:

I could watch that animation for ages!

And once you got tired of that, you could start playing with it!

Why did the vector cross the road?
It wanted to be normal.

Offline

## #6 2005-08-03 01:09:17

MathsIsFun
Registered: 2005-01-21
Posts: 7,659

### Re: Finding x,y cordinates of a point on a circle

I am glad it is so easy, I was wondering how to position the connection point on the face of the circle like this:

``````   __
/  . \
|      |
\ __ /``````

And then how to draw the 2D ellipse that would result from the projection of the circle where the tube joins the sphere ... and then how to clip that ... aaaarrhggg.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

## #7 2005-08-03 04:18:02

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Re: Finding x,y cordinates of a point on a circle

I don't understand the second part, but for the first that point is on a circle to. The only thing wich modyfies is the angle and r.

It is not tested yet but i hope it will work

Bogdan

Offline

## #8 2005-08-03 07:59:21

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Re: Finding x,y cordinates of a point on a circle

OK it seems that it isn't working. Aplyed everything corect but it looks like before. I gues the ideea is not good. and i'm out of other ideea so i think it wil remain this way

Bogdan

Offline

## #9 2005-08-03 10:18:36

MathsIsFun
Registered: 2005-01-21
Posts: 7,659

### Re: Finding x,y cordinates of a point on a circle

It actually looks fine on first viewing.

But if you want to add a bit more realism, it may work to simply estimate the point.

Mathsyperson showed you how to find the point on the edge of the circle, why not bring that point back a little towards the centre of the circle.

So your modified co-ordinates of (p,q) would be (x+f*r*cos a,y+f*r*sin a), where f is your "fudge factor" (something less than 1).

f should vary according to the foreground/background angle between the spheres, hopefully you have some variable in your program that can be used as the basis for f

Can't hurt to try ...

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

## #10 2005-08-04 02:17:07

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Re: Finding x,y cordinates of a point on a circle

Yes it can't hurt trying but i don't think i understood what is with f.

Right now there isn't any variable but it can be made but i dind't understand what you mean by foreground/background angle between the spheres sory

Bogdan

Offline

## #11 2005-08-04 10:43:12

MathsIsFun
Registered: 2005-01-21
Posts: 7,659

### Re: Finding x,y cordinates of a point on a circle

You know how you have one ball appearing to be closer than another? If they were in 3D and you were to stand above them, you would see an angle -  that is kind of what I mean. But you don't need to be precise about it, just good enough to fool the eye.

So, you would draw the smaller ball in the background, then in front of it you would draw the connecting bar, but the bar has to start at the correct spot [ie (x+f*r*cos a,y+f*r*sin a)], then draw the bigger ball on top.

In this case f would be about 0.7, all you have to do is estimate f. I would start by looking at the relative sizes of the balls and also how far apart they are.

Note:  f would be 1 when the balls are the same size. It would also be 0 when the balls are on top of each other. Just play with it until it looks good.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

## #12 2005-08-06 21:12:24

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Re: Finding x,y cordinates of a point on a circle

I understand now.

Thank i'll play with it and let you know

Bogdan

Offline

## #13 2005-08-10 20:53:58

bogdan
Member
Registered: 2005-08-02
Posts: 18

### Re: Finding x,y cordinates of a point on a circle

Nope i can't get the result.

Well anyway it is good this way to.

Thank you guys for the help

Bogdan

Offline