Quantcast
Channel: VBForums - Maths Forum
Viewing all articles
Browse latest Browse all 112

Plotting points and accounting for resize

$
0
0
I'm trying to plot points on a hexagon where the numbers are drawn in the middle of the line of the hexagon, sort of like this:
Name:  Hexagon.jpg
Views: 69
Size:  96.3 KB

I'm using visual basic.net 2010 and using a Queue to store the list of points(as well as a separate queue to store the numbers) and right now I'm trying something like this:

vb.net Code:
  1. pts.Clear()
  2.  
  3.         Dim upper_left As New Point(10, CInt(Me.Height / 2) - CInt(Me.Height / 10))
  4.         Dim upper_right As New Point(Me.Width - 10, CInt(Me.Height / 2) - CInt(Me.Height / 10))
  5.         Dim middle_left As New Point(5, CInt(Me.Height / 2))
  6.         Dim middle_right As New Point(Me.Width - 5, CInt(Me.Height / 2))
  7.         Dim lower_left As New Point(10, Me.Height - CInt(Me.Height / 2) + CInt(Me.Height / 10))
  8.         Dim lower_right As New Point(Me.Width - 10, Me.Height - CInt(Me.Height / 2) + CInt(Me.Height / 10))
  9.  
  10.         pts.Enqueue(upper_left)
  11.         pts.Enqueue(upper_right)
  12.         pts.Enqueue(middle_left)
  13.         pts.Enqueue(middle_right)
  14.         pts.Enqueue(lower_left)
  15.         pts.Enqueue(lower_right)

My issue is that the numbers are plotted out all crazy. I know it's nothing to do with how my coding is, I'm almost positive I'm not doing the math right to plot the points. How would I set out the location of the numbers and deal with resizing? By the way this is how the numbers currently look plotted:
Name:  hexagon.jpg
Views: 44
Size:  4.0 KB
Attached Images
  

Viewing all articles
Browse latest Browse all 112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>