Hi guys, I ran into a problem with a curve’s domain when the curve is reversed.
if I try this example script that adds a point at the middle of the domain then the point is added to the start of the curve:
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 )
Is that expected behaviour?
I understand that this happens because the curve start that used to be “0” is now the curve end at “-0” and that the curve end at “140” is not the curve start at “-140”, but it seems a bit odd that the example fails on reversed curves.
(BTW: I made a workaround so I don’t need that Thanks!)
Yeah, I think I understand the increasing part, and that the “bug” is just in the example that i referred to, where it tires to calculates the middle of the domain as half of the “bigger” end:
Which works on a normal curve that goes from say 0 to 140, where 140/2 =70,
but what I now understand is that a reversed curve is “just” a domain that is multiplied with -1 so it goes from -140 to 0 instead. And there the bigger value is 0 and thus 0/2 = 0, so the “mid” is still at the end.
But it doesn’t matter which way the domain is pointed with the method I posted, that’s why it’s 100% reliable. It will always give you mid-domain, it’s just the average of two numbers…