private void SetMinXAxis(MaxPoints maxPoints) { if (_chart.TryGetFirstArea(out ChartArea area)) { area.AxisX.Minimum = Math.Max(0, area.AxisX.Maximum - maxPoints.Value); } }
public static void maxCircleOutput(IList <IFeature> features) { IList <ILineString> circles = new List <ILineString>(); for (int i = 0; i < features.Count; i++) { ILineString maxLine = MaxPoints.getMaxVector(features[i]); ILineString circle = Circles.getCircle(maxLine.Coordinates[0], maxLine.Coordinates[1]); circles.Add(circle); } string path1 = @"H:\test\结果\MaxCircle实验测试1.shp"; var shapefileWriter = new ShapefileWriter(path1, ShapeGeometryType.LineString); foreach (var circle in circles) { shapefileWriter.Write(circle); } string path2 = @"H:\test\结果\MaxCircle实验测试1.dbf"; ShapefileWriter.WriteDummyDbf(path2, features.Count); shapefileWriter.Close(); Console.WriteLine("生成成功"); Console.ReadKey(); }
private void getPolygons(IFeature feature) { IList <ILineString> lines = new List <ILineString>(); Coordinate centroid = feature.Geometry.Centroid.Coordinate; Coordinate origin = new Coordinate(); origin.X = MaxPoints.getMaxVector(feature).Coordinates[1].X - centroid.X; origin.Y = MaxPoints.getMaxVector(feature).Coordinates[1].Y - centroid.Y; //最大点平移到自定义坐标系 for (int i = 5; i <= 361; i += 5) { double angle = getAngle(origin); double k = 0; angle += i; if (angle > 360) //若角大于360,减去360 { angle -= 360; } k = Math.Tan(angle * Math.PI / 180); Coordinate point = new Coordinate(); //判定每隔5度的点落在1.4象限,2,3象限,或者X轴上 if (angle > 90 && angle < 270) { point.X = -100000.0; point.Y = k * point.X; } else if ((angle >= 0 && angle < 90) || (angle > 270 && angle <= 360)) { point.X = 100000.0; point.Y = k * point.X; } else if (angle == 90) { point.X = 0; point.Y = 100000.0; } else if (angle == 270) { point.X = 0; point.Y = -100000.0; } point.X += centroid.X; //将点移动回到原空间投影坐标系 point.Y += centroid.Y; Coordinate[] points = new Coordinate[] { centroid, point }; LineString line = new LineString(points); if (!line.Intersects(feature.Geometry.Boundary)) //如果所得线段与边界不相交,跳出当前循环,进入下个循环 { continue; } lines.Add(line); } lines.Add(lines[0]); for (int i = 0; i < lines.Count - 1; i++) { Coordinate[] points = new Coordinate[] { centroid, lines[i].Coordinates[1], lines[i + 1].Coordinates[1], centroid }; ILinearRing triangle = new LinearRing(points); Polygon angleArea = new Polygon(triangle); IGeometry area = angleArea.Intersection(feature.Geometry); Polygens.Add(area); //两条线与多边形交出的多边形面积 } }
private void setMaxCha(IFeature feature) { ILineString maxLine = MaxPoints.getMaxVector(feature); AngleProperty property = new AngleProperty(feature); foreach (var line in property.Lines) { Index index = new Index(maxLine.Coordinates[1].Distance(maxLine.Coordinates[0]) - line.Coordinates[1].Distance(line.Coordinates[0]), "外圆与外边界差"); MaxCha.Add(index); } }
private void setMaxCha(IFeature feature) { ILineString maxLine = MaxPoints.getMaxVector(feature); AngleProperty property = new AngleProperty(feature); foreach (var line in property.Lines) { //double index = (maxLine.Coordinates[1].Distance(maxLine.Coordinates[0]) - line.Coordinates[1].Distance(line.Coordinates[0])); double index = (maxLine.Length - line.Length); MaxCha.Add(index);//外圆与外边界差 } }
public Indexs(IFeature feature) { setMaxCha(feature); setMinCha(feature); //setMidCha(feature); setMinMax(); setPolygen(feature); setAreaRatio(feature); setTitio(feature); setPointNum(feature); setRows(); MaxLine = MaxPoints.getMaxVector(feature); MinLine = MinPoints.getMinVector(feature); }
public static void maxLineOutput(IList <IFeature> features) { IList <ILineString> maxLines = new List <ILineString>(); for (int i = 0; i < features.Count; i++) { maxLines.Add(MaxPoints.getMaxVector(features[i])); } string path1 = @"H:\test\结果\MaxLine实验测试1.shp"; var shapefileWriter = new ShapefileWriter(path1, ShapeGeometryType.LineString); foreach (var maxLine in maxLines) { shapefileWriter.Write(maxLine); } string path2 = @"H:\test\结果\MaxLine实验测试1.dbf"; ShapefileWriter.WriteDummyDbf(path2, features.Count); shapefileWriter.Close(); Console.WriteLine("生成成功"); Console.ReadKey(); }
protected override void AddSpecifiedAttributes() { AddAttribute(RoutingMode); if (Start != null) AddAttribute(Start); if (Destination != null) AddAttribute(Destination); AddAttribute(PropertyHelper.GetDescription(() => Ranges), string.Join(",", Ranges)); AddAttribute(PropertyHelper.GetDescription(() => RangeType), EnumHelper.GetDescription(RangeType)); if (JsonAttributes != null) AddAttribute(JsonAttributes); else AddAttribute(new JsonRepresentation(JsonAttribute.Include_TypeElement, JsonAttribute.UsePluralNamingForCollections, JsonAttribute.SupressJsonResponseObjectWrapper)); if (ConsumptionModel != null) AddAttribute(ConsumptionModel); if (CustomConsumptionDetails != null) AddAttribute(CustomConsumptionDetails); if (RequestId != null) AddAttribute(PropertyHelper.GetDescription(() => RequestId), RequestId); if (SingleComponent != null) AddAttribute(PropertyHelper.GetDescription(() => SingleComponent), SingleComponent.ToString().ToLower()); if (Resolution != null) AddAttribute(PropertyHelper.GetDescription(() => Resolution), Resolution.ToString()); if (MaxPoints != null) AddAttribute(PropertyHelper.GetDescription(() => MaxPoints), MaxPoints.ToString()); if (Quality != null) AddAttribute(PropertyHelper.GetDescription(() => Quality), Quality.ToString()); if (Departure != null) AddAttribute(PropertyHelper.GetDescription(() => Departure), ((DateTime)Departure).ToString("s")); if (Arrival != null) AddAttribute(PropertyHelper.GetDescription(() => Arrival), ((DateTime)Arrival).ToString("s")); if (JsonCallback != null) AddAttribute(PropertyHelper.GetDescription(() => JsonCallback), JsonCallback); if (TruckType != null) AddAttribute(PropertyHelper.GetDescription(() => TruckType), EnumHelper.GetDescription(TruckType)); if (TrailersCount != null) AddAttribute(PropertyHelper.GetDescription(() => TrailersCount), TrailersCount.ToString()); if (ShippedHazardousGoods != null) AddAttribute(PropertyHelper.GetDescription(() => ShippedHazardousGoods), string.Join(",", ShippedHazardousGoods.Select(sg => EnumHelper.GetDescription(sg)))); if (LimitedWeight != null) AddAttribute(PropertyHelper.GetDescription(() => LimitedWeight), LimitedWeight.Value.ToString(HereAPISession.Culture)); if (WeightPerAxle != null) AddAttribute(PropertyHelper.GetDescription(() => WeightPerAxle), WeightPerAxle.Value.ToString(HereAPISession.Culture)); if (Height != null) AddAttribute(PropertyHelper.GetDescription(() => Height), Height.Value.ToString(HereAPISession.Culture)); if (Width != null) AddAttribute(PropertyHelper.GetDescription(() => Width), Width.Value.ToString(HereAPISession.Culture)); if (Length != null) AddAttribute(PropertyHelper.GetDescription(() => Length), Length.Value.ToString(HereAPISession.Culture)); if (TunnelCategory != null) AddAttribute(PropertyHelper.GetDescription(() => TunnelCategory), EnumHelper.GetDescription(TunnelCategory)); }
/// <summary> /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.SuspendLayout(); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1000, 5000); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); string filePath = "profile-1.txt"; // 从数据文件>读取数据 List <double>[] values = GetDataFromFile(filePath); int w = this.Width; int h = this.Height; Chart chart1 = new Chart(); ChartArea chartArea1 = new ChartArea(); //定义一个绘图区域 Series series1 = new Series(); Series series2 = new Series(); // for 斜率曲线 Series series3 = new Series(); // for 斜率曲线 Series series4 = new Series(); // for 斜率曲线 Series series5 = new Series(); //定义一个数据列 chartArea1.Name = "ChartArea1"; //其实没有必要,可以使用chart1。ChartAreas[0]就可以了 chart1.ChartAreas.Add(chartArea1); //完成Chart和chartArea的关联 //Legend legend1 = new Legend(); //legend1.Name = "图标"; //chart1.Legends.Add(legend1); chart1.Name = "chart1"; series1.ChartType = SeriesChartType.Spline; series2.ChartType = SeriesChartType.Spline; series3.ChartType = SeriesChartType.Spline; series5.ChartType = SeriesChartType.Spline; series4.ChartType = SeriesChartType.Spline; //设置线性 Random rd2 = new Random(); double[] num = new double[20]; /*for (int i = 0; i < 20; i++) * { * int valuey = rd2.Next(20, 100); * DataPoint point = new DataPoint((i + 1), valuey); * series1.Points.Add(point); * }*/ series1.Points.DataBindXY(values[0], values[1]); int fitFactor = 10; // left to right, padding the most right points List <double> k = QCDSDataFitWithDirection(values[0], values[1], fitFactor, 0); series2.Points.DataBindXY(values[0], k); List <double> k2 = QCDSDataFit2(values[0], values[1], fitFactor); //series3.Points.DataBindXY(values[0], k2); // right to left, padding the most last points List <double> k3 = QCDSDataFitWithDirection(values[0], values[1], fitFactor, 1); series4.Points.DataBindXY(values[0], k3); // find the boundary of the gap,(point1,point2) GapIndex gap = findGap(values[0], values[1], k, k3); MaxPoints result = findMax(values[0], values[1], k, k3); List <double> left_x = new List <double>(); List <double> left_y = new List <double>(); for (double ch = 0; (result.y[0] + ch <= 3); ch += 0.02) { left_x.Add(result.x[0]); left_y.Add(result.y[0] + ch); } series3.Points.DataBindXY(left_x, left_y); double heightDiff = gapHeightDifference(values[0], values[1], gap.left, gap.left, gap.right, gap.right); chart1.Titles.Add("height difference:" + heightDiff.ToString()); List <double> right_x = new List <double>(); List <double> right_y = new List <double>(); for (double ch = 0; (result.y[0] + ch <= 3); ch += 0.02) { right_x.Add(result.x[1]); right_y.Add(result.y[1] + ch); } series5.Points.DataBindXY(right_x, right_y); //series1.Points.DataBindY(values); //产生点的坐标 //chart1.Titles[0].Text = ""; //chartArea1.AxisX.IntervalType = double; //chartArea1.AxisY.IntervalType = double; series1.ChartArea = "ChartArea1"; chartArea1.AxisX.Title = "X"; chartArea1.AxisY.Title = "Y"; chartArea1.AxisX.Interval = 0.02; //chartArea1.AxisY.Interval = 0.0001; //chartArea1.AxisY.Minimum = 16; series1.Legend = "图标"; series1.Name = "Series1"; chart1.Text = "测试"; chart1.Size = new System.Drawing.Size(w, h); //chart1.Location = new System.Drawing.Point(50,120); series1.Color = Color.Red; series2.Color = Color.Blue; series3.Color = Color.Green; series5.Color = Color.Pink; series4.Color = Color.Honeydew; chart1.Text = "ceshi"; //chart1.Titles[0].Text = "fff"; chart1.Series.Add(series1); chart1.Series.Add(series2); chart1.Series.Add(series3); chart1.Series.Add(series5); chart1.Series.Add(series4); //这一句很重要,缺少的话绘图区域将显示空白 //chart1.SizeChanged += new System.EventHandler(DoSizeChanged); //chart1.AllowDrop = true; chart1.BackColor = Color.FromArgb(243, 223, 193); //设置chart背景颜色 chartArea1.BackColor = Color.FromArgb(243, 223, 193); //设置c绘图区域背景颜色 series1.BorderWidth = 2; series2.BorderWidth = 2; series3.BorderWidth = 2; series5.BorderWidth = 2; series4.BorderWidth = 2; //series1.IsValueShownAsLabel = true; //series2.IsValuseShownAsLabel = true; //是否显示Y的值 //this.groupBox9.Controls.Add(chart1);. this.Controls.Add(chart1); //this.panel21.Controls.Add(chart1); chart1.Visible = true; //this.label10.Visible = true; //this.label10.Text = "【" + tn.Name + "】图"; chart1.Titles.Add("profile"); //为Chart1添加标题 chartArea1.AxisX.IsMarginVisible = true; //是否显示X轴两端的空白 //2、在上述chart的基础上添加一条线 /* * System.Windows.Forms.Control[] controls = this.Controls.Find("chart1", true); * * //找到已经有的Chart1 * Chart ch = (Chart)controls[0]; * Series series2 = new Series(); * Series series3 = new Series(); * Series series4 = new Series(); * * //新定义一个数据项 * Random rd = new Random(); * for (int i = 0; i < ch.Series[0].Points.Count; i++) * { * int valuey = rd.Next(20, 100); * DataPoint point = new DataPoint((i + 1), valuey); * series2.Points.Add(point); * series3.Points.Add(point); * series4.Points.Add(point); * } * series2.Color = Color.FromArgb(rd.Next(100, 255), rd.Next(100, 150), rd.Next(0, 255)); * series2.BorderWidth = 2; * series2.ChartType = ((Chart)this.Controls[0]).Series[0].ChartType; * * series3.Color = Color.FromArgb(rd.Next(100, 255), rd.Next(0, 150), rd.Next(0, 100)); * series3.BorderWidth = 2; * series3.ChartType = ((Chart)this.Controls[0]).Series[0].ChartType; * * series4.Color = Color.FromArgb(rd.Next(100, 255), rd.Next(0, 150), rd.Next(0, 255)); * series4.BorderWidth = 2; * series4.ChartType = ((Chart)this.Controls[0]).Series[0].ChartType; * * //定义线性和原有的线条形状一致 * series2.IsValueShownAsLabel = true; * ch.Series.Add(series2); * * series3.IsValueShownAsLabel = true; * ch.Series.Add(series3); * * series4.IsValueShownAsLabel = true; * ch.Series.Add(series4); * * //添加数据列 * * * * /*Graphics g = this.CreateGraphics(); * this.Show(); * Pen pen1 = new Pen(Color.Red, 3); * Point[] p1 = new Point[] * { * new Point(10,10), * new Point(60,40), * new Point(100,80), * new Point(60,100) * }; * * * g.DrawCurve(pen1, values); * g.Save();*/ }
private GapIndex findGap(List <double> listX, List <double> listY, List <double> listK1, List <double> listK2) { GapIndex gap = new GapIndex(); MaxPoints max = new MaxPoints(); max.x = new List <double>(); max.y = new List <double>(); MaxPoints min = new MaxPoints(); min.x = new List <double>(); min.y = new List <double>(); // var v1, v2; max value //var v3, v4; min value int cnt = 0; List <double> tmp; bool isSummit = true; var v1 = listK1.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).Last(); var v3 = listK1.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).First(); var v2 = listK1.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).Last(); var v4 = listK1.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).First(); if (v1.index < v3.index) // summit,else valley { isSummit = true; } else { isSummit = false; } int a, b; while (isSummit) { cnt++; v1 = listK1.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).Last(); v2 = listK2.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).Last(); if (isSummit) { a = v1.index; b = v2.index; tmp = listK2; } else { b = v1.index; a = v2.index; tmp = listK1; } if (a > b && cnt < 2) //cnt < 2 to avoid infinate loop, it may happen { // set listK1[0-index] = 0 for (int i = 0; i <= a; i++) { tmp[i] = 0; continue; } } break; } cnt = 0; while (!isSummit) { cnt++; v3 = listK1.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).First(); v4 = listK2.Select((m, index) => new { index, m }).OrderByDescending(n => n.m).First(); if (v3.index > v4.index && cnt < 2) //cnt < 2 to avoid infinate loop, it may happen { // set listK1[0-index] = 0 for (int i = 0; i <= v3.index; i++) { listK2[i] = 0; continue; } } break; } if (isSummit) { gap.left = v1.index; gap.right = v2.index; return(gap); } else { gap.left = v3.index; gap.right = v4.index; return(gap); } }
public override string ToString() { try { return(Name + " [" + MaxPoints.ToString() + "]\r\n" + Description[0]); } catch (Exception) { return("Failed to convert PetTalentDataAttribute to string."); } }
private void DoLayoutTagContentRecursively(VirtualGameObject child, float offsetX, float offsetY, float viewWidth, float viewHeight, MaxPoints maxPoints) { if (child.tag == Tag.TH) { maxPoints.AddXCount(); } // もし子供ゾーンに入ったら、その時点でmaxPointの値を指定していいはず。 // で。それを抜けたら、場で保持しているパラメータを、viewWidthとして指定できる! child.LayoutTagContent(offsetX, offsetY, viewWidth, viewHeight, (a) => {}); foreach (var nestedChild in child.transform.GetChildlen()) { child.DoLayoutTagContentRecursively(nestedChild, offsetX, offsetY, viewWidth, viewHeight, maxPoints); } }
/** * layout contents. * * set position and size of content. */ private HandlePoint Layout(VirtualGameObject parent, HandlePoint handlePoint, Tokenizer.OnLayoutDelegate onLayoutDel, Action <List <VirtualGameObject> > insert) { switch (this.tag) { case Tag.ROOT: { // do nothing. break; } default: { // Debug.LogError("before layout rectTransform.anchoredPosition:" + rectTransform.anchoredPosition + " of tag:" + tag + " handlePoint:" + handlePoint.nextTopHandle); LayoutTagContent(handlePoint.nextLeftHandle, handlePoint.nextTopHandle, handlePoint.viewWidth, handlePoint.viewHeight, insert); // Debug.LogError("after layout rectTransform.anchoredPosition:" + rectTransform.anchoredPosition + " of tag:" + tag + " handlePoint:" + handlePoint.nextTopHandle); break; } } // parent layout is done. will be resized by child, then padding. // calculate table's column count. if (this.tag == Tag.TABLE) { // ハンドラで、n x m のテーブルであることが通知できる。 // 別の話、N文字目に改行があったことが記録として残せるので、要素にidを振ることができる。 // n x mがわかったら、それぞれの幅をどうしたいかを通知できるはず。 // 指定したら、その幅を採用する。レイアウトも溢れも。ということはできそう。 // ッツー感じか。n単位でwidthを返せばいいので、nを受け取ってn x widthを返すのでよさげ。 var maxPoints = new MaxPoints(); // pre-layout table contents. foreach (var tableChild in this.transform.GetChildlen()) { DoLayoutTagContentRecursively(tableChild, handlePoint.nextLeftHandle, handlePoint.nextTopHandle, handlePoint.viewWidth, handlePoint.viewHeight, maxPoints); } } var childlen = this.transform.GetChildlen(); if (0 < childlen.Count) { LayoutChildlen(childlen, handlePoint, onLayoutDel); /* * set parent = this content's size to wrapping all childlen. */ var rightBottomPoint = Vector2.zero; // fit most large bottom-right point. largest point of width and y. foreach (var child in childlen) { var paddedRightBottomPoint = child.PaddedRightBottomPoint(); if (rightBottomPoint.x < paddedRightBottomPoint.x) { rightBottomPoint.x = paddedRightBottomPoint.x; } if (rightBottomPoint.y < paddedRightBottomPoint.y) { rightBottomPoint.y = paddedRightBottomPoint.y; } } // fit size to wrap all child contents. rectTransform.sizeDelta = rightBottomPoint; // Debug.LogError("set wrap rectTransform.sizeDelta:" + rectTransform.sizeDelta + " of tag:" + tag); // Debug.LogError("after wrap rectTransform.anchoredPosition:" + rectTransform.anchoredPosition + " of tag:" + tag + " handlePoint:" + handlePoint.nextTopHandle); // layout and padding and orientation of child tags are done. } /* * set padding if need. * default padding is 0. */ onLayoutDel(this.tag, this.depth, this.padding, this.keyValueStore); /* * adopt padding to this content. */ { // translate anchor position of content.(child follows parent.) rectTransform.anchoredPosition += padding.LeftTopPoint(); handlePoint.nextLeftHandle += padding.PadWidth(); handlePoint.nextTopHandle += padding.PadHeight(); // Debug.LogWarning("実験した方が良さそう"); } // Debug.LogError("rectTransform.anchoredPosition:" + rectTransform.anchoredPosition); /* * set next left-top point by parent tag kind. */ switch (parent.tag) { default: { // 回り込みを実現する。んだけど、これはどちらかというと多数派で、デフォルトっぽい。 // next content is planned to layout to the next of this content. handlePoint.nextLeftHandle = this.rectTransform.anchoredPosition.x + this.rectTransform.sizeDelta.x + this.padding.PadWidth(); // right edge with padding // Debug.LogError("handlePoint.nextLeftHandle:" + handlePoint.nextLeftHandle); break; } // Rootコンテンツにぶらさがっている項目は、全てCRLFがかかる。 case Tag.ROOT: { // CRLF handlePoint.nextLeftHandle = 0; handlePoint.nextTopHandle += this.rectTransform.sizeDelta.y + this.padding.PadHeight(); // Debug.LogError("親がRootなので、改行する。handlePoint.nextTopHandle:" + handlePoint.nextTopHandle + " of tag:" + tag + " rectTransform.anchoredPosition:" + this.rectTransform.anchoredPosition); break; } } return(handlePoint); }
private void getMaxMinAngle(IFeature feature) { IList <ILineString> lines = new List <ILineString>(); Coordinate centroid = feature.Geometry.Centroid.Coordinate; Coordinate origin = new Coordinate(); origin.X = MaxPoints.getMaxVector(feature).Coordinates[1].X - centroid.X; origin.Y = MaxPoints.getMaxVector(feature).Coordinates[1].Y - centroid.Y; //最大点平移到自定义坐标系 for (int i = 5; i <= 361; i += 5) { double angle = getAngle(origin); double k = 0; angle += i; if (angle > 360) //若角大于360,减去360 { angle -= 360; } k = Math.Tan(angle * Math.PI / 180); Coordinate point = new Coordinate(); //判定每隔5度的点落在1.4象限,2,3象限,或者X轴上 if (angle > 90 && angle < 270) { point.X = -100000.0; point.Y = k * point.X; } else if ((angle >= 0 && angle < 90) || (angle > 270 && angle <= 360)) { point.X = 100000.0; point.Y = k * point.X; } else if (angle == 90) { point.X = 0; point.Y = 100000.0; } else if (angle == 270) { point.X = 0; point.Y = -100000.0; } point.X += centroid.X; //将点移动回到原空间投影坐标系 point.Y += centroid.Y; Coordinate[] points = new Coordinate[] { centroid, point }; LineString line = new LineString(points); if (!line.Intersects(feature.Geometry.Boundary)) //如果所得线段与边界不相交,跳出当前循环,进入下个循环 { continue; } IGeometry intersectPoints = line.Intersection(feature.Geometry.Boundary); if (intersectPoints.Coordinates.Length > 1) { if (points[1].X > points[0].X) { line.Coordinates[1] = intersectPoints.Coordinates[intersectPoints.Coordinates.Length - 1]; } else if (points[1].X < points[0].X) { line.Coordinates[1] = intersectPoints.Coordinates[0]; } else if (points[1].X == points[0].X) { if (points[1].Y > points[0].Y) { line.Coordinates[1] = intersectPoints.Coordinates[intersectPoints.Coordinates.Length - 1]; } else if (points[1].Y < points[0].Y) { line.Coordinates[1] = intersectPoints.Coordinates[0]; } } } else { line.Coordinates[1] = intersectPoints.Coordinate; } lines.Add(line); } lines.Add(lines[0]); double titio = 0; for (int i = 0; i < lines.Count - 1; i++) { double b = centroid.Distance(lines[i + 1].Coordinates[1]); double a = centroid.Distance(lines[i].Coordinates[1]); double h = b * Math.Sin(5 * Math.PI / 180); titio = 1 - h / (h + a); Titio.Add(titio); } }