algorithmic modeling for Rhino
I found this Rhinoscript for determining the torsion of a curve at a given point . Can anyone convert it to a GH script for me?
''' Evaluate the torsion of a curve.
''' crv - a string that identifies the curve to evaluate
''' t - a parameter of the curve within its domain
''' The torsion if successful.
''' Null if the torsion is undefined at the parameter.
Function EvaluateTorsion(crv, t)
' Local variables
Dim data, d1xd2, numer, denom
' Default return value
EvaluateTorsion = Null
' Calculate the torsion
data = Rhino.CurveEvaluate(crv, t, 3)
If IsArray(data) And UBound(data) = 3 Then
d1xd2 = Rhino.VectorCrossProduct(data(1), data(2))
numer = Rhino.VectorDotProduct(d1xd2, data(3))
denom = Rhino.VectorDotProduct(d1xd2, d1xd2)
If denom > 0 Then
EvaluateTorsion = numer / denom
Translated to the best of my abilities. I don't know if the result is actually correct though.
As always, David, your willingness to assist is above and beyond. =)
Are you still going to add a torsion component into GH in the future?
I can certainly add this as a component. Do you think many people would use it?
I added both a Torsion and a Derivatives component. Dropdown only as these are pretty darn geeky.
Sweet! Really taking on Mathematica now man! ;D
I definitely can't attest to anyone else, but I WILL be using these!