Evaluate Curve by 2 points

I want to Get center point of curve using Subtract vectors :

XYZ center = curve.GetEndPoint(0).Subtract(curve.GetEndPoint(1)).Multiply(0.5); - its not work correct, Why?

(XYZ center =curve.Evaluate(0.5, true) - get right result)

why not use Curve.PointAtParameter directly at 0.5

I have a 2 points , i need get middle point between them without creation a curve


This is not the same as A-B. Why can you not create a curve between points to get the middle?

What you’re describing here would be half the difference in the vectors.

1 Like

Typing on the phone so pardon any typos. In design script:

start = Curve.StartPoint(crv);
end = Curve.Endpoint;
vect1 = Vector.ByTwoPoints(start,end);
vect2 = Vector.Scale(vect1,0.5);
mid = Geometry.Translate(start,vect2);

Or inline:

Idea is to make the vector that runs from the start point to the end point, then scale it by 1/2, then move the point by the scaled vector.

I assume this is because it’s either a nurbs Curve or an arc, which would not have a point in the center between the points.

1 Like

The only way a vector solution would work is if the curve is a straight line, is it not? Which means there should be no problem drawing a line between points and using PointAtParameter.

We may be solving different problems here. My solution was the midpoint between the ends of the curve.

Midpoint if a curve is easy enough by other means which will work in all types of curves. If there are no nurbs curves then Curve.PointAtParameter(crv,0.5) will work fine. For a nurbs curve I would recommend using Curve.PointAtSegementLength as the non-uniform bit of nurbs can throw the location off.

You can experiment by drawing a nurbs curve through this list of points Point.ByCoordinates([0,9.9,10],[0,0,0]); and then getting the point at parameters 0…1…#10.

OK we’re on the same page. What I was suggesting was creating a new line with the start and end points of the curve and getting the midpoint of that line.

1 Like