ceg416hw2trycode

ceg416hw2trycode - Use[i,j = getline(A,B Date ia = A(1 ja =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%File: makelines.m %Date: 1/19/2010 clear ; clc ; close all ; A = zeros(100,60); spy(A);pause(5);hold on; pta = [ 10 , 20 ]; ptb = [ 30 , 4 ]; ptc = [ 50 , 10 ]; [i1,j1]= getline(pta,ptb); A = putline(A,i1,j1); spy(A);pause(1); [i2,j2]= getline(ptb,ptc); A = putline(A,i2,j2); spy(A);pause(1); [i3,j3]= getline(ptc,pta); A = putline(A,i3,j3); spy(A); %------------------------------------- function [i,j] = getline(A,B) % File: getline.m
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Use: [i,j] = getline(A,B) % Date: 1/19/2010 ia = A(1); ja = A(2); ib = B(1); jb = B(2); m = (jb-ja)/(ib-ia); b = ja-m*ia; i= min([ia ib]):max([ia ib]); j = round(m*i+b); %------------------------------------- function A = putline(A,iones,jones) % File: putline.m % Use: A = putline(A,iones,jones) % Date: 1/19/2010 L = length(iones); for p=1:L, A(iones(p),jones(p))=1; end 20 40 60 10 20 30 40 50 60 70 80 90 100 nz = 79...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online