Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Курсова Звіт.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
2.18 Mб
Скачать

2.5 Тестування проекту

Для запуску програмного продукту необхідно запустити додаток AOCC.exe(Рис. 2.11), програма запускаеться без помилок. Натиснувши будь-яку з кнопок ми бачимо що програма працює коректно.

Рис. 2.11 Додаток AOCC.exe

Висновки

Завданням курсової роботи було створення програми яка б обраховувала площу будя-якого замкнутого контуру В ході розробки даного програмного продукту було написано звіт, в якому докладно описано сам програмний продукт, а також правила користування нею.

За час написання даного проекту було вивчено більше про мову програмування Visual Basic.NET, вдосконалена техніка програмування на даній мові, поглиблено знання в тріангуляції Делоне

Як і кожний програмний продукт, так і цей має свої переваги та недоліки.

До переваг можна віднести:

  • наявність зручного, простого та приємного інтерфейсу;

  • простий та надійний в використанні

  • гнучкий в настройках

  • багатофункціональний

  • займає мало місця на запам’ятовуючому пристрої

До недоліків відносяться:

  • бета версія

Отже, програма «AOCC» є досить хорошим та корисним програмним продуктом та перспективною базою для розробки вдосконалених аналогів.

Додаток 1. Лістинг програми

Option Strict On

Option Explicit On

Imports AOCC.Delaunay

Imports System.IO

Imports System.Math

Public Class Form1

Dim i, f As Integer

Dim mt(f) As Point

Dim vek1x, vek1y, vek2x, vek2y, vek3x, vek3y, vek1D, vek2D, vek3D, pivp, plo, plozah As Long

Dim moTriangulation As DelaunayTriangulation

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown

Dim x As Integer = e.X

Dim y As Integer = e.Y

Dim aVertexPoint As Vertex

aVertexPoint = New Vertex(x, y)

moTriangulation.oVertices.Add(aVertexPoint, False)

DrawTriangles()

ListBox1.Items.Add(x)

ListBox2.Items.Add(y)

End Sub

Public Sub DrawTriangles()

Dim bit As Bitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)

Dim g As Graphics = Graphics.FromImage(bit)

Dim myPen As Pen = New Pen(Color.Blue, 1)

Dim i As Integer

' Perform Triangulation Function if there are more than 2 points

If moTriangulation.oVertices.Count > 2 Then

'Clear the Picture Box

PictureBox1.Refresh()

moTriangulation.Triangulate()

myPen.Color = Color.DimGray

' draw each triangle

For i = 1 To moTriangulation.iTriangleCount

With moTriangulation

g.DrawLine(myPen, CInt(.oVertices.Item(.oTriangles(i).vv0).x), CInt(.oVertices.Item(.oTriangles(i).vv0).y), CInt(.oVertices.Item(.oTriangles(i).vv1).x), CInt(.oVertices.Item(.oTriangles(i).vv1).y))

g.DrawLine(myPen, CInt(.oVertices.Item(.oTriangles(i).vv1).x), CInt(.oVertices.Item(.oTriangles(i).vv1).y), CInt(.oVertices.Item(.oTriangles(i).vv2).x), CInt(.oVertices.Item(.oTriangles(i).vv2).y))

g.DrawLine(myPen, CInt(.oVertices.Item(.oTriangles(i).vv0).x), CInt(.oVertices.Item(.oTriangles(i).vv0).y), CInt(.oVertices.Item(.oTriangles(i).vv2).x), CInt(.oVertices.Item(.oTriangles(i).vv2).y))

vek1x = CInt(.oVertices.Item(.oTriangles(i).vv1).x) - CInt(.oVertices.Item(.oTriangles(i).vv0).x)

vek1y = CInt(.oVertices.Item(.oTriangles(i).vv1).y) - CInt(.oVertices.Item(.oTriangles(i).vv0).y)

vek2x = CInt(.oVertices.Item(.oTriangles(i).vv2).x) - CInt(.oVertices.Item(.oTriangles(i).vv1).x)

vek2y = CInt(.oVertices.Item(.oTriangles(i).vv2).y) - CInt(.oVertices.Item(.oTriangles(i).vv1).y)

