Home > vbmeg > functions > common > coordinate > vb_cart2theta_phi.m

vb_cart2theta_phi

PURPOSE ^

Project 3D coordinate to 2D-plane with modified projection

SYNOPSIS ^

function [ xa ,ya ,phi, theta ] = vb_cart2theta_phi(x , mode)

DESCRIPTION ^

 Project 3D coordinate to 2D-plane with modified projection
   [ xa ,ya ] = vb_cart2theta_phi(x , mode)
 --- Input
  X : 3D cartesian coordinate (N x 3)
 mode = 'x', '-x' : project y-z plane
      = 'y', '-y' : project z-x plane
      = 'z', '-z' : project x-y plane
 --- Output
 [ xa ,ya ] : transformed 2D coordinate

 Ver 1.0 written by M. Sato  2003-3-15

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [ xa ,ya ,phi, theta ] = vb_cart2theta_phi(x , mode)
0002 % Project 3D coordinate to 2D-plane with modified projection
0003 %   [ xa ,ya ] = vb_cart2theta_phi(x , mode)
0004 % --- Input
0005 %  X : 3D cartesian coordinate (N x 3)
0006 % mode = 'x', '-x' : project y-z plane
0007 %      = 'y', '-y' : project z-x plane
0008 %      = 'z', '-z' : project x-y plane
0009 % --- Output
0010 % [ xa ,ya ] : transformed 2D coordinate
0011 %
0012 % Ver 1.0 written by M. Sato  2003-3-15
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 switch    mode,
0018 case    'z',
0019     [phi,theta,r] = cart2sph(x(:,1),x(:,2),x(:,3));
0020 case    'x',
0021     [phi,theta,r] = cart2sph(x(:,2),x(:,3),x(:,1));
0022 case    'y',
0023     [phi,theta,r] = cart2sph(x(:,3),x(:,1),x(:,2));
0024 case    '-z',
0025     [phi,theta,r] = cart2sph(x(:,1),x(:,2),-x(:,3));
0026 case    '-x',
0027     [phi,theta,r] = cart2sph(x(:,2),x(:,3),-x(:,1));
0028 case    '-y',
0029     [phi,theta,r] = cart2sph(x(:,3),x(:,1),-x(:,2));
0030 end;
0031 
0032 %rho = 0.5*pi-theta;
0033 rho = 2 * sin((0.5*pi-theta)/2);
0034 
0035 [xa,ya] = pol2cart(phi,rho);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005