resqpy.lines.spline¶
- resqpy.lines.spline(points, tangent_vectors=None, tangent_weight='square', min_subdivisions=1, max_segment_length=None, max_degrees_per_knot=5.0, closed=False)¶
Returns a numpy array containing resampled cubic spline of line defined by points.
- Parameters
points (numpy float array of shape (N, 3)) – points defining a line
tangent_vectors (numpy float array of shape (N, 3), optional) – vectors to use in the construction of the cubic spline; if None, tangents are calculated
tangent_weight (string, default 'linear') – one of ‘linear’, ‘square’ or ‘cube’, giving increased weight to relatively shorter of 2 line segments at each knot when computing tangent vectors; ignored if tangent_vectors is not None
min_subdivisions (int, default 1) – the resulting line will have at least this number of segments per original line segment
max_segment_length (float, optional) – if present, resulting line segments will not exceed this length by much (see notes)
max_degrees_per_knot (float, default 5.0) – the change in direction at each resulting knot will not usually exceed this value (see notes)
closed (boolean, default False) – if True, the points are treated as a closed polyline with regard to end point tangents, otherwise as an open line
- Returns
numpy float array of shape (>=N, 3) being knots on a cubic spline defined by points; original points are a subset of returned knots
Notes
the max_segment_length argument, if present, is compared with the length of each original segment to give a lower bound on the number of derived line segments; as the splined line may have extra curvature, the length of individual segments in the returned line can exceed the argument value, though usually not by much similarly, the max_degrees_per_knot is compared to the original deviations to provide another lower bound on the number of derived line segments for each original segment; as the spline may divide the segment unequally and also sometimes add loops, the resulting deviations can exceed the argument value