Is start point on curve

Hi,

In vb, i want to test the start point of line if it is on a curve or not. Is there a command lik pyhton “ispointoncurve”.
Code starts like this:


dim gp as new rhino.input.custom.getpoint()
gp.setcommandpromp(“Start Point”)
gp.get()
dim pt_start as Rhino.geometry.point3d=gp.point()

Thanks and best regards,

Hi Serdem,

Here is a sample function that you can use to determine if a test point is on a curve:

Public Function IsPointOnCurve(ByVal curve As Curve, ByVal testPoint As Point3d, ByVal tolerance As Double) As Boolean
  If (curve IsNot Nothing) Then
    Dim t As Double
    If (curve.ClosestPoint(testPoint, t)) Then
      Dim curvePoint = curve.PointAt(t)
      If (testPoint.DistanceTo(curvePoint) <= tolerance) Then
        Return True
      End If
    End If
  End If
  Return False
End Function