motion_planning_td5/test_file.m

64 lines
1.2 KiB
Matlab

clc
close all
clear all
##These are all of the tries I made with the matgeom library to try and develop the code
figure 1
a=drawCircle(0, 0, 1);
hold on;
b=drawCircle(0, 0, 2);
##figure 2
poly_a=circleToPolygon([0 0 1], 32);
poly_b=circleToPolygon([0 0 2], 32);
##drawPolygon(poly_a, 'b')
##drawPolygon(poly_b, 'b')
Points = zeros(2, 10);
jTee=[3;4];
Points(1:2,1)=[1.5;0]
Points(1:2, 2)=[1, 1]
Points(1:2, 3) = [0; -1.5];
dx=Points(1,1)-Points(1, 2);
dy=Points(2,1)-Points(2, 2);
LINE=[Points(1, 1), Points(2, 1), dx, dy]
L = createLine(LINE);
hold on
drawLine(L)
hold on
drawPoint(Points(1,1), Points(2, 1))
hold on
drawPoint(Points(1,2), Points(2, 2))
intersectLinePolygon(L, poly_a)
dx=Points(1,1)-Points(1, 3);
dy=Points(2,1)-Points(2, 3);
LINE=[Points(1, 1), Points(2, 1), dx, dy]
L = createLine(LINE);
hold on
drawLine(L)
hold on
drawPoint(Points(1,2), Points(2, 2))
hold on
drawPoint(Points(1,3), Points(2, 3))
intersectLinePolygon(L, poly_a)
isempty(intersectLinePolygon(L, poly_a))!=1
## This should be how we apply the function:
####rangeQ1Q2=[-5, -5; 5, 5];
####nbPoints=10;
####L1=2;
####L2=1;
####MapFilename='HelloWorld';
####
####buildPRM (rangeQ1Q2, nbPoints, L1, L2, MapFilename)