Advertisement

Directed segment ratio and endpoint calculator

Use AP:PB = m:n for internal division and positive length ratios for external division. Endpoint modes also recover a missing endpoint from a midpoint.

Calculator

Requested point
(2, 1)
Requested x
2.00000000
Requested y
1.00000000
Directed parameter t in A + t(B-A)
0.33333333

Advertisement

How this calculator works

A directed line point can be written as P = A + t(B-A). Internal division has t between zero and one; external division places P beyond an endpoint. Positive length ratio AP:PB = m:n gives t = m/(m+n) internally and m/(m-n) externally. Endpoint modes invert that affine relation. Taking m=n internally makes P a midpoint, so either missing endpoint is twice the midpoint minus the known endpoint.

Formula

P = (1-t)A + tB. Internal t=m/(m+n); external t=m/(m-n). A=(P-tB)/(1-t); B=(P-(1-t)A)/t.

Worked example

For A=(0,0), B=(6,3), and internal ratio 1:2, t=1/3 and P=(2,1). With midpoint (2,1) and endpoint (0,0), equal internal parts recover the other endpoint (4,2).

Advertisement

Frequently asked questions

Why is an external 1:1 ratio invalid?

No finite point outside a nonzero segment can be equally distant from both endpoints.

What is the sign convention for a directed ratio?

The reported quotient is t/(1-t). It is positive inside the segment and negative outside.

Can the supplied point be off the line?

No. Ratio recovery checks collinearity with a relative tolerance of 1e-10 and reports an error if it fails.

Sources

Advertisement