1
\$\begingroup\$

P/S: The engine I work on doesn't have grouping integration. That's why I need a formula to change the position.

A------B---------------C

A and C are moving points that can move anywhere

A = (xa, ya), C = (xc, yc)

B (xb, yb) is a point between A and C colinearly

With one condition that distance of AB = constant = r, distance of AC can be varied.

How to find xb and yb?

Asked from Mathematics StackExchange:

Deepak says:

The locus of all possible points B is a circle centred on A and of radius r. The intersection between this circle and line AC will give you point B (and another point opposite it on the circle which you can neglect).

Try to write down the relevant equations and solve them?

Example: http://www.mathopenref.com/collinear.html

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$
  1. Calculate AC (xC - xA, yC - yA)
  2. Normalize it
  3. Multiply it by r
  4. Add that vector to A : done !
\$\endgroup\$
6
  • \$\begingroup\$ AC means the vector? Not sure how you calculate the AC. \$\endgroup\$
    – Fatty Mieo
    Commented Jun 27, 2016 at 9:49
  • 1
    \$\begingroup\$ @FattyMieo yes, that's the vector from A to C. You just have to subtract their coordinates as I wrote there. I suggest you take a bit of time to learn the basics of vector calculus, it helps a lot. \$\endgroup\$
    – Quentin
    Commented Jun 27, 2016 at 9:53
  • \$\begingroup\$ Actually using Stencyl (for my homework requirement), the only thing can be changed is velocity, rotation(by one end of the object or center), and position. Have to research deep in vector but I don't have much time to invest. \$\endgroup\$
    – Fatty Mieo
    Commented Jun 27, 2016 at 10:09
  • \$\begingroup\$ @FattyMieo that's fine, just perform the calculations and update B's position once you're done. Or can Stencyl not do math operations ? \$\endgroup\$
    – Quentin
    Commented Jun 27, 2016 at 10:15
  • \$\begingroup\$ Can you do a workout for me, please? Struggled to read vectors. Really need it urgent as it's going to pass up soon. There is no vector operation available in Stencyl :( \$\endgroup\$
    – Fatty Mieo
    Commented Jun 27, 2016 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .