Hello,
I would like to know if I can use the Rhino.Geometry.Curve.DerivativeAt method to calculate the normal vector (according to the definition in the attached diagram or (Frenet–Serret formulas - Wikipedia)) with the derivative in seconds at position t1 of a space curve 3D:
import Rhino
import scriptcontext as sc
def test_curve_normal():
go = Rhino.Input.Custom.GetObject()
go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve
go.SubObjectSelect = False
go.Get()
if go.CommandResult() != Rhino.Commands.Result.Success:
return
objref = go.Object(0)
curve, t = objref.CurveParameter()
if not curve:
return
point = curve.PointAt(t)
print("Point: {0}".format(point.ToString()))
tangent = curve.TangentAt(t)
print("Tangent: {0}".format(tangent.ToString()))
kappa = curve.CurvatureAt(t)
print("Curvature: {0}".format(kappa.ToString()))
# The normal to the curve at a particular point is the line
# perpendicular to the tangent at this point.
normal = Rhino.Geometry.Vector3d.CrossProduct(tangent, kappa)
normal.Unitize()
print("Normal: {0}".format(normal.ToString()))
if __name__ == "__main__":
test_curve_normal()
Thank you very much, if the curvature vector of Rhino is defined as in the equation 2.20 of this reference 2.2 Principal normal and curvature), the kappa vector=curve.CurvatureAt(t) in your proposal is the normal vertor. We do not need to calculate the vector product.