vek3x = CInt(.oVertices.Item(.oTriangles(i).vv2).x) - CInt(.oVertices.Item(.oTriangles(i).vv0).x)

vek3y = CInt(.oVertices.Item(.oTriangles(i).vv2).y) - CInt(.oVertices.Item(.oTriangles(i).vv0).y)

vek1D = CLng(Sqrt((vek1x * vek1x) + (vek1y * vek1y)))

vek2D = CLng(Sqrt((vek2x * vek2x) + (vek2y * vek2y)))

vek3D = CLng(Sqrt((vek3x * vek3x) + (vek3y * vek3y)))

pivp = CLng((vek1D + vek2D + vek3D) / 2)

plo = CLng(Sqrt(pivp * (pivp - vek1D) * (pivp - vek2D) * (pivp - vek3D)))

plozah = plozah + plo

End With

Next i

' remove the 3 supertriangle vertices from the moTriangulation

With moTriangulation

.oVertices.RemoveAt(.oVertices.Count - 1)

.oVertices.RemoveAt(.oVertices.Count - 1)

.oVertices.RemoveAt(.oVertices.Count - 1)

End With

'Display the total triangle count

lblTriangles.Text = "Triangles: " & moTriangulation.iTriangleCount

End If

'Display the total point count

lblPoints.Text = "Points: " & moTriangulation.iVertexCount

Dim aVertex As Vertex

' draw all the individual points

For Each aVertex In moTriangulation.oVertices

g.DrawEllipse(myPen, CInt(aVertex.x) - 2, CInt(aVertex.y) - 2, 4, 4)

Next aVertex

PictureBox1.Image = bit

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ResetTriangulation()

End Sub

Private Sub ResetTriangulation()

moTriangulation = New DelaunayTriangulation

End Sub

Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click

ResetTriangulation()

PictureBox1.Image = Nothing

lblplo.Text = "Площа"

ListBox1.Items.Clear()

ListBox2.Items.Clear()

End Sub

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

End Sub

Private Sub lblTriangles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTriangles.Click

End Sub

Private Sub cmdPlo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPlo.Click

plozah = 0

Dim i As Integer

For i = 1 To moTriangulation.iTriangleCount

With moTriangulation

vek1x = CInt(.oVertices.Item(.oTriangles(i).vv1).x) - CInt(.oVertices.Item(.oTriangles(i).vv0).x)

vek1y = CInt(.oVertices.Item(.oTriangles(i).vv1).y) - CInt(.oVertices.Item(.oTriangles(i).vv0).y)

vek2x = CInt(.oVertices.Item(.oTriangles(i).vv2).x) - CInt(.oVertices.Item(.oTriangles(i).vv1).x)

vek2y = CInt(.oVertices.Item(.oTriangles(i).vv2).y) - CInt(.oVertices.Item(.oTriangles(i).vv1).y)

vek3x = CInt(.oVertices.Item(.oTriangles(i).vv2).x) - CInt(.oVertices.Item(.oTriangles(i).vv0).x)

vek3y = CInt(.oVertices.Item(.oTriangles(i).vv2).y) - CInt(.oVertices.Item(.oTriangles(i).vv0).y)

vek1D = CLng(Sqrt((vek1x * vek1x) + (vek1y * vek1y)))

vek2D = CLng(Sqrt((vek2x * vek2x) + (vek2y * vek2y)))

vek3D = CLng(Sqrt((vek3x * vek3x) + (vek3y * vek3y)))

pivp = CLng((vek1D + vek2D + vek3D) / 2)

plo = CLng(Sqrt(pivp * (pivp - vek1D) * (pivp - vek2D) * (pivp - vek3D)))

plozah = plozah + plo

End With

Next i

lblplo.Text = Format(Val(lblplo.Text), "0,00")

lblplo.Text = "Площа: " & CDbl(Format(Val(lblplo.Text), CStr(Math.Round(plozah / (38 * 38), 1)))) / 10 & "см" & ChrW(178)

End Sub

Private Sub Butt_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butt_save.Click

Dim countlist As Integer = 0

Dim element As Integer

element = ListBox1.Items.Count

f = ListBox1.Items.Count

Dim mt(f) As Point

Dim sfd As New SaveFileDialog() ' this creates an instance of the SaveFileDialog called "sfd"

