当前位置: 首页>>代码示例>>C#>>正文


C# Polygon.getColoredPoint方法代码示例

本文整理汇总了C#中Polygon.getColoredPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Polygon.getColoredPoint方法的具体用法?C# Polygon.getColoredPoint怎么用?C# Polygon.getColoredPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Polygon的用法示例。


在下文中一共展示了Polygon.getColoredPoint方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getTriangle

 /**
  * This method was created by a SmartGuide.
  * @return Point
  * @param a int
  * @param b int
  */
 public ColoredPoint getTriangle(int a, int b, Polygon p)
 {
     for (int i = 0; i < p.vertices.Count; i++)
     {
         if ((i != b) && (i != a))
         {
             if (p.areNeighbors(a, i) && p.areNeighbors(b, i) && (p.getColoredPoint(i).vertexColor == 0))
             {
                 return p.getColoredPoint(i);
             }
         }
     }
     return null;
 }
开发者ID:kaisellgren,项目名称:Art-Gallery-Problem,代码行数:20,代码来源:Triangulation.cs

示例2: getTriangle

        /**
         * This method was created by a SmartGuide.
         * @return Point
         * @param a int
         * @param b int
         */
        public ColoredPoint getTriangle(int a, int b, Polygon p)
        {
            for (int i = 0; i < p.vertices.Count; i++)
            {
                if ((i != b) && (i != a))
                {
                    if((p.getColoredPoint(i).vertexColor == ColoredPoint.color.None))
                    {
                        return p.getColoredPoint(i);
                    }
                }
            }

            return null;
        }
开发者ID:stanpalatnik,项目名称:Art-Gallery-Problem,代码行数:21,代码来源:Triangulation.cs

示例3: triangulate

 public DiagonalSet triangulate(Polygon P)
 {
     DiagonalSet d = new DiagonalSet();
     int i, i1, i2;
     int n = P.vertices.Count;
     if (n >= 3)
         for (i = 0; i < n; i++)
         {
             i1 = (i + 1) % n;
             i2 = (i + 2) % n;
             if (isDiagonal(i, i2, P))
             {
                 d.addDiagonal(P.getColoredPoint(i), P.getColoredPoint(i2), P.getColoredPoint(i1));
                 clipEar(i1, P);
                 return d.merge(triangulate(P));
             }
         }
     return d;
 }
开发者ID:kaisellgren,项目名称:Art-Gallery-Problem,代码行数:19,代码来源:Triangulation.cs

示例4: color

        TriangulationColoring color(DiagonalSet d, Polygon p)
        {
            TriangulationColoring CSet = new TriangulationColoring();
            Edge curDiag = d.getDiagonal(0);
            ColoredPoint a, b, cut;
            int d1, d2;
            if (p.vertices.Count == 3)
            {
                a = p.getColoredPoint(0);
                b = p.getColoredPoint(1);
                cut = p.getColoredPoint(2);
                a.vertexColor = ColoredPoint.color.Blue;
                b.vertexColor = ColoredPoint.color.Red;
                cut.vertexColor = ColoredPoint.color.Blue;
                CSet.add(a);
                CSet.add(b);
                CSet.add(cut);
                return CSet;
            }

            a = p.getColoredPoint(curDiag.getStart().index);
            b = p.getColoredPoint(curDiag.getEnd().index);
            cut = p.getColoredPoint(curDiag.getCutPnt().index);

            p.getColoredPoint(a.index).vertexColor = ColoredPoint.color.Blue;
            p.getColoredPoint(b.index).vertexColor = ColoredPoint.color.Red;
            p.getColoredPoint(cut.index).vertexColor = ColoredPoint.color.Blue;

            CSet.add(a);
            CSet.add(b);
            CSet.add(cut);

            if ((d1 = d.isInDiagSet(a, cut)) != -1) CSet.add(recurseColor(d, p, d1));
            if ((d2 = d.isInDiagSet(b, cut)) != -1) CSet.add(recurseColor(d, p, d2));

            CSet.add(recurseColor(d, p, 0));
            return CSet;
        }
