Is there any rhinocommon method that could do the same display?
I was thinking that the values of vectors are osculating circle radius, but they are not.
@AndersDeleuran for bending rods and kangaroo you were displaying these graphs.
Could you share the code regarding this issue?
I certainly can. Though mine was operating on bendy polylines of course, so I’m not sure if that would help much?
Edit: Here’s the method extracted from the larger bendy beam analysis class:
def __calculateBendingRadii(self,polyline,roundDecimal,maxCircleRadius,minCircleRadius):
"""
Calculate the local bending radius for each vertex of a polyline.
"""
# Return lists
radii = []
planes = []
circles = []
# Cast to polyline
if type(polyline) is not rc.Geometry.Polyline:
polyline = polyline.TryGetPolyline()[1]
# Get polyline vertices and adjust list if closed
vertices = list(polyline)
if polyline.IsClosed:
del vertices[-1]
# Calculate the angle between each vertex and its neighbours
for i in range(len(vertices)):
# Get vertex and its neighbours
if i < len(vertices)-1:
vtL = vertices[i-1]
vt = vertices[i]
vtR = vertices[i+1]
else:
vtL = vertices[i-1]
vt = vertices[i]
vtR = vertices[0]
# Average the vectors to the two neighbour vertices
vec1 = (vt - vtL)
vec2 = vt - vtR
vec1.Unitize()
vec2.Unitize()
vecLvr = -(vec1+vec2)/2
vecLvr.Unitize()
# Make a circle and a plane through the three vertices
crc = rc.Geometry.Circle(vtL,vt,vtR)
pl = rc.Geometry.Plane(vt,vec1,vec2)
circles.append(crc)
# Rotate the plane to align with the averaged vector
vecPA = rc.Geometry.Vector3d.VectorAngle(pl.YAxis,vecLvr)
pl.Rotate(vecPA,pl.ZAxis)
planes.append(pl)
# Get radius and adjust for large/infinite radii (else Rhino viewport fucks up)
r = round(crc.Radius,roundDecimal)
if r < minCircleRadius:
r = maxCircleRadius
if r > maxCircleRadius or r == 0:
r = maxCircleRadius
crc = None
radii.append(r)
# Case for open curve (sets end radii/planes to same as neighbour)
if not polyline.IsClosed:
# Start vertex
radii[0] = maxCircleRadius
planes[0].XAxis = planes[1].XAxis
planes[0].YAxis = planes[1].YAxis
planes[0].ZAxis = planes[1].ZAxis
# End vertex
radii[-1] = maxCircleRadius
planes[-1].XAxis = planes[-2].XAxis
planes[-1].YAxis = planes[-2].YAxis
planes[-1].ZAxis = planes[-2].ZAxis
return radii,planes,circles