Home > 05-08-Geometry > demo_dual.m

demo_dual

PURPOSE ^

% DEMO Duality

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% DEMO Duality

 Wolfgang Förstner
 wfoerstn@uni-bonn.de

 last changes: Susanne Wenzel 07/17
 wenzel@igg.uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% DEMO Duality
0002 %
0003 % Wolfgang Förstner
0004 % wfoerstn@uni-bonn.de
0005 %
0006 % last changes: Susanne Wenzel 07/17
0007 % wenzel@igg.uni-bonn.de
0008 
0009 clc
0010 close all
0011 
0012 addpath(genpath('../General-Functions'))
0013 
0014 fprintf('\n------ DEMO Duality ------\n')
0015 
0016 fprintf('\nIn order to shorten the output, we display transposed vectors\n')
0017 fprintf('\nGiven: 3D points\n')
0018 X = random('bino',20,.5,[4,1]); disp(['X = [', num2str(X'),']'])
0019 Y = random('bino',20,.5,[4,1]); disp(['Y = [', num2str(Y'),']'])
0020 % any two auxiliary points  -> on planes through X and Y
0021 U = random('bino',5,.5,[4,1]); disp(['U = [', num2str(U'),']'])
0022 V = random('bino',5,.5,[4,1]); disp(['V = [', num2str(V'),']'])
0023 
0024 %% plane through X and Y
0025 
0026 fprintf('\nPlanes through X and Y\n')
0027 A = null([X,Y,U]');
0028 disp(['A = [', num2str(A'),']'])
0029 
0030 A = calc_Gammadual(calc_Pi(X)*Y)'*U;
0031 disp(['A = [', num2str(A'),']'])
0032 
0033 B = null([X,Y,V]');
0034 disp(['B = [', num2str(B'),']'])
0035 
0036 B = calc_Gammadual(calc_Pi(X)*Y)'*V;
0037 disp(['B = [', num2str(B'),']'])
0038 
0039 %% check incidence
0040 fprintf('\nCheck incidence:\n')
0041 Incidence = [A'*X A'*Y; B'*X B'*Y];
0042 disp(Incidence)
0043 
0044 %% Lines
0045 fprintf('Lines\n')
0046 LXY = calc_Pi(X)*Y; disp(['L_XY = X cap Y = [', num2str(LXY'),']'])
0047 LAB = calc_Pidual(A)*B; disp(['L_AB = A ^ B = [', num2str(LAB'),']'])
0048 
0049 fprintf('normalize L_AB\n')
0050 LAB = LAB/LAB(1)*LXY(1); disp(['L_AB = [', num2str(LAB'),']'])
0051 
0052 %% check identity
0053 fprintf('\nCheck identity\n')
0054 should_be_zero = LXY'*calc_Dual*LAB;
0055 disp(['Check should be zero:  ',  num2str(should_be_zero)])
0056 
0057

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005