Tue 21 Oct 2014 02:14:41 PM UTC, original submission:
Dear pyFormex developers,
I just updated pyformex to version 1.0.0-a6.
I needed to split a curve C in 4 parts at relative curvilinear positions (20%, 50%, 70%).
It seems that the way now is:
T=array( [0.20,0.50,0.70] ) # relative curvilinear positions
CP = C.approx(nseg=100) # convert curve to polyline
Cparts = CP.splitAt(t=CP.atLength(T)) # list of 4 polylines
This is a basic functionality but to use it I needed to convert my distances into a parameter t (what it is that?) and use t to split the polyline.
A user would be more familiar with the 'position' or 'relative position' or 'distance from the start' rather than the parameter t.
Maybe this functionality could become a friendly general method for all curves like
def splitAtDistance(curve, distance, relative=True)
...
return listOFpolylines
This would split a curve at N absolute (0 to total length) or relative (0 to 1) positions at specified distances from the start and return N+1 polylines.
What do you think?
Gianluca
|