示例#1
0
        /// <summary>
        /// Add inner steiner points (for coly polygons)
        /// </summary>
        /// <param name="points"></param>
        public void AddSteiner(SplineLines.Line points)
        {
            for (int i = 0; i < points.polyPoints.Count; ++i)
            {
                polygon.AddSteinerPoint(points.polyPoints[i]);
            }

            this.data.Add(points);
        }
示例#2
0
        void AddTriangles(SplineLines.Line innerLine, SplineLines.Line outerLine)
        {
            int count = outerLine.points.Count;

            if (IsClockwise(outerLine.points))
            {
                outerLine.points.Reverse();
                innerLine.points.Reverse();
                outerLine.normals.Reverse();
                innerLine.normals.Reverse();
                outerLine.tangents.Reverse();
                innerLine.tangents.Reverse();
                outerLine.colors.Reverse();
                innerLine.colors.Reverse();

                vertices.AddRange(outerLine.points);
                vertices.AddRange(innerLine.points);
                normals.AddRange(outerLine.normals);
                normals.AddRange(innerLine.normals);
                tangents.AddRange(outerLine.tangents);
                tangents.AddRange(innerLine.tangents);
                colors.AddRange(outerLine.colors);
                colors.AddRange(innerLine.colors);

                triangles = new List <int>();
                for (int i = 1; i < count; ++i)
                {
                    triangles.Add(i + count - 1);
                    triangles.Add(i + count);
                    triangles.Add(i - 1);
                    triangles.Add(i - 1);
                    triangles.Add(i + count);
                    triangles.Add(i);
                }
                triangles.Add(count + count - 1);
                triangles.Add(0 + count);
                triangles.Add(count - 1);
                triangles.Add(count - 1);
                triangles.Add(0 + count);
                triangles.Add(0);
            }
            else
            {
                vertices.AddRange(outerLine.points);
                vertices.AddRange(innerLine.points);
                normals.AddRange(outerLine.normals);
                normals.AddRange(innerLine.normals);
                tangents.AddRange(outerLine.tangents);
                tangents.AddRange(innerLine.tangents);
                colors.AddRange(outerLine.colors);
                colors.AddRange(innerLine.colors);

                triangles = new List <int>();
                for (int i = 1; i < count; ++i)
                {
                    triangles.Add(i + count - 1);
                    triangles.Add(i + count);
                    triangles.Add(i - 1);
                    triangles.Add(i - 1);
                    triangles.Add(i + count);
                    triangles.Add(i);
                }
                triangles.Add(count + count - 1);
                triangles.Add(0 + count);
                triangles.Add(count - 1);
                triangles.Add(count - 1);
                triangles.Add(0 + count);
                triangles.Add(0);
            }
        }
示例#3
0
 void AddData(SplineLines.Line data)
 {
     this.data.Add(data);
 }
示例#4
0
 /// <summary>
 /// Add hole into current polygon
 /// </summary>
 /// <param name="line"></param>
 public void AddChildAsHole(SplineLines.Line line)
 {
     polygon.AddHole(new Polygon((IList <PolygonPoint>)line.polyPoints));
     this.data.Add(line, this.data.colors[0]);
 }
示例#5
0
 /// <summary>
 /// Add simple transition polygon
 /// </summary>
 /// <param name="outer"></param>
 /// <param name="inner"></param>
 public void AddSimple(SplineLines.Line outer, SplineLines.Line inner)
 {
     this.simple = true;
     this.outer.Add(outer);
     this.inner.Add(inner);
 }
示例#6
0
 /// <summary>
 /// Add polygon from line data
 /// </summary>
 /// <param name="line"></param>
 public void AddPolygon(SplineLines.Line line)
 {
     polygon = new Polygon((IList <PolygonPoint>)line.polyPoints);
     AddData(line);
 }