sfd.Filter = "Triangl saves (.tsoq)|*.tsoq|All files (.*)|*.*"

sfd.FilterIndex = 1

sfd.RestoreDirectory = True

If sfd.ShowDialog() = DialogResult.OK Then

Dim FileName As String = sfd.FileName ' retrieve the full path to the file selected by the user

Dim sw As New System.IO.StreamWriter(FileName, False) ' create a StreamWriter with the FileName selected by the User

'*******************************************

'/////////////////////////////////////////////

countlist = ListBox1.Items.Count

sw.WriteLine(countlist)

' '/////////////////////////////////////////////

For Each element In ListBox1.Items

sw.WriteLine(element)

Next

For Each element In ListBox2.Items

sw.WriteLine(element)

Next

' '*******************************************

sw.Close() ' close the file

End If

End Sub

Sub ListFlow()

Dim myFile As String

Dim CountLine As Integer

Dim openFileDialog1 As New OpenFileDialog()

myFile = Trim(openFileDialog1.FileName)

Dim Lines() As String = IO.File.ReadAllLines(myFile, System.Text.Encoding.Default)

CountLine = CInt(Val(Lines(0)))

Dim i As Integer

For i = 1 To CountLine

ListBox1.Items.Add(Lines(i))

ListBox2.Items.Add(Lines(i + CountLine))

Next

End Sub

Private Sub Butt_Load_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Butt_load.Click

Dim myFile As String

Dim openFileDialog1 As New OpenFileDialog()

Dim i As Integer

ListBox1.Items.Clear()

ListBox2.Items.Clear()

Dim CountLine As Integer

Dim myStream As IO.Stream = Nothing

f = ListBox1.Items.Count

openFileDialog1.InitialDirectory = "c:\"

openFileDialog1.Filter = "Triangl saves (.tsoq)|*.tsoq|All files (.*)|*.*"

openFileDialog1.FilterIndex = 2

openFileDialog1.RestoreDirectory = True

If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then

Try

myStream = openFileDialog1.OpenFile()

myFile = Trim(openFileDialog1.FileName)

If (myStream IsNot Nothing) Then

'*************************************************

Dim Lines() As String = IO.File.ReadAllLines(myFile, System.Text.Encoding.Default)

CountLine = CInt(Val(Lines(0)))

Dim mt(CountLine) As Point

For i = 1 To CountLine

ListBox1.Items.Add(Lines(i))

ListBox2.Items.Add(Lines(i + CountLine))

mt(i).X = CInt(Lines(i))

mt(i).Y = CInt(Lines(i + CountLine))

Dim aVertexPoint As Vertex

aVertexPoint = New Vertex(mt(i).X, mt(i).Y)

moTriangulation.oVertices.Add(aVertexPoint, False)

DrawTriangles()

Next

'*************************************************

End If

Catch Ex As Exception

MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message, "" & CountLine)

Finally

' Check this again, since we need to make sure we didn't throw an exception on open.

If (myStream IsNot Nothing) Then

myStream.Close()

myFile = ""

End If

End Try

End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

frmHelp.Show()

End Sub

Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click

Me.Close()

End Sub

Private Sub cmdKreator_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdKreator.Click

frmKreator.Show()

End Sub

Private Sub cmdSver_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSver.Click

Me.WindowState = FormWindowState.Minimized

End Sub

End Class

Option Strict On

Option Explicit On

Imports System.Math

Namespace Delaunay

Friend Class DelaunayTriangulation

''' <summary>

''' максимум трикутників

''' </summary>

Private Const MaxTriangles As Short = 1000

''' <summary>

''' трикутники склад з 3 векторів

''' </summary>

Friend Structure Triangle

Public vv0 As Integer

Public vv1 As Integer

Public vv2 As Integer

End Structure

''' <summary>

''' масив трикутників

''' </summary>

Public oTriangles(MaxTriangles) As Triangle

''' <summary>

''' масив векторів цих трикутників

''' </summary>

''' <remarks></remarks>

Public oVertices As Vertices

''' <summary>

''' кількість трикутників

'''

''' </summary>

''' <remarks></remarks>

Private miTriangleCount As Integer

''' <summary>

''' ... векторів

