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

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

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

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

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

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

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,591

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

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

@ 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.

Thanks guys for the replys

Bogdan

Offline

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

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

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,591

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

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

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

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

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

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,591

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

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

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

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,591

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.

Offline

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

I understand now.

Thank i'll play with it and let you know

Bogdan

Offline

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

Nope i can't get the result.

Well anyway it is good this way to.

Thank you guys for the help

Bogdan

Offline

Pages: **1**