HalfLine
范例
打开所有单元 关闭所有单元基本范例 (3)
二维 HalfLine:
Graphics[HalfLine[{{0, 0}, {1, 0}}], Frame -> True]Graphics3D[HalfLine[{0, 0, 0}, {1, 2, 3}]]ℛ = HalfLine[{0, 0}, {1, 1}];{Graphics[{Red, ℛ}], Graphics[{Thick, Red, ℛ}], Graphics[{Thick, Red, Dashed, ℛ}]}ArcLength[HalfLine[{0, 0}, {1, 1}]]范围 (18)
图形 (9)
规范 (3)
定义一条起始于
,方向为
的 HalfLine:
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[HalfLine[{1, 1}, {2, 1}]]]ill = Graphics[{PointSize[Medium], Point[{{1, 1}, {3, 2}}]}, PlotRange -> {{0, 4}, {0, 3}}, Frame -> True];Show[ill, Graphics[HalfLine[{{1, 1}, {3, 2}}]]]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[HalfLine[{1, 1, 1}, {1, 2, 3}]]]ill = Graphics3D[{PointSize[Medium], Point[{{1, 1, 1}, {2, 3, 4}}]}, PlotRange -> {{0, 5}, {0, 5}, {0, 5}}, Axes -> True];Show[ill, Graphics3D[HalfLine[{{1, 1, 1}, {2, 3, 4}}]]]Table[Graphics[HalfLine[{0, 0}, {Cos[θ], Sin[θ]}], ImageSize -> Tiny, PlotLabel -> θ], {θ, 0, π, π / 4}]样式 (5)
各种粗细的 HalfLine:
Table[Graphics[{Thickness[i], HalfLine[{{0, 0}, {2, 1}}]}], {i, {Tiny, Small, Medium, Large}}]Table[Graphics[{t, HalfLine[{{0, 0}, {2, 1}}]}], {t, {Thin, Thick}}]Table[Graphics[{Thickness[i], HalfLine[{{0, 0}, {2, 1}}]}], {i, {.005, .05, .1}}]Table[Graphics[{AbsoluteThickness[i], HalfLine[{{0, 0}, {2, 1}}]}], {i, {1, 5, 10}}]Table[Graphics[{Dashing[i], HalfLine[{{0, 0}, {2, 1}}]}], {i, {Tiny, Small, Medium, Large}}]Table[Graphics[{d, HalfLine[{{0, 0}, {2, 1}}]}], {d, {Dotted, Dashed, DotDashed}}]Table[Graphics[{c, HalfLine[{{0, 0}, {2, 1}}]}], {c, {Red, Green, Blue, Yellow}}]Graphics[{Thick, Blue, Dashed, HalfLine[{{0, 0}, {2, 1}}]}]坐标 (1)
点和矢量可以是 Dynamic:
DynamicModule[{θ = 0}, {Slider[Dynamic[θ], {0, 2Pi}], Graphics[HalfLine[{0, 0}, Dynamic[{Cos[θ], Sin[θ]}]]]}]区域 (9)
RegionEmbeddingDimension[HalfLine[{-1, -1}, {1, 1}]]RegionEmbeddingDimension[HalfLine[{0, 0, 0}, {1, 1, 1}]]RegionDimension[HalfLine[{-1, 1}, {1, 1}]]ℛ = HalfLine[{0, 0}, {1, 1}];{RegionMember[ℛ, {2, 2}], RegionMember[ℛ, {3, 4}]}RegionMember[ℛ, {x, y}]ℛ = HalfLine[{0, 0}, {1, 1}];RegionMeasure[ℛ]RegionCentroid[ℛ]ℛ = HalfLine[{0, 0}, {1, 1}];RegionDistance[ℛ, {1, 2}]{Plot3D[Evaluate@RegionDistance[ℛ, {x, y}], {x, -1, 1}, {y, -1, 1}, MeshFunctions -> {#3&}, Mesh -> 5],
ContourPlot[Evaluate[RegionDistance[ℛ, {x, y}]], {x, -3, 3}, {y, -3, 3}, Contours -> {{0.5, Red}, {1, Green}, {1.5, Blue}}]}ℛ = HalfLine[{0, 0}, {1, 2}];RegionNearest[ℛ, {1, 1}]pts = Table[{0, 0} + {Cos[k 2 π / 16], Sin[k 2π / 16]}, {k, 0, 15}];
nst = RegionNearest[ℛ, #]& /@ pts;Legended[Graphics[{{Thick, Gray, ℛ}, {Thin, Gray, Line[Transpose[{pts, nst}]]}, {Red, Point[pts]}, {Blue, Point[nst]}}], PointLegend[{Red, Blue}, {"start", "nearest"}]]ℛ = HalfLine[{0, 0, 0}, {1, 1, 0}];BoundedRegionQ[ℛ]RegionBounds[ℛ]ℛ = HalfLine[{1, 1}, {1, 1}];Integrate[(1 / (x y))^2, {x, y}∈ℛ]ℛ = HalfLine[{0, 0}, {1, 1}];Minimize[{(x y - 1)^2 + 3, {x, y}∈ℛ}, {x, y}]ℛ = HalfLine[{0, 0, 0}, {1, 2, 3}];Reduce[x^2 + y^2 + z^2 == 1 && {x, y, z}∈ℛ, {x, y, z}]应用 (4)
rays = Table[HalfLine[{0, y}, {1, 1}], {y, 5}];Graphics[rays, PlotRange -> {{-6, 6}, {0, 6}}]rays = Table[HalfLine[{Cos[ϕ], Sin[ϕ]}, {Cos[ϕ], Sin[ϕ]}], {ϕ, 0, 2Pi, 2Pi / 100}];Graphics[rays]asym = HalfLine[{0, 0}, {1, 1}];Plot[(1/x) + Abs[x], {x, -2, 7}, Epilog -> {Red, Dashed, asym}]pt = {0.7, 0.7 ^ 2};Plot[x ^ 2, {x, -1, 1}, Epilog -> {Red, HalfLine[pt, {-1, 0}], HalfLine[pt, {0, -1}]}]属性和关系 (4)
任何 InfiniteLine 都是两条半直线的并:
Subscript[ℛ, 1] = InfiniteLine[{1, 0}, {1, 2}];Subscript[ℛ, 2] = RegionUnion[HalfLine[{1, 0}, {1, 2}], HalfLine[{1, 0}, {-1, -2}]];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]ParametricRegion 可以表示任意 HalfLine:
Subscript[ℛ, 1] = ParametricRegion[{t + 1, 2t}, {{t, 0, ∞}}];Subscript[ℛ, 2] = HalfLine[{1, 0}, {1, 2}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]ImplicitRegion 可以表示任意 HalfLine:
Subscript[ℛ, 1] = ImplicitRegion[1 - x ≤ 0 && 1 + x - y == 0, {x, y}];Subscript[ℛ, 2] = HalfLine[{{1, 2}, {3, 4}}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]HalfLine 是 ConicHullRegion 的特例:
chr = ConicHullRegion[{{0, 0}}, {{1, 1}}];hline = HalfLine[{0, 0}, {1, 1}];RegionEqual[chr, hline]巧妙范例 (3)
Graphics[Table[{Hue[RandomReal[]], HalfLine[RandomReal[1, 2], RandomReal[{-1, 1}, 2]]}, {100}]]Graphics[Table[HalfLine[{Cos[θ], Sin[θ]}, {-Sin[θ], Cos[θ]}], {θ, 0, 2π, π / 20}], PlotRange -> 2]Graphics[Table[HalfLine[{Cos[ϕ], Sin[ϕ]}, {Sin[ϕ], Cos[ϕ]}], {ϕ, 0, 2Pi, 2Pi / 200}], PlotRange -> 3]文本
Wolfram Research (2014),HalfLine,Wolfram 语言函数,https://reference.wolfram.com/language/ref/HalfLine.html.
CMS
Wolfram 语言. 2014. "HalfLine." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/HalfLine.html.
APA
Wolfram 语言. (2014). HalfLine. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/HalfLine.html 年
BibTeX
@misc{reference.wolfram_2026_halfline, author="Wolfram Research", title="{HalfLine}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/HalfLine.html}", note=[Accessed: 11-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_halfline, organization={Wolfram Research}, title={HalfLine}, year={2014}, url={https://reference.wolfram.com/language/ref/HalfLine.html}, note=[Accessed: 11-September-2026]}