clear all
close all

t=linspace(0,1,10);

ra=[1,1,1];
rb=[2,0,0];

v=rb-ra;
vx(1:10)=v(1);
vy(1:10)=v(2);
vz(1:10)=v(3);
rax(1:10)=ra(1);
ray(1:10)=ra(2);
raz(1:10)=ra(3);

x=rax+t.*vx;
y=ray+t.*vy;
z=raz+t.*vz - .5*(-t.^2+t);

plot3(x,y,z)
hold on

% altro sistema per produrre un segmento (persarci su)
rbx(1:10)=rb(1);
rby(1:10)=rb(2);
rbz(1:10)=rb(3);

x2=t.*rbx+(1-t).*rax;
y2=t.*rby+(1-t).*ray;
z2=t.*rbz+(1-t).*raz;

plot3(x2,y2,z2)

figure

t=linspace(0,2*pi,200);

x=cos(t);
y=sin(t);
z(1:length(t))=0;

Tx=-sin(t);
Ty=cos(t);
Tz(1:length(t))=0;

Nx=-cos(t);
Ny=-sin(t);
Nz(1:length(t))=0;

Bx(1:length(t))=0;
By(1:length(t))=0;
Bz(1:length(t))=1;

rho=.3;

plot3(x,y,z)
hold on

x1=x+rho*cos(15*t).*Nx+rho*sin(15*t).*Bx;
y1=y+rho*cos(15*t).*Ny+rho*sin(15*t).*By;
z1=z+rho*cos(15*t).*Nz+rho*sin(15*t).*Bz;

plot3(x1,y1,z1)
axis equal