开发者ID:kaisellgren,项目名称:Art-Gallery-Problem,代码行数:38,代码来源:Triangulation.cs

示例5: recurseColor

        TriangulationColoring recurseColor(DiagonalSet d, Polygon p, int i)
        {
            TriangulationColoring CSet = new TriangulationColoring();
            Edge curDiag = d.getDiagonal(i);
            ColoredPoint a, b, cut;
            int d1, d2;

            a = p.getColoredPoint(curDiag.Start.index);
            b = p.getColoredPoint(curDiag.End.index);
            cut = p.getColoredPoint(curDiag.Cutoff.index);

            if (cut.vertexColor == ColoredPoint.color.None) // point has not been colored
            {
                p.vertices[cut.index].vertexColor = (GeometryTest.ColoredPoint.color)nextColor(a.index, b.index);
                CSet.add(cut);
                if ((d1 = d.isInDiagSet(a, cut)) != -1)
                    CSet.add(recurseColor(d, p, d1));
                if ((d2 = d.isInDiagSet(b, cut)) != -1)
                    CSet.add(recurseColor(d, p, d2));

                if ((d1 = d.isInDiagSet2(a, cut)) != -1)
                    CSet.add(recurseColor(d, p, d1));
                if ((d2 = d.isInDiagSet2(b, cut)) != -1)
                    CSet.add(recurseColor(d, p, d2));
            }
            else
            {
                cut = getTriangle(a.index, b.index, p);
                if (cut == null)
                {
                    return CSet;
                }
                p.vertices[cut.index].vertexColor = (GeometryTest.ColoredPoint.color)nextColor((int)a.vertexColor, (int)b.vertexColor);
                CSet.add(cut);
                if ((d1 = d.isInDiagSet(a, cut)) != -1) CSet.add(recurseColor(d, p, d1));
                if ((d2 = d.isInDiagSet(b, cut)) != -1) CSet.add(recurseColor(d, p, d2));
                if ((d1 = d.isInDiagSet2(a, cut)) != -1) CSet.add(recurseColor(d, p, d1));
                if ((d2 = d.isInDiagSet2(b, cut)) != -1) CSet.add(recurseColor(d, p, d2));
            }
            return CSet;
        }
开发者ID:stanpalatnik,项目名称:Art-Gallery-Problem,代码行数:41,代码来源:Triangulation.cs

示例6: inCone

        bool inCone(int i, int j, Polygon P)
        {
            int n = P.vertices.Count;

            int i1 = (i + 1) % n;
            int in1 = (i + n - 1) % n;

            if (LeftOn(P.getColoredPoint(in1), P.getColoredPoint(i), P.getColoredPoint(i1)))
            {
                return Left(P.getColoredPoint(i), P.getColoredPoint(j), P.getColoredPoint(in1)) &&
                 Left(P.getColoredPoint(j), P.getColoredPoint(i), P.getColoredPoint(i1));
            }

            else
            {
                return !(LeftOn(P.getColoredPoint(i), P.getColoredPoint(j), P.getColoredPoint(i1)) && LeftOn(P.getColoredPoint(j), P.getColoredPoint(i), P.getColoredPoint(in1)));
            }
        }
开发者ID:stanpalatnik,项目名称:Art-Gallery-Problem,代码行数:18,代码来源:Triangulation.cs

示例7: diagonal

        bool diagonal(int i, int j, Polygon P)
        {
            int k;
            int k1;
            int n = P.vertices.Count;

            for (k = 0; k < n; k++)
            {
                k1 = (k + 1) % n;
                if (!((k == i) || (k1 == i) || (k == j) || (k1 == j)))
                {
                    if (intersect(P.getColoredPoint(i), P.getColoredPoint(j), P.getColoredPoint(k), P.getColoredPoint(k1)))
                        return false;
                }
            }
            return true;
        }
开发者ID:stanpalatnik,项目名称:Art-Gallery-Problem,代码行数:17,代码来源:Triangulation.cs


注:本文中的Polygon.getColoredPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。