HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Tanget Line from a Circle

10-07-2006, 03:01 PM#1
emjlr3
so I coded a spell that you target a point, and a projectile flies from you to a point 250 units from the target point, 90 degress from your angle to the target, it thens does a half circle around the target and returns to the caster

this looks pretty good, bu still kinda resembles an ice cream cone, since the two edges where it goes from either coming from the caster or going back to the caster are still a little edgy, what I want is a tear drop looking shape instead

so what I need to do is find the line that will come off the circle tanget(or more specifically, maybe the point on thet circle where this will happen, since right now I am just moving the projectile to the point on the circle, going around 180 degress, the nreturning to the caster), and to the caster, if that makes sense, so it will be a smooth transition, not real sure how to go about this

refer to the pic for clarification
10-07-2006, 08:30 PM#2
PipeDream
I think the point on the circle you are shooting for is, relative to the start point, and putting d the distance between circle and start point on the x axis:
x = (d^2-r^2)/d
y = sqrt(d^2-r^2)*r/d

theta, the angle the circle starts at, is arcsin of y/r, relative to the x axis on the side of the start point

you'll have to rotate this into your coordinate system

try drawing some triangles to check that answer, because I'm not very confident of it.
10-07-2006, 10:20 PM#3
AceHart
A line whose angle you don't know and supposed to intercect a circle in one point, such that the normal of the line passes through the circle's center...

Good luck.

My suggestion would be to find a "formula" that generates the entire flying path.
Sin and cos can go a long way...

I attached an example that never made it into an actual map.
It isn't doing anything, it just flies a missile.

But, well, for inspiration:
Attached Files
File type: w3xBoomerang_Demo_AceHart.w3x (17.7 KB)
10-08-2006, 11:01 AM#4
martix
How about replacing the straight lines with a parabola? Like - an x degrees arc of a really BIG, elongated circle?
You just have to come up with a formula(I'm too lazy to think right now).
10-08-2006, 01:32 PM#5
Anitarf
This is how you construct a tangent.
Attached Images
File type: jpgtangent_help_image.JPG (19.3 KB)
10-08-2006, 04:19 PM#6
UnMi
Zoom (requires log in)
I had been trying to get the α angle, only to find how impossible it is.
What we lack here is x, which must be very tricky to find.
Attached Images
File type: jpgtangent_help_image.JPG (22.2 KB)
10-08-2006, 04:57 PM#7
Guesst
Can't you just use the law of sines? You know the radius of the circle, the distance between the target and the caster, and one of the angles (90).

a is caster to target. b is the circle radius.
A=90, sinA=1

a / sinA = b / sinB
a = b / sinB
sinB = b / a
B = arcsin(b/a)

The distance for it to travel along that line is just sqrt(a*a - b*b).'
So that takes care of the straight lines, and you can just do regular old angle-distance projection for the circle part.
Attached Images
File type: giftangent.GIF (2.7 KB)
10-08-2006, 06:20 PM#8
UnMi
-Falls down-, I must be blind.
Yea, that's the way to do it.
10-08-2006, 08:10 PM#9
PipeDream
It's a right triangle, so you can just write it down as a right triangle and sin = opposite / hypotenuse directly.
Anyway, that seems to agree with my answer.