I am having difficulty assigning integers to a points class. I have a list of coords class that contain an integer for X
and Y
values (Xp
and Yp
respectively). The integer type is Int32
and was converted from a string
to a double
and then to an integer
using:
X = double.Parse(setX, System.Globalization.CultureInfo.InvariantCulture);
The minimum X
and Y
values in the list are deducted from each coordinate before being assigned to a point. A check showed that the calculation is performing correctly but in the points the values are all wrong. I am wondering if there is a problem with the way I am assigning using points[n]
or if there is a better way of creating points to plot to a polygon? Sorry it is quite a length process procedure for producing the coords class, so I omitted it, but if you need more information please let me know.
Point[] points = new Point[coords.Count];
int n = 0;
foreach (var i in coords)
{
//These calculations are working fine:
int Xp = i.Xplt - minX;
int Yp = i.Yplt - minY;
//However when I assign to a new point. The calculation is wrong returning 0's and the incorrect result
points[n] = new Point(Xp, Yp);
n = +1;
}
On this line
n = +1;
You probably ment
n += 1;