McMeasurementsLocateEdgePoints Method |
![]() |
Namespace: MediaCy.Addins.Measurements
Public Function LocateEdgePoints ( vFeatures As Object, vLine As Object, ByRef vOutLine As Object, OneEdgeOnly As Boolean ) As Integer
Sub TestFindCircle(ByVal x As Single, ByVal y As Single, ByVal r As Single) Dim p As SINGLEPOINT, OutPoints As System.Collections.ArrayList p.x = x p.y = y McMeasurements.ThisAddin.Options.CaliperWidth = 1 McMeasurements.ThisAddin.Options.CaliperMatchLength = 15 ThisApplication.ActiveImage.AnnotationOverlay.RemoveAll() GetCirclePoints(ThisApplication.ActiveImage, p, r, OutPoints) End Sub Function GetCirclePoints(ByVal Image As McImage, ByRef InPoint As SINGLEPOINT, ByVal Radius As Double, ByRef OutPoints As System.Collections.ArrayList) As Long Dim NSteps As Long NSteps = 6 Dim i As Integer, OutColl As New System.Collections.ArrayList, j As Integer For i = 0 To NSteps - 1 Dim InLine(1) As SINGLEPOINT InLine(0).X = InPoint.X + Radius * Cos(i * 3.14 / NSteps) InLine(0).Y = InPoint.Y + Radius * Sin(i * 3.14 / NSteps) InLine(1).X = InPoint.X - Radius * Cos(i * 3.14 / NSteps) InLine(1).Y = InPoint.Y - Radius * Sin(i * 3.14 / NSteps) Dim NEdges As Long, out As Object NEdges = McMeasurements.ThisAddin.LocateEdgePoints(Image.LineFeatures, InLine, out, False) For j = 0 To NEdges - 1 Dim p As SINGLEPOINT p.X = out(j).X p.Y = out(j).Y OutColl.Add(p) Next j Next i OutPoints = OutColl End Function