
Matlab Coding Style

1. Do not use scripts - only use functions

2. Every function for a given project should use a specific prefix;
   E.g.: for non-Euclidean SAT we'll use: NON_<fname>.m

3. Genenerally, every function goes in a separate .m file

4. Source lines are no more than 72 columns wide

5. Header: a standard header has the following format:

   function <output_vars> = NON_<fname>(<input_vars>)
   % <fname> - short description of function
   % On input:
   %     <var1_name> (type): short description
   %     ...
   %     <varn_name> (type): short description
   % On output:
   %     <var1_name> (type): short description
   %     ...
   %     <varm_name> (type): short description
   % Call:
   %     [u1,...um] = NON_<fname>(v1,...,vn);
   % Author:
   %     <name>
   %     UU
   %     <semester&year>
   %

   E.g.:

function d = NON_dist(pt1,pt2)
% NON_dist - distance between 2 pts in hyperbolic geometry
% On input:
%     pt1 (2x1 vector): x,y values of point1
%     pt2 (2x1 vector): x,y values of point2
% On output:
%     d (float): distance between points
% Call:
%     d = NON_dist([0;1],[0.7071;0.7071]);
% Author:
%     T. Henderson
%     UU
%     Summer 2023
%

d = acosh(1 + ((pt1(1)-pt2(1))^2+(pt1(2)-pt2(2))^2)/(2*pt1(2)*pt2(2)));

