Normal at position t1 of a space curve 3D

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:

v_normal = Curve.DerivativeAt(t1, 2)

1 Like

Hello
I can be wrong but I think this is better
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.curve/perpendicularframeat

Hello,
Thank you very much, but I am looking for the normal of a space curve and not of a plane.

whats a space curve

Hello
the plane contains the vectors. It contains the Tangent (Z axis) and the Normal vector (surely X axis)!

I think he/she means 3D curve.

Hi @msgatrong,

Perhaps this?

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()    

– Dale

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.

Best regards,

Hello,
Yes, It concerns the 3D curve with double curvatures. The 2D curve has only one curvature.