 How to find the tangent point on a curve

Hello all,

i have a curve ( planar for example S-shape ) an a point in the same plan

how I can find the tangent point in c#

Thanks Robert

Tangent to what? Can you explain further? Do you have a sample model?

S_curve for Dal.3dm (58.7 KB) Hi Dale,
I uplode a file to explain.

Thanks Robert

@pascal, any tips for Robert?

Not sure if this helps but here is how you can do it in python. I wrote this for a specific case so it may not take into account your specific needs (eg it does not check for multiple tangents).

import rhinoscriptsyntax as rs
import Rhino

def TangentLinePtToCurve(Point,Curve):
#Create small circle around pt
#get curve domains
CurveParam=rs.CurveDomain(Curve)
PtCircleParam=rs.CurveDomain(PtCircle)
#transform into rhino geometry data
CurveData=rs.coercecurve(Curve)
PtCircleData=rs.coercecurve(PtCircle)
#Find tangent line
TanLine=Rhino.Geometry.Line.TryCreateBetweenCurves(PtCircleData,CurveData,PtCircleParam,CurveParam,False,False)
TanPtOnCurve=TanLine.To

#delete circle
rs.DeleteObject(PtCircle)

return TanLine,TanPtOnCurve

if __name__=="__main__":
#get curve
Curve=rs.GetObject("Select Curve",4)
#get point
EndPt=rs.GetObject("Select Point",1)

TanLine,TanPtOnCurve=TangentLinePtToCurve(EndPt,Curve)

The key part being "Rhino.Geometry.Line.TryCreateBetweenCurves"
This only works between two curves so firstly you need to create a tiny circle around the point in question.

1 Like