开发者

Combine multiple Ellipses

I need a way to combine multiple EllipseGeometry to make a union between them, but CombineGeometry class only can combine 2 Geometries. The ideal way is 开发者_JS百科to have a class similar CombineGeometry that accepts more than Geometry1 and Geometry2 shapes.

Anyone knows an object that makes such a behaviour?


EllipseGeometry is a Geometry too so you can combine like this:

  <CombinedGeometry GeometryCombineMode="Union">
       <CombinedGeometry.Geometry1>
            <EllipseGeometry RadiusX="70" RadiusY="30" Center="100,150"  />
       </CombinedGeometry.Geometry1>
       <CombinedGeometry.Geometry2>
            <EllipseGeometry RadiusX="70" RadiusY="30" Center="200,150" />
       </CombinedGeometry.Geometry2>
  </CombinedGeometry>

EDIT To combine three or more EllipseGeometries you could use this mechanism

<CombinedGeometry   GeometryCombineMode="Union">
    <CombinedGeometry.Geometry1>
        <CombinedGeometry GeometryCombineMode="Union">
              <CombinedGeometry.Geometry1>
                    <EllipseGeometry RadiusX="70" RadiusY="30" Center="100,150"  />
              </CombinedGeometry.Geometry1>
              <CombinedGeometry.Geometry2>
                    <EllipseGeometry RadiusX="70" RadiusY="30" Center="200,150" />
              </CombinedGeometry.Geometry2>
        </CombinedGeometry>
    </CombinedGeometry.Geometry1>
    <CombinedGeometry.Geometry2>
           <EllipseGeometry RadiusX="70" RadiusY="30" Center="100,150"  />
    </CombinedGeometry.Geometry2>
</CombinedGeometry>

You can create a new class that is derived from Geometry and have a Geometry[] in it and implement methods using above mechanism.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