elec_3d_2d - Project Cartesian 3D coordinates to a 2D plane. [Xt,Yt] = elec_3d_2d(X,Y,Z,Zrad) Project 3D electrode positions onto a 2D plane, using gnomonic projection, which draws a line from a point halfway between equator and south pole, through electrode, to a plane tangential to north pole. Given: Set of 3D Cartesian coordinates (X,Y,Z with Z > 0) X,Y midpoint at 0 Zrad is radius in Z See also elec_2d_3d.m
0001 function [Xt,Yt] = elec_3d_2d(X,Y,Z,Zrad) 0002 0003 % elec_3d_2d - Project Cartesian 3D coordinates to a 2D plane. 0004 % 0005 % [Xt,Yt] = elec_3d_2d(X,Y,Z,Zrad) 0006 % 0007 % Project 3D electrode positions onto a 2D plane, using 0008 % gnomonic projection, which draws a line from a point 0009 % halfway between equator and south pole, through electrode, 0010 % to a plane tangential to north pole. 0011 % 0012 % Given: Set of 3D Cartesian coordinates (X,Y,Z with Z > 0) 0013 % X,Y midpoint at 0 0014 % Zrad is radius in Z 0015 % 0016 % See also elec_2d_3d.m 0017 % 0018 0019 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:33 $ 0020 0021 % Licence: GNU GPL, no implied or express warranties 0022 % History: 10/1999, Chris Harvey 0023 % 07/2001, Darren.Weber_at_radiology.ucsf.edu 0024 % - using matrix algebra rather than indexed looping 0025 % 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0027 0028 rad = Zrad / 2; 0029 0030 t = (Z + rad) * ( 1/rad ); 0031 0032 Xt = X .* t; 0033 Yt = Y .* t; 0034 0035 return