Simple question I am sure. I want to pick a point on a curve and then make that point on the curve and use CurveTangent to find the tangent at that point.
In grasshopper i would just use a evaluate length on the curve and use a slider to set the length anywhere between 0 and 1, this would then give me the tangent at that result.
What is the best way to say pick a random point on that curve at parameter 0.4? Upon looking around I thought curve domain and evaluate curve may work?
I assume below would find the domain of the full curve and then we are saying divide that by 2?
import rhinoscriptsyntax as rs
obj = rs.GetObject(“Select a curve”)
if rs.IsCurve(obj):
domain = rs.CurveDomain(obj)
t = domain[1]/2.0
point = rs.EvaluateCurve(obj, t)
rs.AddPoint( point )
In grasshopper i would just use a evaluate length on the curve and use a slider to set the length anywhere between 0 and 1, this would then give me the tangent at that result.
What is the best way to say pick a random point on that curve at parameter 0.4
Keep in mind evaluating length and evaluating parameter are two completely different things. Make sure you know that you want normalized length or a parameter.
The domain has nothing to do with length. Domain is related to curve parameter and knot vectors. If you wanted mid point of the curve length you would do .5 normalized length.
Hi graham. This might be moving away from the question- but I guess as I thought it was best to not use multiple syntax- so I just focussed on rhinosyntax- or is this the writ way of thinking about it?
Hi
I think it is possible with rs but it becomes messier. The Rhinocommon method is clearly designed to do exactly what you want so I would go for that one…