Jump to content

Recommended Posts

Posted (edited)

Hey all,

 

I have two 2D vectors, [math]\vec{s}[/math] and [math]\vec{p}[/math], both starting at [math][0, 0][/math] and ending in the points [math]S[/math] and [math]P[/math] respectively. I'm looking for a vector [math]\vec{x}[/math](starting at [math][0, 0][/math] and ending in the point [math]X[/math]) that satisfies the equation [math]|\vec{s}-\vec{x}| = z \cdot |\vec{s} - \vec{p}|[/math], and that [math]X \in \; \rightarrow SP[/math] (I hope that's the proper syntax for a ray begining in S and going through P). In layman's terms, I'm trying to "zoom in" on [math]S[/math]. Now, the obvious way to solve the problem is find the equation for the ray (or line to be percise, and then just check if you're on the right side of [math]S[/math]) and then solve the two equations, which should look like this:

 

[math]z \cdot \sqrt{(p_x-s_x)^2+(p_y-s_y)^2} = \sqrt{(x-s_x)^2+(y-s_y)^2}[/math]

[math]y={\frac {x \left( s_{{y}}-p_{{y}} \right) }{s_{{x}}-p_{{x}}}}+{\frac

{p_{{x}}s_{{y}}-p_{{y}}s_{{x}}}{p_{{x}}-s_{{x}}}}

[/math]

 

Unfortunately, the length of these solutions approach the length of the US Constitution...well, maybe not quite, but still long enough. So I was wondering if maybe there was a simpler way.

 

Thanks in advance,

 

Gabe

Edited by Shadow
Posted
Hey all,

 

I have two 2D vectors, [math]\vec{s}[/math] and [math]\vec{p}[/math], both starting at [math][0, 0][/math] and ending in the points [math]S[/math] and [math]P[/math] respectively. I'm looking for a vector [math]\vec{x}[/math](starting at [math][0, 0][/math] and ending in the point [math]X[/math]) that satisfies the equation [math]|\vec{s}-\vec{x}| = z \cdot |\vec{s} - \vec{p}|[/math], and that [math]X \in \; \rightarrow SP[/math] (I hope that's the proper syntax for a ray begining in S and going through P).

I think it is clear what you mean. That's perhaps the most important thing.

In layman's terms, I'm trying to "zoom in" on [math]S[/math].

Now that is completely unclear. I'll ignore it.

Now, the obvious way to solve the problem is find the equation for the ray [...]

Absolutely. What does that equation look like?

... and then solve the two equations, which should look like this ...

Now where did you suddenly get a 2nd equation from? There is exactly one equation in the question, not two. This is (almost certainly) the point where you screw up. Finding the solution is pretty easy. Perhaps it helps you if you try to understand what the equation given sais/means.

Posted

The "zooming in" part refers to what I'll be needing this for. If you have say circles in 2D space, and you zoom in on one of them (the one that is represented by [math]S[/math] in this case). The one you zoom in on gets "bigger" (or looks bigger to be more precise, because you get closer) and the distance between the point you're zooming in on and all the other points (or circles or whatever) increases (or seems to increase, because you're closer).

 

The second equation is the equation for the ray. We know that the new point (X) must be z times as far as the original (P), hence the first equation. And we know it has to be on a line connecting the center (S, the point we're zooming in on) and the original point (P). That's the second equation in the form y=ax+b. The letters refer to the points, and the subscripts to the coordinates. I though that obvious so I didn't include it, sorry about that.

 

Hope this helps clear things up.

 

 

EDIT: Now that I'm rereading the post, I can see there's a parenthesis missing that messes things up quite a lot. Edited.

Posted
I'm looking for a vector [math]\vec{x}[/math](starting at [math][0, 0][/math] and ending in the point [math]X[/math]) that satisfies the equation [math]|\vec{s}-\vec{x}| = z \cdot |\vec{s} - \vec{p}|[/math], and that [math]X \in \; \rightarrow SP[/math] (I hope that's the proper syntax for a ray begining in S and going through P).

 

The latter requirement, that X is on the line defined by S and P is simply

 

[math]\vec x = \vec s + \kappa(\vec p - \vec s)[/math]

 

where [math]\kappa[/math] is some free parameter. Let kappa range from -infinity to infinity and voila! you have the line defined by S and P. Restricting kappa to non-negative values results in your desired ray.

 

Rather than work this all the way through, I'll leave the rest up to you for now. Holler if you need more help.

Posted

Thanks DH...just to confirm, all I need to do now is replace [math]k[/math] with [math]z[/math] and, well, that's it, right?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.