如何:建立合併幾何
此範例示範如何結合幾何。 若要合併兩個 CombinedGeometry 幾何,請使用 物件。 使用要結合的兩個幾何來設定其 Geometry1 和 Geometry2 屬性,並設定 GeometryCombineMode 屬性,以決定幾何如何結合在一起、設定為 Union
、 Intersect
、 Exclude
或 Xor
。
若要從兩個或多個幾何建立複合幾何,請使用 GeometryGroup 。
範例
在下列範例中, CombinedGeometry 會使用 的 Exclude
幾何合併模式來定義 。 Geometry1和 Geometry2 都定義為相同半徑的圓形,但中心位移為 50。
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Combines two geometries using the exclude combine mode. -->
<CombinedGeometry GeometryCombineMode="Exclude">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="75,75" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="125,75" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
合併幾何排除
在下列標記中, CombinedGeometry 會使用 的合併模式 Intersect
來定義 。 Geometry1和 Geometry2 都定義為相同半徑的圓形,但中心位移為 50。
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Combines two geometries using the intersect combine mode. -->
<CombinedGeometry GeometryCombineMode="Intersect">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="75,75" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="125,75" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
結合幾何交集
在下列標記中, CombinedGeometry 會使用 的合併模式 Union
來定義 。 Geometry1和 Geometry2 都定義為相同半徑的圓形,但中心位移為 50。
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Combines two geometries using the union combine mode. -->
<CombinedGeometry GeometryCombineMode="Union">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="75,75" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="125,75" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
結合幾何聯集
在下列標記中, CombinedGeometry 會使用 的合併模式 Xor
來定義 。 Geometry1和 Geometry2 都定義為相同半徑的圓形,但中心位移為 50。
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Combines two geometries using the XOR combine mode. -->
<CombinedGeometry GeometryCombineMode="Xor">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="75,75" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="125,75" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
結合幾何 Xor
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應