Saturday

Formula for the Parametric Representation of a Straight Line

Parametric representation of a straight line is also known as "convex combination of two points". Geometrically, the convex combination of two points means that a point is on the straight line between the two points.

Given three points p1=(x1,y1), p2=(x2,y2) and p3=(x3,y3),
p3 is a point between the straight line between p1 and p2 iff ∃t where 0<=t<=1 such that:

(i) x3=(t)x1+(1−t)x2
(ii) y3=(t)y1+(1−t)y2

Formula / Equation:

The point p3 equation is written as:

(iii) p3=(t)p1+(1−t)p2 iff ∃t where 0<=t<=1.

Visually:

                    t=0.3
   |--------------|------|
   x1             x3     x2


Examples:
 
Let x1=0 and x2=10.
Use formula (i).

When t=0.3,
then x3=(0.3)0+(0.7)10=7.

When t=0,
then x3=(0)0+(1)10=10.

When t=1,
then x3=(1)0+(0)10=0.

Therefore, you can see that the points p3 with 0<=t<=1 make up the straight line segment between the two given points p1 and p2.

Equivalent formula:
The point p3 formula (iii) p3=(t)p1+(1−t)p2 can also be written as:
(iv) p3=p2+t(p1−p2)
Perhaps, you recognize this as the parametric equation of a straight line through a point p2 with the direction vector (p1−p2) with t as the parameter.

Notes:
Analytical Proof = textually, consisting of words or text.
Geometric Proof = visually, consisting of figures or visuals.

No comments:

Measure execution time with Julia, example using sorting algorithms

# random integers between 1 and 100 inclusive, generate thousands of them x = rand ( 1 : 100 , 100000 ) @time sort (x; alg=InsertionSort, r...