Problem 225. Subdivide the Segment

Two points, P1 and P2, with integer x-y coordinates are given. These uniquely determine a third point, P0, on the extended line through P1 and P2 which is closest to the origin. Various points in the interior of line segment P1P2 can be accessed starting from one of its endpoints and extending in either direction some multiple combination of the lengths of segments P0P1 or P0P2 and P1P2, producing subintervals of P1P2. The result n is to be the maximum number of subintervals P1P2 can be dividing into.
Example:
P1 = (9,19), P2 = (13,26)
Then P0 will be (-1.4,.8).
Segment P0P1 is 2.6 times as long as P1P2. Starting from P1, move toward P2 by two P0P1 lengths, then back by five P1P2 lengths, arriving at one-fifth of the way from P1 toward P2. Similarly three other equally-spaced division points can be found within P1P2. The answer would then be n = 5 for five possible subintervals.

Solution Stats

19.42% Correct | 80.58% Incorrect
Last Solution submitted on Mar 26, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers9

Suggested Problems

More from this Author3

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!