Home > 05-08-Geometry > demo_2D_geometry.m

demo_2D_geometry

PURPOSE ^

% DEMO 2D projective geometry

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% DEMO 2D projective geometry

 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 2D projective geometry
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 clearvars
0012 
0013 addpath(genpath('../General-Functions'))
0014 
0015 fprintf('\n------ DEMO 2D projective geometry ------\n')
0016 
0017 fprintf('\nIn order to shorten the output, we display transposed vectors\n')
0018 fprintf('\nGiven: 2D points\n')
0019 x1 = [1;1;1]; disp(['x_1 = [', num2str(x1'),']'])
0020 x2 = [1;2;1]; disp(['x_2 = [', num2str(x2'),']'])
0021 x3 = [6;6;2]; disp(['x_3 = [', num2str(x3'),']'])
0022 
0023 fprintf('\nlines l1 = x2 ^ x3 etc.\n')
0024 l1 = calc_S(x2)*x3; disp(['l_1 = [', num2str(l1'),']'])
0025 l2 = calc_S(x3)*x1; disp(['l_2 = [', num2str(l2'),']'])
0026 l3 = calc_S(x1)*x2; disp(['l_3 = [', num2str(l3'),']'])
0027 
0028 fprintf('\ny-axis\n')
0029 ly = [1;0;0]; disp(['l_y = [', num2str(ly'),']'])
0030 
0031 fprintf('\nintersection x4 = l3 ^ ly\n')
0032 x4 = calc_S(ly)*l3;
0033 disp(['x_4 = [', num2str(ly'),']  --> point at infinity in the direction of x-axis'])
0034 
0035 plot_init;
0036 figure('Color','w')
0037 set(gca,'xlim',[0.5 3.5],'ylim',[0.5 3.5]);
0038 hold on;
0039 
0040 h = plot_2D_line(l1); set(h,'LineWidth',2);
0041 h = plot_2D_line(l2); set(h,'LineWidth',2);
0042 h = plot_2D_line(l3); set(h,'LineWidth',2);
0043 
0044 x3 = x3/norm(x3);
0045 scatter([x1(1),x2(1),x3(1)],[x1(2),x2(2),x3(2)],'ko','filled')
0046

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