4
$\begingroup$

I have a screen wherein the upper-leftmost part is at x,y coordinate (0,0). Then I have a curved line that passes through 3 points: (132, 201), (295, 661) and (644, 1085). Now, say I want to find 7 points within that curved line so that the line will be equally divided into 6 segments. How do I go about computing the coordinates of these 7 points?

$\endgroup$
5
  • $\begingroup$ do you have the equation of the curve? $\endgroup$ – marco trevi Oct 21 '14 at 7:13
  • $\begingroup$ @marcotrevi nope. only the three coordinates yet. $\endgroup$ – damat-perdigannat Oct 21 '14 at 7:14
  • $\begingroup$ So, I'm afraid we cannot do much. How do we know what curve is the one you're looking at? $\endgroup$ – marco trevi Oct 21 '14 at 7:16
  • $\begingroup$ @marcotrevi I'm thinking the equation of the curved line could be estimated through plotting? $\endgroup$ – damat-perdigannat Oct 21 '14 at 7:19
  • 4
    $\begingroup$ there are an infinite number of different curves which all pass through the three points you give. $\endgroup$ – marco trevi Oct 21 '14 at 7:24
5
$\begingroup$

This is a really fun problem.

You would start by solving a system of equation in three variables to find the quadratic formula that represents your curve. Any quadratic equation is defined by three or more points, so you can find the formula if you have three or more points.

The formula for the generalized quadratic is $y=ax^2+bx+c$. We know x and y, so we will be solving for a, b, and c. However, before we begin, we have to convert to Cartesian points, or everything else will be messed up. Our three points are now (132, -201); (295, -661); and (664, -1085). Now lets set up the system.

$$a(132)^2+b(132)+c=-201$$ $$a(295)^2+b(295)+c=-661$$ $$a(664)^2+b(664)+c=-1085$$

Simplifying, we have

$$17424a+132b+c=-201$$ $$87025a+295b+c=-661$$ $$440896a+664b+c=-1085$$

We now subtract equations 1 and 2, as well as equations 2 and 3, to get rid of the c. $$-69601a-163b=460$$ $$-353871a-369b=424$$

We can multiply both sides of each equation by -1 to make the left sides positive. $$69601a+163b=-460$$ $$353871a+369b=-424$$

Before we continue, we must scale the equations so they can be solved with subtraction.

$$25682769a+60147b=-169740$$ $$57680973a+60147b=-69112$$

We can now subtract the two equations, getting rid of the b.

$$−31998204a=−100628$$ $$a = 0.003144802...$$

We can substitute this answer into $$69601a+163b=-460$$ in order to solve for b.

$$69601(0.003144802)+163b=-460$$ $$163b=−678.881364002$$ $$b = −4.164916344$$

We can now solve for c by using $$17424a+132b+c=-201$$

$$17424(0.003144802)+132(−4.164916344)+c=-201$$ $$−494.97392736+c=-201$$ $$c=293.97392736$$

We now know that the a, b, and c terms to our quadratic, which is

$$f(x) = 0.003144802x^2−4.164916344x+293.97392736$$

For convenience, I will round to three decimal places, making the equation

$$f(x) = 0.003x^2-4.165x+293.974$$

Now, if you want six equal rectangles from 132 to 644, you just recognize that the difference between these two points is 512, so the difference you want between each one is 512/6, or 85.3333. Therefore, your seven points are

  • f(132)
  • f(132+85.3)
  • f(132+85.3(2)
  • f(132+85.3(3)
  • f(132+85.3(4)
  • f(132+85.3(5)
  • f(132+85.3(6).

This would give you seven points where the x was balanced evenly. But what if you wanted the actual length of the curve to be split up evenly? This is also a really cool problem.

The arc length of a function f(x)continuous on [a,b] is given by

$$\int^b_a \sqrt{1+[f'(x)]^2} dx$$

It would probably be easiest to just solve the indefinite integral and use it to determine arc length, as substitutions will be involved.

$$\int \sqrt{1+[0.0056x+1.61]^2} dx$$

We can now make the substitution $u=0.0056x+1.61$.

$$\frac{du}{dx}=0.0056$$ $$0.0056dx=du$$ $$dx=\frac{du}{0.0056}$$

Therefore, our integral becomes

$$\int \frac{\sqrt{u^2+1} du}{0.0056}$$

$$178.57\int \sqrt{u^2+1} du$$

This next part is a bit of a thinker. Imagine a right triangle with sides $u$ and $1$. By the Pythagorean theorem, the hypotenuse would have length $\sqrt{u^2+1}$. Now imagine an angle $\theta$ which was adjacent to the side of length $1$ and opposite the side of length $u$. The hypotenuse divided by the adjacent side would represent our current situation, so we make another substitution. This time, we substitute $\sec \theta$ for $\sqrt{u^2+1}$ because in this scenario, they are equivalent.

Going back to the triangle, the opposite side to $\theta$ would be of length $u$, and the adjacent side length $1$, so $u=\tan \theta$. Furthermore,

$$\frac{du}{d \theta} = \sec ^2 \theta$$

$$du = \sec^2\theta \space d \theta$$

So our integral is now

$$178.57\int \sec^3\theta \space d \theta$$

This is getting really long, so I'm going to skip a few steps. http://symbolab.com/ is there to help integrate by parts and stuff from here. (the actual steps can be seen here: http://symbolab.com/solver/step_by_step/%5Cint%20sec%5E%7B3%7D%5Ctheta%20d%5Ctheta/?origin=button)

Anywho, you get the idea. It's 2AM, and I really have to get to bed. I would greatly appreciate help completing the integral.

$\endgroup$
1
$\begingroup$

Hint

Since I do not have more idea, let us admit that the three points are along a parabola $$y=\alpha + \beta x + \gamma x^2$$ Parameters $a,b,c$ are easily be determined from the coordinates of the three data points.

Now, the length of the curve is given by $$L=\int_{132}^{644} \sqrt{1+\Big(\frac{dy}{dx}\Big)^2}dx$$ and you want to divide it in six equal portions. So, the starting point being known ($132$), for the second point, you have to solve for $a$ $$\frac{L}{6}=\int_{132}^{a} \sqrt{1+\Big(\frac{dy}{dx}\Big)^2}dx$$ Solving this equation gives $a$.

For the third point, you do something similar and you have to solve $$\frac{L}{6}=\int_{a}^{b} \sqrt{1+\Big(\frac{dy}{dx}\Big)^2}dx$$ and so on.

I am sure that you can take from here.

$\endgroup$
3
  • $\begingroup$ that's fine, but why assuming it's a parabola in the first place? It could be a bézier curve, since the OP is talking about a screen. $\endgroup$ – marco trevi Oct 21 '14 at 7:25
  • $\begingroup$ @marcotrevi and Claude, the curve I'm talking about is the curve from the paths tool of Gimp (a drawing tool). $\endgroup$ – damat-perdigannat Oct 21 '14 at 7:38
  • $\begingroup$ Ok, so they are really Bézier curves. $\endgroup$ – marco trevi Oct 21 '14 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.