''' </summary>

''' <remarks></remarks>

Private miVertexCount As Integer

Public Sub New()

oVertices = New Vertices

End Sub

Private Function InCircle(ByRef theVertex As Vertex, ByRef theTriangle As Triangle) As Boolean

'точка

Dim eps As Double

Dim m1, m2 As Double

Dim mx0, mx1, my0, my1 As Double

Dim dx, dy As Double

Dim xc, yc, r As Double

Dim rsqr As Double

Dim drsqr As Double

Dim xp, x0, x1, x2 As Integer

Dim yp, y0, y1, y2 As Integer

xp = theVertex.x

yp = theVertex.y

x0 = oVertices.Item(theTriangle.vv0).x

y0 = oVertices.Item(theTriangle.vv0).y

x1 = oVertices.Item(theTriangle.vv1).x

y1 = oVertices.Item(theTriangle.vv1).y

x2 = oVertices.Item(theTriangle.vv2).x

y2 = oVertices.Item(theTriangle.vv2).y

eps = 0.000001

InCircle = False

If Abs(y0 - y1) < eps And Abs(y1 - y2) < eps Then

MsgBox("INCIRCUM - F - Points are coincident !!")

Exit Function

End If

If Abs(y1 - y0) < eps Then

m2 = -(x2 - x1) / (y2 - y1)

mx1 = (x1 + x2) / 2

my1 = (y1 + y2) / 2

xc = (x1 + x0) / 2

yc = m2 * (xc - mx1) + my1

ElseIf Abs(y2 - y1) < eps Then

m1 = -(x1 - x0) / (y1 - y0)

mx0 = (x0 + x1) / 2

my0 = (y0 + y1) / 2

xc = (x2 + x1) / 2

yc = m1 * (xc - mx0) + my0

Else

m1 = -(x1 - x0) / (y1 - y0)

m2 = -(x2 - x1) / (y2 - y1)

mx0 = (x0 + x1) / 2

mx1 = (x1 + x2) / 2

my0 = (y0 + y1) / 2

my1 = (y1 + y2) / 2

xc = (m1 * mx0 - m2 * mx1 + my1 - my0) / (m1 - m2)

yc = m1 * (xc - mx0) + my0

End If

dx = x1 - xc

dy = y1 - yc

rsqr = dx * dx + dy * dy

r = Sqrt(rsqr)

dx = xp - xc

dy = yp - yc

drsqr = dx * dx + dy * dy

If drsqr <= rsqr Then InCircle = True

End Function

''' <summary>

''' заповнення трикутниками області та провірка правильності трикутників

'''

''' </summary>

Public Sub Triangulate()

Dim Edges(2, MaxTriangles * 3) As Integer

Dim Nedge As Integer

'General Variables

Dim i As Integer

Dim j As Integer

Dim k As Integer

Dim ntri As Integer

Dim inc As Boolean

Dim aVertex As Vertex

miVertexCount = oVertices.Count

'встановлення головного трикутника

aVertex = New Vertex(CInt(oVertices.MidX - 2 * oVertices.DeltaMax), CInt(oVertices.MidY - oVertices.DeltaMax))

oVertices.Add(aVertex, True)

aVertex = New Vertex(CInt(oVertices.MidX), CInt(oVertices.MidY + 2 * oVertices.DeltaMax))

oVertices.Add(aVertex, True)

aVertex = New Vertex(CInt(oVertices.MidX + 2 * oVertices.DeltaMax), CInt(oVertices.MidY - oVertices.DeltaMax))

oVertices.Add(aVertex, True)

oTriangles(1).vv0 = oVertices.Count - 3

oTriangles(1).vv1 = oVertices.Count - 2

oTriangles(1).vv2 = oVertices.Count - 1

ntri = 1

'включаемо всі точки в масив

For i = 0 To oVertices.Count - 3

Nedge = 0

j = 0

Do

j = j + 1

inc = InCircle(oVertices.Item(i), oTriangles(j))

If inc Then

Edges(1, Nedge + 1) = oTriangles(j).vv0

Edges(2, Nedge + 1) = oTriangles(j).vv1

Edges(1, Nedge + 2) = oTriangles(j).vv1

Edges(2, Nedge + 2) = oTriangles(j).vv2

