I have an array of points that draws a polygon in a vertical position (All of the X and Y values are positive)...
I can rotate this array 90 degrees clockwise...Code:Dim points21x22() As Point = New Point() {New Point(10, 0), New Point(15, 3), New Point(18, 5), New Point(20, 8), _ New Point(20, 39), New Point(17, 42), New Point(3, 42), New Point(0, 39), _ New Point(0, 8), New Point(2, 5), New Point(5, 3), New Point(10, 0)}
But this results in negative values in the X coordinate which messes with my offsetting.Code:Dim newPoints() As Point = Array.ConvertAll(points21x22, Function(pt) New Point(-pt.Y, pt.X))
I can fix my offsetting...
But this still gives an array with some negative X values.Code:Dim o As Integer = newPoints.Min(Function(pt2) pt2.X) newPoints = Array.ConvertAll(newPoints, Function(pt) New Point(pt.X - o, pt.Y))
Can someone explain how to rotate my polygons so that all of the point values are positive?, and also if this code...
Will rotate 90 degrees anticlockwise? And also, will this rotate by 180 degrees?...Code:Dim newPoints() As Point = Array.ConvertAll(points21x22, Function(pt) New Point(pt.Y, -pt.X))
Code:Dim newPoints() As Point = Array.ConvertAll(points21x22, Function(pt) New Point(pt.Y, pt.X))




Reply With Quote