Home > 10-Uncertain-Geometry > Demo-Line-2D > demo_construct_Line_2D.m

demo_construct_Line_2D

PURPOSE ^

% test_construct_Line_2D: test routine for constructing 2D lines

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% test_construct_Line_2D: test routine for constructing 2D lines

 see PCV Sect. 10, Fig. 10.1

 Wolfgang Förstner
 wfoerstn@uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% test_construct_Line_2D: test routine for constructing 2D lines
0002 %
0003 % see PCV Sect. 10, Fig. 10.1
0004 %
0005 % Wolfgang Förstner
0006 % wfoerstn@uni-bonn.de
0007 
0008 
0009 close all
0010 addpath(genpath('../../General-Functions'))
0011 
0012 %% initialize sugr
0013 sugr_INIT
0014 ss = plot_init;
0015 
0016 %% join and midline
0017 % define 3 points
0018 x = sugr_Point_2D([1,2]',0.00001*[2,2;2,6]);
0019 y = sugr_Point_2D([-1,0]',0.00001*[2,-1;-1,2]);
0020 u = sugr_Point_2D([0,2]',0.00001*[2,1;1,1]);
0021 
0022 %% midpoint
0023 z = sugr_construct_midpoint_Point_2D(x,y);
0024 
0025 %%
0026 % joining line
0027 l = sugr_construct_join_Line_2D(x,y);
0028 sugr_show_Line_2D(l,'l');
0029 %%
0030 % midline : check on commutativity
0031 m1 = sugr_construct_midline_Line_2D(x,y);
0032 m2 = sugr_construct_midline_Line_2D(y,x);
0033 %%
0034 % parallel to origin
0035 lp = sugr_construct_parallel_lx_Line_2D(l,u);
0036 
0037 figure('Color','w','Position',[20 ss(2)/3 ss(1)/3 ss(2)/2])
0038 hold on
0039 xlim([-2,2]);
0040 ylim([-1,3]);
0041 sugr_plot_Point_2D(x,'.k','-b',2,40);
0042 sugr_plot_Point_2D(y,'.k','-b',2,40);
0043 sugr_plot_Point_2D(z,'.k','-b',2,40);
0044 sugr_plot_Point_2D(u,'.k','-b',2,40);
0045 sugr_plot_Line_2D(l,'-k','-r',2,40);
0046 %sugr_plot_Line_2D(m1,'-k','-r',2,40);
0047 %sugr_plot_Line_2D(lp,'-k','-r',2,40);
0048 axis equal
0049 title('Joining line ')
0050 
0051 figure('Color','w','Position',[100+ss(1)/3  ss(2)/3 ss(1)/3 ss(2)/2])
0052 hold on
0053 xlim([-2,2]);
0054 ylim([-1,3]);
0055 sugr_plot_Point_2D(x,'.k','-b',2,40);
0056 sugr_plot_Point_2D(y,'.k','-b',2,40);
0057 sugr_plot_Point_2D(z,'.k','-b',2,40);
0058 sugr_plot_Line_2D(l,'-k','-r',2,40);
0059 sugr_plot_Line_2D(m2,'-k','-r',2,40);
0060 axis equal
0061 title('Midline ')
0062 
0063 %% similar to Fig. 10.1
0064 % define 2D points
0065 x = sugr_Point_2D([-2,1]',   0.000001*[2,2;2,6]);
0066 y = sugr_Point_2D([-1,1.5]', 0.000001*[2,-1;-1,2]);
0067 z = sugr_Point_2D([1,1.3]',  0.000001*[2,-2;-2,6]);
0068 u = sugr_Point_2D([1,-0.2]',0.000001*[2,1;1,2]);
0069 
0070 l = sugr_construct_join_Line_2D(x,y);
0071 m = sugr_construct_join_Line_2D(z,u);
0072 
0073 v = sugr_construct_intersection_Point_2D(l,m);
0074 
0075 figure('Color','w','Position',[50+ss(1)/6  50 ss(1)/3 ss(2)/2])
0076 hold on
0077 xlim([-2,2]);
0078 ylim([-1,3]);
0079 sugr_plot_Point_2D(x,'.k','-b',2,40);
0080 sugr_plot_Point_2D(y,'.k','-b',2,40);
0081 sugr_plot_Point_2D(z,'.k','-b',2,40);
0082 sugr_plot_Point_2D(u,'.k','-b',2,40);
0083 sugr_plot_Point_2D(v,'.k','-b',2,40);
0084 sugr_plot_Line_2D(l,'-k','-r',2,40);
0085 sugr_plot_Line_2D(m,'-k','-r',2,40);
0086 axis equal
0087 title('Intersection')

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