Edges(1, Nedge + 3) = oTriangles(j).vv2

Edges(2, Nedge + 3) = oTriangles(j).vv0

Nedge = Nedge + 3

oTriangles(j).vv0 = oTriangles(ntri).vv0

oTriangles(j).vv1 = oTriangles(ntri).vv1

oTriangles(j).vv2 = oTriangles(ntri).vv2

j = j - 1

ntri = ntri - 1

End If

Loop While j < ntri

For j = 1 To Nedge - 1

If Edges(1, j) <> -1 And Edges(2, j) <> -1 Then

For k = j + 1 To Nedge

If Edges(1, k) <> -1 And Edges(2, k) <> -1 Then

If Edges(1, j) = Edges(2, k) Then

If Edges(2, j) = Edges(1, k) Then

Edges(1, j) = -1

Edges(2, j) = -1

Edges(1, k) = -1

Edges(2, k) = -1

End If

End If

End If

Next k

End If

Next j

'формуемо нові трикутники

For j = 1 To Nedge

If Edges(1, j) <> -1 And Edges(2, j) <> -1 Then

ntri = ntri + 1

oTriangles(ntri).vv0 = Edges(1, j)

oTriangles(ntri).vv1 = Edges(2, j)

oTriangles(ntri).vv2 = i

End If

Next j

Next i

i = 0

Do

i = i + 1

If oTriangles(i).vv0 > iVertexCount - 1 Or oTriangles(i).vv1 > iVertexCount - 1 Or oTriangles(i).vv2 > iVertexCount - 1 Then

oTriangles(i).vv0 = oTriangles(ntri).vv0

oTriangles(i).vv1 = oTriangles(ntri).vv1

oTriangles(i).vv2 = oTriangles(ntri).vv2

i = i - 1

ntri = ntri - 1

End If

Loop While i < ntri

miTriangleCount = ntri

End Sub

Public Function ZValue(ByVal iX As Integer, ByVal iY As Integer) As Double

Dim i As Integer

ZValue = 0

For i = 1 To miTriangleCount

If InTriangle(iX, iY, oTriangles(i)) = True Then

ZValue = PlanePoint(iX, iY, oVertices.Item(oTriangles(i).vv0), oVertices.Item(oTriangles(i).vv1), oVertices.Item(oTriangles(i).vv2))

ZValue = CDbl(FormatNumber(ZValue, 0))

If ZValue > 0 Then

Exit Function

End If

End If

Next

End Function

''' <summary>

''' провірка на вмістимість точки в трикутнику

''' </summary>

Public Function BoundingTriangle(ByVal iX As Integer, ByVal iY As Integer) As Integer

Dim i As Integer

BoundingTriangle = 0

For i = miTriangleCount To 1 Step -1

If InTriangle(iX, iY, oTriangles(i)) = True Then

BoundingTriangle = i

Exit Function

End If

Next

End Function

Private Function WhichSide(ByVal iX As Integer, ByVal iY As Integer, ByVal vertex1 As Vertex, ByVal vertex2 As Vertex) As Integer

Dim equation As Long

equation = ((iY - vertex1.y) * (vertex2.x - vertex1.x))

equation = equation - ((vertex2.y - vertex1.y) * (iX - vertex1.x))

If equation > 0 Then

WhichSide = -1

ElseIf equation = 0 Then

WhichSide = 0

Else

WhichSide = 1

End If

End Function

''' <summary>

''' провіряемо чи лежить точка в середині трикутника.

''' </summary>

Private Function InTriangle(ByVal iX As Integer, ByVal iY As Integer, ByVal theTriangle As Triangle) As Boolean

Dim side1, side2, side3 As Integer

Dim p1, p2, p3 As Vertex

p1 = oVertices.Item(theTriangle.vv0)

p2 = oVertices.Item(theTriangle.vv1)

p3 = oVertices.Item(theTriangle.vv2)

side1 = WhichSide(iX, iY, p1, p2)

side2 = WhichSide(iX, iY, p2, p3)

side3 = WhichSide(iX, iY, p3, p1)

InTriangle = False

If (side1 = 0) And (side2 = 0) Then InTriangle = True

If (side1 = 0) And (side3 = 0) Then InTriangle = True

