Code covered by the BSD License  

Highlights from

2.5 | 2 ratings Rate this file 14 Downloads (last 30 days) File Size: 1.97 KB File ID: #22376
image thumbnail





Construct tangent, normal and binormal vectors of a curve

| Watch this File

File Information

Calculation of Tangent (T), Normal (N) and Binormal (B) of a continuous curve at every points of the curve.

function [T N B]=myfrenet(x,y,z,init)
% "x","y",and "z" is the coordinates of the curve. The curve also can be 2d.
% "init" is initial normal vector that user can be specified. With this input, you can freely initialize your vectors.

Although the name of the function is "myfrenet", the vectors are calculated in a different way from "frenet" equations because of some discontinuities of "frenet".

Derrivatives of the curve are calculated with spline fitting, therefore spline toolbox are required. If the toolbox are not available, users can change the derrivative calculation method such as by using "diff" or "gradient" command.

% Example
 x=cos(t); y=sin(t); z=t;

Required Products Spline Toolbox
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
20 Nov 2014 Mehmet OZTURK


Hi Walter, sorry for the late response. I have not received any notification about your comment.

This code is originally based on the paper:
"Calculation of Reference Frames along a Space Curve"- Jules Bloomenthal (published in Graphics Gems, vol. 1)

So, you can cite this paper insted.

Comment only
28 Feb 2014 Walter


I will run it once and then take the mean of the Tangent vectors to use as the initial Norm vector for the second pass through.
This ensures that the orientation of the normals is typically coplanar for a more-or-less 2D curve in 3D space.
How do I cite this code/method for research purposes?

Comment only
28 Feb 2014 Walter


14 Jul 2011 svetlana



Contact us