You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: solid_angle.m
    path of file: ./repos/fieldtrip/forward/private
    
    the code of the file until where you have to start completion: function [varargout] = solid_angle(varargin)

% SOLID_ANGLE of a planar triangle as seen from the origin
%
% The solid angle W subtended by a surface S is defined as the surface
% area W of a
    
function is called so frequently (for
% large meshes), that the mex file should be used in all practical cases.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function [w] = solid_angle(r1, r2, r3);
%
% if nargin==2
%   % reassign the input arguments
%   pnt = r1;
%   tri = r2;
%   npnt = size(pnt,1);
%   ntri = size(tri,1);
%   w    = zeros(ntri,1);
%   % compute solid angle for each triangle
%   for i=1:ntri
%     r1 = pnt(tri(i,1),:);
%     r2 = pnt(tri(i,2),:);
%     r3 = pnt(tri(i,3),:);
%     w(i) = solid_angle(r1, r2, r3);
%   end