If (side2 = 0) And (side3 = 0) Then InTriangle = True

If (side1 = 0) And (side2 = side3) Then InTriangle = True

If (side2 = 0) And (side1 = side3) Then InTriangle = True

If (side3 = 0) And (side1 = side2) Then InTriangle = True

If (side1 = side2) And (side2 = side3) Then InTriangle = True

End Function

Private Function PlanePoint(ByVal iX As Double, ByVal iY As Double, ByVal p1 As Vertex, ByVal p2 As Vertex, ByVal p3 As Vertex) As Double

Const EPSILON As Double = 0.0001

Dim a, b, c, d As Double

a = p1.y * (p2.z - p3.z) + p2.y * (p3.z - p1.z) + p3.y * (p1.z - p2.z)

b = p1.z * (p2.x - p3.x) + p2.z * (p3.x - p1.x) + p3.z * (p1.x - p2.x)

c = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y)

d = -p1.x * (p2.y * p3.z - p3.y * p2.z) - p2.x * (p3.y * p1.z - p1.y * p3.z) - p3.x * (p1.y * p2.z - p2.y * p1.z)

If (Abs(c) > EPSILON) Then

PlanePoint = (-(a * iX + b * iY + d) / c)

Else

PlanePoint = (0.0)

End If

End Function

''' <summary>

''' число всіх трикутників

''' </summary>

Public ReadOnly Property iTriangleCount() As Integer

Get

Return miTriangleCount

End Get

End Property

''' <summary>

''' Returns the count of all vertices (excluding the vertices for the SuperTriangle).

''' </summary>

Public ReadOnly Property iVertexCount() As Integer

Get

Return miVertexCount

End Get

End Property

End Class

Friend Class Vertex

Public x As Integer

Public y As Integer

Public z As Double

Public Sub New()

'do nothing

x = 0

y = 0

z = 0

End Sub

Public Sub New(ByVal iX As Integer, ByVal iY As Integer, ByVal dZ As Double)

x = iX

y = iY

z = dZ

End Sub

Public Sub New(ByVal iX As Integer, ByVal iY As Integer)

x = iX

y = iY

z = 0

End Sub

End Class

' масив всіх векторів

Friend Class Vertices

Inherits System.Collections.CollectionBase

Private miMaxX As Integer

Private miMaxY As Integer

Private miMinX As Integer

Private miMinY As Integer

Private msngMidX As Single

Private msngMidY As Single

Private miDeltaX As Integer

Private miDeltaY As Integer

Private miDeltaMax As Integer

Public iTrueVertexCount As Integer = 0

Public Sub Add(ByRef theVertex As Vertex, ByRef bSuperTriangle As Boolean)

List.Add(theVertex)

If Not bSuperTriangle Then

If theVertex.x > miMaxX Then miMaxX = theVertex.x

If theVertex.y > miMaxY Then miMaxY = theVertex.y

If theVertex.x < miMinX Then miMinX = theVertex.x

If theVertex.y < miMinY Then miMinY = theVertex.y

miDeltaX = miMaxX - miMinX

miDeltaY = miMaxY - miMinY

If miDeltaX > miDeltaY Then

miDeltaMax = miDeltaX

Else

miDeltaMax = miDeltaY

End If

msngMidX = CSng((miMaxX + miMinX) / 2)

msngMidY = CSng((miMaxY + miMinY) / 2)

End If

End Sub

Public Sub Remove(ByVal index As Integer)

If index > Count - 1 Or index < 0 Then

'System.Windows.Forms.MessageBox.Show("Index not valid!")

Else

List.RemoveAt(index)

End If

End Sub

Public ReadOnly Property Item(ByVal index As Integer) As Vertex

Get

Return CType(List.Item(index), Vertex)

End Get

End Property

Public Sub New()

miMaxX = 0

miMaxY = 0

miMinX = 999999

miMinY = 999999

End Sub

Public ReadOnly Property MidX() As Single

Get

Return msngMidX

End Get

End Property

Public ReadOnly Property MidY() As Single

Get

Return msngMidY

End Get

End Property

Public ReadOnly Property DeltaMax() As Integer

Get

Return miDeltaMax

End Get

End Property

End Class

End Namespace