Polygon
詳細とオプション
- Polygonは,幾何領域としてあるいはグラフィックスプリミティブとして使うことができる.
- Polygon[{p1,…,pn}]は,線分{p1,p2},…,{pn-1,pn}と{pn,p1}で閉じた曲線内のすべての点を表す平面領域である.
- 平面上のある点から任意の方向に向かう半直線が境界線と奇数回交差するなら,その点は多角形の要素である.
- Polygon[{p1,…,pn}{{q1,…,qm},…}]は,外側多角形Polygon[{p1,…,pn}]と1つあるいは複数の内側多角形Polygon[{q1,…,qm}],…からなる穴のある多角形を指定する.
- ある点が外側多角形には含まれるが任意の内側多角形には含まれないなら,その点は多角形の要素である.
- Polygon[{poly1,poly2,…}]は,穴があるまたは穴がない多角形 polyiの集合で,幾何学計算では polyiの和集合として扱われる.
- Polygon[{p1,…,pn},data]は,事実上,data 中の座標として現れる整数 i を対応する piで置換する.
-
Polygon[{p1,…,pn},{b1,…,bn}] 多角形の境界点{pb1,…,pbk} Polygon[{p1,…,pn},{{o1,…,ok}{{i1,…,il},…}] 外側多角形の境界点{po1,…,pok}と内側多角形の境界点{pi1,…,pil}等 Polygon[{p1,…,pn},{{b1,…,bn},{o1,…,ok}{{i1,…,il},…},…}] 複数の多角形の集合 - 点 piは,幾何領域として任意の埋込み次元を持つことができるが,すべてが1つの平面上で同じ埋込み次元を持たなければならない.
- グラフィックスでは,点 piは,Scaled,Offset,ImageScaled,Dynamicの各式でよい.
- グラフィックスの描画は,FaceForm,EdgeForm,Texture,Specularity,Opacity,色の各指示子の影響を受ける.
- FaceForm[front,back]を使って3Dにおける多面体の表と裏に異なるスタイルを指定することができる.表は右辺規則と最初の3点の方向で定義される.
- 次は,グラフィックスで使用可能なオプションおよび設定値である.
-
VertexColors Automatic 補間される頂点の色 VertexNormals Automatic 陰影付けのための有効な頂点法線 VertexTextureCoordinates None テクスチャのための座標 - Polygonは,GeometricSceneの記号の点と一緒に使うことができる.
例題
すべて開く すべて閉じる例 (2)
pol = Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]Graphics[pol]Area[pol]pol = Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}];{Graphics3D[{Pink, pol}], Graphics3D[{EdgeForm[Thick], Pink, pol}], Graphics3D[{EdgeForm[Dashed], Pink, pol}]}スコープ (22)
グラフィックス (12)
指定 (3)
p2 = {{0, 0}, {1, 0}, {0, 1}};Graphics[Polygon[{p2, p2 + 1}]]p3 = {{1, 0, 0}, {1, 1, 1}, {0, 0, 1}};Graphics3D[Polygon[{p3, p3 + 1}]]Graphics[Polygon[Table[{Cos[2π k / 6], Sin[2π k / 6]}, {k, 0, 5}]]]Graphics3D[Polygon[Table[{Cos[2π k / 6], Sin[2π k / 6], 0}, {k, 0, 5}]]]Graphics[Polygon[{{0, 0}, {2, 0}, {1, Sqrt[3]}} -> {{{(1/2), (1/2 Sqrt[3])}, {(3/2), (1/2 Sqrt[3])}, {1, (2/Sqrt[3])}}}]]Graphics3D[Polygon[{{0, 0, 0}, {2, 0, 0}, {1, Sqrt[3], 0}} -> {{{(1/2), (1/2 Sqrt[3]), 0}, {(3/2), (1/2 Sqrt[3]), 0}, {1, (2/Sqrt[3]), 0}}}]]スタイリング (6)
Table[Graphics[{c, Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]}], {c, {Red, Green, Blue, Yellow}}]Table[Graphics3D[{c, Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]}], {c, {Red, Green, Blue, Yellow}}]Textureを使って多角形の面に使用するテクスチャが指定できる:
{Graphics[{Texture[ExampleData[{"TestImage", "JellyBeans2"}]], Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, VertexTextureCoordinates -> {{1, 0}, {0.5, 1}, {0, 0}}]}], Graphics3D[{Texture[ExampleData[{"TestImage", "JellyBeans2"}]], Polygon[{{0, 0, 0}, {1, 1, 0}, {0, 1, 1}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {0.5, 1}}]}, Lighting -> "Neutral"]}Table[Graphics[{Opacity[o], Texture[ExampleData[{"TestImage", "House"}]], Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, VertexTextureCoordinates -> {{1, 0}, {0.5, 1}, {0, 0}}]}], {o, {0.25, 0.5, 0.75, 1}}]Table[Graphics3D[{Texture[ExampleData[{"TestImage", "Sailboat"}]], Polygon[{{0, 0, 0}, {1, 1, 0}, {0, 1, 1}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {0.5, 1}}]}, Lighting -> {{"Directional", c, {4, -4, 4}}}], {c, {Red, Green, Yellow, White}}]FaceFormおよびEdgeFormを使って内部と境界のスタイルが指定できる:
Graphics[{FaceForm[Pink], EdgeForm[Directive[Dashed, Thick, Blue]], Polygon[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}]}]Graphics3D[{FaceForm[Pink], EdgeForm[Directive[Dashed, Thick, Blue]], Polygon[{{0, 0, 0}, {1, 1, 0}, {1, 1, 1}, {0, 0, 1}}]}]三次元では,FaceFormを使って表面と裏面に異なる特性が指定できる:
p = {FaceForm[Yellow, Blue], Polygon[{{1, 0, 0}, {0, Sqrt[3], 0}, {-1, 0, 0}}]};{Graphics3D[p, ViewPoint -> Top], Graphics3D[p, ViewPoint -> Bottom]}FaceFormを使って3Dの外側と内側に別々のテクスチャを設定する:
vtc = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
coords = {{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}, {{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}}, {{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}}, {{1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}}, {{0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}}};Graphics3D[{FaceForm[Texture[[image]], Texture[[image]]], Polygon[coords, VertexTextureCoordinates -> Table[vtc, {6}]]}, Lighting -> "Neutral"]VertexColorsを使って頂点における色が指定できる:
Graphics[Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, VertexColors -> {Red, Green, Blue}]]Graphics3D[Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}, VertexColors -> {Red, Green, Blue}]]3Dの多角形については,法線はVertexNormalsを使って頂点で指定することができる:
n = {1, -1, 1};Graphics3D[{Yellow, Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}, VertexNormals -> {-n, n, n}]}]座標 (3)
スケールされた(Scaled)座標を使う:
Graphics[Polygon[{Scaled[{0, 0}], Scaled[{.5, 1}], Scaled[{1, 0}]}], Frame -> True]Graphics3D[Polygon[{Scaled[{0, 0, .2}], Scaled[{.5, 1, .8}], Scaled[{1, 0, .2}]}], Axes -> True]2Dで画像がスケールされた(ImageScaled)座標を使う:
Graphics[Polygon[{ImageScaled[{0, 0}], ImageScaled[{.5, 1}], ImageScaled[{1, 0}]}], Frame -> True]2DでOffset座標を使う:
Graphics[Polygon[{Offset[{10, 10}, {0, 0}], Offset[{0, -20}, {.5, 1}], Offset[{-10, 10}, {1, 0}]}], Frame -> True]領域 (10)
RegionEmbeddingDimension[Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]]RegionDimension[Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]]ℛ = Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}];{RegionMember[ℛ, {2 / 3, 1 / 3, 2 / 3}], RegionMember[ℛ, {0, 0, 0}]}RegionMember[ℛ, {x, y, z}]ℛ = Polygon[{{1, 0}, {1, 1}, {0, 0}}];{Area[ℛ], RegionMeasure[ℛ]}c = RegionCentroid[ℛ]Graphics[{{Pink, ℛ}, {Black, Point[c]}}]ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];{RegionDistance[ℛ, {3, 4}], RegionDistance[ℛ, {1, 1}]}{Plot3D[Evaluate@RegionDistance[ℛ, {x, y}], {x, -3, 3}, {y, -3, 3}, MeshFunctions -> {#3&}, Mesh -> 5], ContourPlot[Evaluate@RegionDistance[ℛ, {x, y}], {x, -4, 4}, {y, -4, 4}, Contours -> {{0.5, Red}, {1, Green}, {1.5, Blue}}]}ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];{SignedRegionDistance[ℛ, {3, 4}], SignedRegionDistance[ℛ, {1, 1}]}Plot3D[SignedRegionDistance[ℛ, {x, y}], {x, -3, 3}, {y, -3, 3}, MeshFunctions -> {#3&}, Mesh -> {{0}}, MeshShading -> {Red, Green}]ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];RegionNearest[ℛ, {3, 4}]pts = Table[4{Cos[k 2 π / 25], Sin[k 2π / 25]}, {k, 0., 24}];
nst = RegionNearest[ℛ, #]& /@ pts;Legended[Graphics[{{Gray, ℛ}, {Thin, Gray, Line[Transpose[{pts, nst}]]}, {Red, Point[pts]}, {Blue, Point[nst]}}], PointLegend[{Red, Blue}, {"start", "nearest"}]]ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];BoundedRegionQ[ℛ]rr = RegionBounds[ℛ]Graphics[{ℛ, {EdgeForm[{Dashed, Red}], Opacity[0.2, Yellow], Cuboid@@Transpose[rr]}}]多角形上でIntegrate:
ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];Integrate[x ^ 2 + y ^ 2, {x, y}∈ℛ]ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];Minimize[{x y - x, {x, y}∈ℛ}, {x, y}]ℛ = Polygon[{{-2, 0}, {-1, 3 / 2}, {1, 3 / 2}, {2, 0}, {1, -3 / 2}, {-1, -3 / 2}}];Solve[x^2 + y^2 == 4 && {x, y}∈ℛ, {x, y}]Graphics[{{LightBlue, EdgeForm[Gray], ℛ}, {Green, Circle[{0, 0}, 2]}, {Red, PointSize[Medium], Point[{x, y} /. %]}}]オプション (7)
VertexColors (2)
VertexNormals (1)
{p1, p2, p3} = {{1, 0, 0}, {1, 1, 1}, {0, 0, 1}};n = Cross[p2 - p1, p3 - p1]Graphics3D[{Yellow, Polygon[{p1, p2, p3}, VertexNormals -> {n, n, n}]}]Graphics3D[{Yellow, Polygon[{p1, p2, p3}, VertexNormals -> {-n, n, n}]}]VertexTextureCoordinates (4)
Graphics[{Texture[ExampleData[{"TestImage", "Flower"}]], Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, VertexTextureCoordinates -> {{1, 0}, {0.5, 1}, {0, 0}}]}]Graphics[{Texture[ExampleData[{"TestImage", "Airplane2"}]], Polygon[{{1, 1}, {3, 1}, {3, 3}, {1, 3}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}]Graphics3D[{Texture[ExampleData[{"TestImage", "Airplane2"}]], Polygon[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}, Lighting -> "Neutral"]統一されていないテクスチャ座標値を使ってテクスチャを繰り返す:
{Graphics[{Texture[ExampleData[{"TestImage", "Mandrill"}]], Polygon[{{1, 1}, {3, 1}, {3, 3}, {1, 3}}, VertexTextureCoordinates -> {{0, 0}, {2, 0}, {2, 2}, {0, 2}}]}], Graphics3D[{Texture[ExampleData[{"TestImage", "Mandrill"}]], Polygon[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}, VertexTextureCoordinates -> {{0, 0}, {2, 0}, {2, 2}, {0, 2}}]}, Lighting -> "Neutral"]}VertexColorsはテクスチャマッピングに優先する:
Graphics3D[{Texture[[image]], Polygon[{{-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}},
VertexColors -> {Red, Green, Blue, Purple}]}, Lighting -> "Neutral"]アプリケーション (3)
ngon[p_, q_] := Polygon[Table[{Cos[2Pi k q / p], Sin[2Pi k q / p]}, {k, p}]]Row[Table[Graphics[{EdgeForm[Red], LightRed, ngon[n, 1]}, ImageSize -> 70], {n, 3, 14}]]Row[Reap[Table[Table[If[CoprimeQ[p, q], Sow[Graphics[{EdgeForm[Green], LightGreen, ngon[p, q]}, ImageSize -> 70]]], {q, 2, p / 2}], {p, 5, 12}]][[2, 1]]]h[x_, y_] := Polygon[Table[{Cos[2Pi k / 6] + x, Sin[2Pi k / 6] + y}, {k, 6}]]Graphics[{EdgeForm[Opacity[.7]], StandardBlue, Table[h[3i + 3((-1) ^ j + 1) / 4, Sqrt[3] / 2j], {i, 5}, {j, 10}]}]PolyhedronDataから多角形面を得る:
p = N[PolyhedronData["TruncatedIcosahedron", "Faces", "Polygon"]];shrink[t_, Polygon[x_List, opts___]] := Module[{c = Plus@@x / Length[x]}, Polygon[Map[(c + (1 - t)(# - c))&, x], opts]]Animate[Graphics3D[{FaceForm[Yellow, Green], p /. y_Polygon :> shrink[s, y]}, PlotRange -> 2.5], {s, 0, .8}, SaveDefinitions -> True, AnimationRunning -> False, AnimationDirection -> ForwardBackward, DefaultDuration -> 1]特性と関係 (4)
GraphicsComplexは,多くの頂点を共有する多角形を効率的に生成する方法を提供する:
v = {{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}};i = {{1, 2, 5}, {2, 3, 5}, {3, 4, 5}, {4, 1, 5}};{Graphics3D[{Opacity[.7], GraphicsComplex[v, Polygon[i]]}], Graphics3D[{GraphicsComplex[v, Line[i]]}]}Normalをグラフィックス複合体に適用すると通常の多角形が生成できる:
Normal[GraphicsComplex[v, Polygon[i]]]Subscript[ℛ, 1] = Polygon[{{0, 0}, {1, 0}, {1, 1}}];
Subscript[ℛ, 2] = Triangle[{{0, 0}, {1, 0}, {1, 1}}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]Subscript[ℛ, 1] = Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}];
Subscript[ℛ, 2] = Rectangle[{0, 0}, {1, 1}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]3つの頂点があるSimplexはPolygonの特殊ケースである:
Subscript[ℛ, 1] = Polygon[{{0, 0}, {1, 0}, {1, 1}}];
Subscript[ℛ, 2] = Simplex[{{0, 0}, {1, 0}, {1, 1}}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]Subscript[ℛ, 1] = Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}}];
Subscript[ℛ, 2] = Simplex[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]考えられる問題 (3)
三次元では,頂点が平面上にない場合,多角形の三角形分割は予測できない:
Graphics3D[Polygon[{{0, 0, 0}, {1, 1, 0}, {0, 1, 0}, {0, 0, 1}}]]Graphics3D[Polygon[RandomReal[1, {10, 3}]]]Polygon[{{0, 0, 0}, {1, 1, 0}, {0, 1, 0}, {0, 0, 1}}]RegionQ[%]アンチエイリアス処理の結果として個々の多角形間に継ぎ目が現れることがある:
Graphics[{Gray, Table[Polygon[{{x, 0}, {x + 1, 0}, {x + 1, 1}, {x, 1}}], {x, 0, 2}]}]単一の多角形オブジェクトを使うことで継ぎ目を避けることができる:
Graphics[{Gray, Polygon[Table[{{x, 0}, {x + 1, 0}, {x + 1, 1}, {x, 1}}, {x, 0, 2}]]}]おもしろい例題 (3)
Graphics[Table[{EdgeForm[Black], Hue[RandomReal[]], Polygon[RandomReal[1, {3, 2}]]}, {30}]]Graphics3D[Table[{EdgeForm[Black], Opacity[.7], Hue[RandomReal[]], Polygon[RandomReal[1, {3, 3}]]}, {30}], Lighting -> "Neutral"]With[{d = 2Pi / 12}, Graphics[Table[{EdgeForm[Opacity[.6]], Hue[(-11 + q + 10 r) / 72], Polygon[{(8 - r){Cos[d(q - 1)], Sin[d(q - 1)]}, (8 - r){Cos[d(q + 1)], Sin[d(q + 1)]}, (10 - r){Cos[d q], Sin[d q]}}]}, {r, 6}, {q, 12}]]]Animate[Graphics[Rotate[Polygon[Table[{Cos[t], Sin[t]}, {t, 0, 4Pi, 4Pi / 5}]], θ, {0, 0}], PlotRange -> 1.2], {θ, 0, 2π}, AnimationRunning -> False]テクニカルノート
関連するガイド
-
▪
- グラフィックスオブジェクト ▪
- 幾何学的計算 ▪
- 地図と地図製作 ▪
- 多角形 ▪
- 平面幾何学 ▪
- 基本的な特殊領域 ▪
- 中学・高校における教育 ▪
- 立体幾何学 ▪
- 総合幾何学 ▪
- 記号的なグラフィックス言語
履歴
1988 で導入 (1.0) | 1996 で更新 (3.0) ▪ 2019 (12.0)
テキスト
Wolfram Research (1988), Polygon, Wolfram言語関数, https://reference.wolfram.com/language/ref/Polygon.html (2019年に更新).
CMS
Wolfram Language. 1988. "Polygon." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/Polygon.html.
APA
Wolfram Language. (1988). Polygon. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Polygon.html
BibTeX
@misc{reference.wolfram_2026_polygon, author="Wolfram Research", title="{Polygon}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/Polygon.html}", note=[Accessed: 06-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_polygon, organization={Wolfram Research}, title={Polygon}, year={2019}, url={https://reference.wolfram.com/language/ref/Polygon.html}, note=[Accessed: 06-November-2026]}