({{, (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{(Subscript[p, 1]),(Subscript[p, 2])}] 
represents the infinite straight line passing through the points (Subscript[p, 1]) and (Subscript[p, 2]). }, {, (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[p,v]
represents the infinite straight line passing through the point p in the direction v. }})

OpenersNotesSection(Spacer1)Details

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) is also known as line.

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) can be used as a geometric region and graphics primitive.

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) represents linear curve {(Subscript[p, 1])+s ((Subscript[p, 2])-(Subscript[p, 1]))|s∈ℝ} or {p+s v|s∈ℝ}.

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) can be used in (RefLink[Graphics, paclet:ref/Graphics]) and (RefLink[Graphics3D, paclet:ref/Graphics3D]).

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) will be clipped by (RefLink[PlotRange, paclet:ref/PlotRange]) when rendering.

In graphics, the points p, (Subscript[p, i]) and vector v can be (RefLink[Dynamic, paclet:ref/Dynamic]) expressions.

Graphics rendering is affected by directives such as (RefLink[Thickness, paclet:ref/Thickness]), (RefLink[Dashing, paclet:ref/Dashing]), and color.

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) can be used with symbolic points in (RefLink[GeometricScene, paclet:ref/GeometricScene]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (45)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

An (RefLink[InfiniteLine, paclet:ref/InfiniteLine]) in 2D:

Graphics[InfiniteLine[{0,0},{1,1}],Frame->True]

And in 3D:

Graphics3D[InfiniteLine[{0,0,0},{1,2,3}]]

Different styles applied to an infinite line:

ℛ=InfiniteLine[{0,0},{1,1}];

{Graphics[{Red,ℛ},Frame->True],Graphics[{Thick,Red,ℛ},Frame->True],Graphics[{Thick,Red,Dashed,ℛ},Frame->True]}

Test point membership in an infinite line:

ℛ=InfiniteLine[{0,0},{1,1}];

{RegionMember[ℛ,{2,2}],RegionMember[ℛ,{2,3}]}

OpenersExampleSection1(Spacer1)Scope  (19)

OpenersExampleSubsection0(Spacer1)Graphics  (8)

OpenersExampleSubsubsection0(Spacer1)Specification  (3)

Define an (RefLink[InfiniteLine, paclet:ref/InfiniteLine]) containing {1,1} and going in the direction {2,1}:

ill=Graphics[{PointSize[Medium],Point[{{1,1}}],Arrowheads[Medium],Thick,Arrow[{{1,1},{3,2}}]},PlotRange->{{0,4},{0,3}},Frame->True];

Show[ill,Graphics[InfiniteLine[{1,1},{2,1}]]]

Define the same line passing through {1,1} and {3,2}:

ill=Graphics[{PointSize[Medium],Point[{{1,1},{3,2}}]},PlotRange->{{0,4},{0,3}},Frame->True];

Show[ill,Graphics[InfiniteLine[{{1,1},{3,2}}]]]

Define a 3D infinite line containing {1,1,1} and going in the direction {1,2,3}:

ill=Graphics3D[{PointSize[Medium],Point[{{1,1,1}}],Arrowheads[Medium],Thick,Arrow[{{1,1,1},{2,3,4}}]},PlotRange->{{0,5},{0,5},{0,5}},Axes->True];

Show[ill,Graphics3D[InfiniteLine[{1,1,1},{1,2,3}]]]

Define the same infinite line using the points {1,1,1} and {2,3,4}:

ill=Graphics3D[{PointSize[Medium],Point[{{1,1,1},{2,3,4}}]},PlotRange->{{0,5},{0,5},{0,5}},Axes->True];

Show[ill,Graphics3D[InfiniteLine[{{1,1,1},{2,3,4}}]]]

An infinite line varying direction:

Table[Graphics[InfiniteLine[{0,0},{Cos[θ],Sin[θ]}],ImageSize->Tiny,PlotLabel->θ],{θ,0,π,π/4}]

OpenersExampleSubsubsection1(Spacer1)Styling  (4)

Thickness in scaled size:

Table[Graphics[{Thickness[i],InfiniteLine[{{0,0},{2,1}}]}],{i,{.005,.05,.1}}]

Thickness in printer's points:

Table[Graphics[{AbsoluteThickness[i],InfiniteLine[{{0,0},{2,1}}]}],{i,{1,5,10}}]

Infinite lines can be rendered in dashed or dotted styles:

Table[Graphics[{Dashing[i],InfiniteLine[{{0,0},{2,1}}]}],{i,{Tiny,Small,Medium,Large}}]

Table[Graphics[{d,InfiniteLine[{{0,0},{2,1}}]}],{d,{Dotted,Dashed,DotDashed}}]

Color directives can be used to specify the color of an infinite line:

Table[Graphics[{c,InfiniteLine[{{0,0},{2,1}}]}],{c,{Red,Green,Blue,Yellow}}]

Combine various directives to style an infinite line:

Graphics[{Thick,Blue,Dashed,InfiniteLine[{{0,0},{2,1}}]}]

OpenersExampleSubsubsection2(Spacer1)Coordinates  (1)

Points and vectors can be (RefLink[Dynamic, paclet:ref/Dynamic]):

DynamicModule[{θ=0},{Slider[Dynamic[θ],{0,Pi}],Graphics[InfiniteLine[{0,0},Dynamic[{Cos[θ],Sin[θ]}]]]}]

OpenersExampleSubsection1(Spacer1)Regions  (11)

Embedding dimension is the dimensionality of the vertices:

RegionEmbeddingDimension[InfiniteLine[{{x0,y0},{x1,y1}}]]

RegionEmbeddingDimension[InfiniteLine[{x,y,z},{a,b,c}]]

Geometric dimension is the dimension of the region:

RegionDimension[InfiniteLine[{{x0,y0},{x1,y1}}]]

RegionDimension[InfiniteLine[{x,y,z},{a,b,c}]]

Point membership test:

RegionMember[InfiniteLine[{{0,0,0},{1,1,1}}],{2,2,2}]

RegionMember[InfiniteLine[{1,1},{2,2}],{0,-1}]

Get conditions for membership:

RegionMember[InfiniteLine[{{x0,y0},{x1,y1}}],{x,y}]

An infinite line is unbounded:

ℛ=InfiniteLine[{{0,0},{1,1}}];

BoundedRegionQ[ℛ]

Find the region range:

RegionBounds[ℛ]

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) has infinite measure:

ℛ=InfiniteLine[{{0,0},{1,1}}];

RegionMeasure[ℛ]

RegionCentroid[ℛ]

Distance from a point:

ℛ=InfiniteLine[{{2,2},{3,3}}];

RegionDistance[ℛ,{0,1}]

Plotting distance to the region:

{Plot3D[Evaluate@RegionDistance[ℛ,{x,y}],{x,-2,2},{y,-2,2},MeshFunctions->{#3&},Mesh->5],ContourPlot[Evaluate[RegionDistance[ℛ,{x,y}]],{x,-3,3},{y,-3,3},Contours->{{0.5,Red},{1,Green},{1.5,Blue}}]}

Signed distance from a point:

ℛ=InfiniteLine[{{2,2},{3,3}}];

SignedRegionDistance[ℛ,{0,-1}]

Distance to the nearest point:

Plot3D[SignedRegionDistance[ℛ,{x,y}],{x,-2,2},{y,-2,2},MeshFunctions->{#3&},Mesh->5]

Nearest point in the region:

ℛ=InfiniteLine[{{2,2},{3,3}}];

RegionNearest[ℛ,{5,6}]

Visualizing nearest points:

pts=Table[{1,2}+5{Cos[k 2 π/16],Sin[k 2π/16]},{k,0.,15}];
nst=RegionNearest[ℛ,#]&/@pts;

Legended[Graphics[{{Gray,ℛ},{Thin,Gray,Line[Transpose[{pts,nst}]]},{Red,Point[pts]},{Blue,Point[nst]}}],PointLegend[{Red,Blue},{"start","nearest"}]]

Integrate over an infinite line:

ℛ=InfiniteLine[{{0,0},{1,1}}];

Integrate[Exp[-x y],{x,y}∈ℛ]

Optimize over an infinite line:

ℛ=InfiniteLine[{0,0},{1,1}];

Minimize[{(((x y-1))^2)+3,{x,y}∈ℛ},{x,y}]

Solve equations on an infinite line:

ℛ=InfiniteLine[{0,0,0},{1,2,3}];

Solve[(x^2)+(y^2)+(z^2)==1&&{x,y,z}∈ℛ,{x,y,z}]

Graphics3D[{{Opacity[0.5],Sphere[]},ℛ,{Red,PointSize[Large],Point[{x,y,z}/.%]}}]

OpenersExampleSection3(Spacer1)Applications  (17)

Create parallel lines aligned to y==x:

lines=Table[InfiniteLine[{0,y},{1,1}],{y,5}];

Graphics[lines,PlotRange->{{-6,6},{0,6}}]

Illustrate asymptotes:

asym=InfiniteLine[{0,0},{1,1}];

Plot[((x^2+x+1)/(x+1)),{x,-1,7},Epilog->{Red,Dashed,asym},PlotRange->7]

ParametricPlot[{t+Cos[14 t]/t,t+Sin[14 t]/t},{t,0.01,10},Epilog->{Red,Dashed,asym}]

Convert the intercept form of a line to an (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

a=2;
b=3;

ir=ImplicitRegion[(x/a)+(y/b)==1,{x,y}];

il=InfiniteLine[{{a,0},{0,b}}];

Visualize lines:

Table[RegionPlot[r,PlotRange->{{0,3},{0,3}}],{r,{ir,il}}]

Convert the point slope form of a line to an (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

m=2/3;
{x0,y0}={1,2};

ir=ImplicitRegion[y-y0==m(x-x0),{x,y}];

il=InfiniteLine[{x0,y0},{1,m}];

Visualize lines:

Table[RegionPlot[r,PlotRange->{{0,3},{0,3}}],{r,{ir,il}}]

Convert the slope intercept form of a line to an (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

m=2/3;
b=1;

ir=ImplicitRegion[y==m x+b,{x,y}];

il=InfiniteLine[{0,b},{1,m}];

Visualize lines:

Table[RegionPlot[r,PlotRange->{{0,3},{0,3}}],{r,{ir,il}}]

Convert the two-point form of a line to an (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

{x0,y0}={0,2};
{x1,y1}={3,1};

ir=ImplicitRegion[y-y0==((y1-y0)/(x1-x0))(x-x0),{x,y}];

il=InfiniteLine[{{x0,y0},{x1,y1}}];

Visualize lines:

Table[RegionPlot[r,PlotRange->{{0,3},{0,3}}],{r,{ir,il}}]

Convert the parametric form of a line to an (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

a=2;
b=3;
{x0,y0}={1,2};

pr=ParametricRegion[{x0+a t,y0+b t},{t}];

il=InfiniteLine[{{x0,y0},{x0+a,y0+b}}];

Visualize lines:

Table[RegionPlot[r,PlotRange->{{0,3},{0,3}}],{r,{pr,il}}]

The tangent line to a parametric curve f[u] is given by (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[f[u],f'[u]]. Find the tangent line to the parametric curve {cos(u),sin(u)}:

f1[u_]:={Cos[u],Sin[u]};

c1=ParametricPlot[f1[u],{u,0,2π}];
t1=With[{u=π/4},Graphics[InfiniteLine[f1[u],f1'[u]]]];

Show[c1,t1,PlotRange->{{-2,2},{-2,2}}]

Find the tangent line for the parametric curve {cos(u),sin(u),u/10}:

f2[u_]:={Cos[u],Sin[u],u/10};

c2=ParametricPlot3D[f2[t],{t,0,20}];
t2=With[{u=4},Graphics3D[InfiniteLine[f2[u],f2'[u]]]];

Show[c2,t2,PlotRange->{{-2,2},{-2,2},All}]

Find the intersection of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{0,0},{1,1}] and (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{0,1},{1,0}}]:

line1=InfiniteLine[{0,0},{1,1}];
line2=InfiniteLine[{{0,1},{1,0}}];

sol=Solve[{x,y}∈line1∧{x,y}∈line2,{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],line1,line2},{Red,Point[{x,y}/.sol]}},Axes->True,ImageSize->Small]

Find the intersections of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{0,0},{1,1}] and (RefLink[Circle, paclet:ref/Circle])[{0,0},1]:

line=InfiniteLine[{0,0},{1,1}];
circle=Circle[{0,0},1];

sol=Solve[{x,y}∈line∧{x,y}∈circle,{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],line,circle},{Red,Point[{x,y}/.sol]}},ImageSize->Small]

Find all pairwise intersections between five random lines:

lines=InfiniteLine/@RandomReal[1,{5,2,2}];

Use (RefLink[BooleanCountingFunction, paclet:ref/BooleanCountingFunction]) to express that exactly two conditions are true:

sol=NSolve[{x,y}∈BooleanRegion[BooleanCountingFunction[{2},5],lines],{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],lines},{Red,PointSize[Medium],Point[{x,y}/.sol]}}]

Find the intersection of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{-1,1,1},{1,1,1}}] and (RefLink[InfinitePlane, paclet:ref/InfinitePlane])[{{2,0,0},{0,2,0},{0,0,2}}]:

line=InfiniteLine[{{-1,1,1},{1,1,1}}];
plane=InfinitePlane[{{2,0,0},{0,2,0},{0,0,2}}];

sol=Solve[{{x,y,z}∈line,{x,y,z}∈plane},{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],line,plane},{Red,PointSize[Large],Point[{x,y,z}/.sol]}},Axes->True,PlotRange->{{-2,2},{-2,2},{-2,2}}]

Find the intersections of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{-1,1,1},{1,1,1}}] and (RefLink[Sphere, paclet:ref/Sphere])[{0,0,0},3]:

line=InfiniteLine[{{-1,1,1},{1,1,1}}];
sphere=Sphere[{0,0,0},3];

sol=Solve[{{x,y,z}∈line,{x,y,z}∈sphere},{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],line,sphere},{Red,PointSize[Large],Point[{x,y,z}/.sol]}},PlotRangePadding->0.5]

Find the intersections of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{-1,1/3,1/2},{1,1/3,1/2}}] and the boundary of (RefLink[Tetrahedron, paclet:ref/Tetrahedron])[{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}]:

