## Exploring Analyic Geometry with |
|||||

Home | Contents | Commands | Packages | Explorations | Reference |

Tour | Lines | Circles | Conics | Analysis | Tangents |

Line Segment Cut by Two Lines

lnlndist.html

Exploration

Let and be two intersecting lines and a point. Describe a procedure for finding the lines through such that and cut off a line segment of length S>0. Implement the solution as a Mathematica function.

Approach

Translate and so that their intersection point is at the origin. and can then be written as and . The line through can then be written as , since cannot pass through the origin. Since is on , . A second equation can be formed using the condition that the distance between the points of intersection of ( and ) and ( and ) must be S. Solve the two equations for and . There are two or four solutions depending on the geometric configuration and the value of S. Translate the resulting solutions back to the original position.

Initialize

To initialize Descarta2D, select the input cell bracket and press SHIFT-Enter.

This initialization assumes that the Descarta2D software has been copied into one of the standard directories for AddOns which are on the Mathematica search path, $Path.

<<Descarta2D`

Solution

Special case first, the lines intersect at the origin. The equations are solved using NSolve to avoid complicated exact solutions.

Line2D[p0:Point2D[{x0_,y0_}],

l1:Line2D[A1_,B1_,C1_ /; IsZero2D[C1]],

l2:Line2D[A2_,B2_,C2_ /; IsZero2D[C2]],

S_?IsScalar2D] :=

Module[{L12,A12,B12,eq1,eq2,ans},

eq1=Equation2D[L12=Line2D[A12,B12,1],{x0,y0}];

eq2=Distance2D[Point2D[l1,L12],Point2D[l2,L12]]^2==S^2;

ans=Select[NSolve[{eq1,eq2},{A12,B12}],

(Not[IsComplex2D[A12 /. #]] &&

Not[IsComplex2D[B12 /. #]])&];

Map[(Line2D[A12,B12,1] /. #)&,ans] ] /;

Not[IsZeroOrNegative2D[S]] && Not[IsParallel2D[l1,l2]];

Here's the general case. It uses the special case for the core computation.

Line2D[p0:Point2D[{x0_,y0_}],

l1:Line2D[A1_,B1_,C1_],

l2:Line2D[A2_,B2_,C2_],

S_?IsScalar2D] :=

Module[{u,v,lns},

{u,v}=Coordinates2D[Point2D[l1,l2]];

lns=Line2D[Translate2D[p0,-{u,v}],

Translate2D[l1,-{u,v}],

Translate2D[l2,-{u,v}],S];

Translate2D[lns,{u,v}] ] /;

Not[IsZeroOrNegative2D[S]] && Not[IsParallel2D[l1,l2]];

Discussion

Here's an example of the special case that has two solutions:

and with S=2 through the point (2,-1).

P0=Point2D[2,-1];

L1=Line2D[2,-3,0];

L2=Line2D[4,3,0];

L12=Line2D[P0,L1,L2,2]

Sketch2D[{P0,L1,L2,L12}]

Graphics saved as "lnlndi01.eps".

Here's an example of the general case that has four solutions:

and with S=4 through the point (-1,2).

P0=Point2D[1,2];

L1=Line2D[2,1,-2];

L2=Line2D[-1,3,-1];

L12=Line2D[P0,L1,L2,4]

Sketch2D[{P0,L1,L2,L12}]

Graphics saved as "lnlndi02.eps".

www.Descarta2D.com