3.5

3.5 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 1.66 KB File ID: #17658

Bresenham's 3D Line algorithm

by Jean Chaoui

 

21 Nov 2007 (Updated 26 Nov 2007)

The Bresenham line algorithm provides points in a 3-dimensional Matrix which form a close approximat

| Watch this File

File Information
Description

The Bresenham line algorithm is an algorithm that determines which points in a 3-dimensional raster should be plotted in order to form a close approximation to a straight line between two given points in 3D space.
The common conventions that pixel coordinates increase in the down and right directions and that pixel centers have integer coordinates will be used. The endpoints of the line are the pixels at (x0, y0, z0) and (x1, y1,z1), where the first coordinate of the pair is the column, the second is the row and the third is the slice.

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
09 Dec 2007 The Golden Eye

Thank you very much, finally i found it in 3D

30 Dec 2007 won Ting

Hey,
It determines the voxel value or the index ?

07 Mar 2008 Ahmad ALMHDIE

I downloaded the code. I then made a simple test tracing a line of a center slice of a 3D image. The code seems not working properly, unless I miss used it. Your feedback is highly appreciated. The test I mase is as follows:

A= zeros(257, 257, 257);
Matrice = bresenham_line_3D(129,129,129,139,257,129,A);
imshow(Matrice(:,:,129))

% However, it works with the following inputs:

Matrice = bresenham_line_3D(129,129,129,257,257,129,A);
imshow(Matrice(:,:,129))

Thanks,
Bon courage,
Ahmad

18 Mar 2008 jean Chaoui

Dear Ahmad, the test you had made gives good result, you have just SWAP the X and Y and you will get it

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
reconstruction Jean Chaoui 22 Oct 2008 09:36:25
bresenham 3d line drawing Jean Chaoui 22 Oct 2008 09:36:25

Contact us at files@mathworks.com