line=InfiniteLine[{{-1,1/3,1/2},{1,1/3,1/2}}];
tet=RegionBoundary@Tetrahedron[{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}];

sol=Solve[{x,y,z}∈RegionIntersection[line,tet],{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],line,Tetrahedron[{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}]},{Red,PointSize[Medium],Point[{x,y,z}/.sol]}},PlotRangePadding->0.2]

Indicate (RefLink[Mean, paclet:ref/Mean]) on a (RefLink[Histogram, paclet:ref/Histogram]):

data=RandomVariate[NormalDistribution[1,9],200];

h=Histogram[data];

m=Graphics[{Dashed,Red,InfiniteLine[{Mean[data],0},{0,1}]}];

Show[h,m]

Visualize the axis of rotation for (RefLink[RotationTransform, paclet:ref/RotationTransform]):

v={4,2,-5};
p={2,2,3/2};

axis=InfiniteLine[p,v];

rt[θ_]:=RotationTransform[θ,v,p];

g=Graphics3D[Table[{GeometricTransformation[Sphere[],rt[θ]]},{θ,0,2Pi,2Pi/8}],Boxed->False];

Show[g,Graphics3D[{Thick,Blue,Dashed,axis}]]

Find the altitude of a triangle:

{a,b,c}={{0,0},{3,0},{-1,2}};

base=InfiniteLine[{a,b}];

foot=RegionNearest[base,c];

altitude=Line[{c,foot}];

Visualize altitude in red:

Graphics[{{LightBlue,Triangle[{a,b,c}]},{Thick,Darker@LightBlue,base},{PointSize@Medium,Red,Point[{c,foot}]},{Dashed,Red,altitude}}]

OpenersExampleSection4(Spacer1)Properties & Relations  (4)

(RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{(Subscript[p, 1]),(Subscript[p, 2])}] is equivalent to (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[(Subscript[p, 1]),(Subscript[p, 2])-(Subscript[p, 1])]:

(Subscript[ℛ, 1])=InfiniteLine[{{1,0},{2,2}}];
(Subscript[ℛ, 2])=InfiniteLine[{1,0},{1,2}];

RegionEqual[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

(RefLink[ParametricRegion, paclet:ref/ParametricRegion]) can represent any (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

(Subscript[ℛ, 1])=ParametricRegion[{1,2}+t{3,4},{t}];
(Subscript[ℛ, 2])=InfiniteLine[{1,2},{3,4}];

RegionEqual[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

(RefLink[ImplicitRegion, paclet:ref/ImplicitRegion]) can represent any (RefLink[InfiniteLine, paclet:ref/InfiniteLine]):

(Subscript[ℛ, 1])=ImplicitRegion[y-x==1,{x,y}];
(Subscript[ℛ, 2])=InfiniteLine[{{1,2},{3,4}}];

RegionEqual[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

(RefLink[InfiniteLine, paclet:ref/InfiniteLine]) is a special case of (RefLink[ConicHullRegion, paclet:ref/ConicHullRegion]):

pts={{1,2},{3,4}};

RegionEqual[ConicHullRegion[pts],InfiniteLine[pts]]

OpenersExampleSection5(Spacer1)Neat Examples  (2)

A random collection of lines:

Graphics[Table[{Hue[RandomReal[]],InfiniteLine[RandomReal[1,{2,2}]]},{50}]]

Graphics3D[Table[{Hue[RandomReal[]],InfiniteLine[RandomReal[1,{2,3}]]},{100}],BoxRatios->1]

Organized collection of lines:

Graphics[Table[InfiniteLine[{0,0},{Cos[θ],Sin[θ]}],{θ,0.,π,π/50}]]

Graphics[Table[InfiniteLine[{Cos[θ],Sin[θ]},{-Sin[θ],Cos[θ]}],{θ,0,2π,π/20}],PlotRange->2]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Line, paclet:ref/Line])  ▪  (RefLink[HalfLine, paclet:ref/HalfLine])  ▪  (RefLink[InfinitePlane, paclet:ref/InfinitePlane])  ▪  (RefLink[HalfPlane, paclet:ref/HalfPlane])  ▪  (RefLink[ConicHullRegion, paclet:ref/ConicHullRegion])  ▪  (RefLink[Polygon, paclet:ref/Polygon])  ▪  (RefLink[AngleBisector, paclet:ref/AngleBisector])  ▪  (RefLink[PerpendicularBisector, paclet:ref/PerpendicularBisector])  ▪  (RefLink[GeometricScene, paclet:ref/GeometricScene])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graphics Objects, paclet:guide/GraphicsObjects])}, {▪(RefLinkPlain[Basic Geometric Regions, paclet:guide/GeometricSpecialRegions])}, {▪(RefLinkPlain[Synthetic Geometry, paclet:guide/SyntheticGeometry])}, {▪(RefLinkPlain[Solid Geometry, paclet:guide/SolidGeometry])}, {▪(RefLinkPlain[Plane Geometry, paclet:guide/PlaneGeometry])}, {▪(RefLinkPlain[Geometric Computation, paclet:guide/GeometricComputation])}})}})