User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 427,432 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,634 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Legacy and Other Languages advertiser: Programming Forums
Views: 3255 | Replies: 1 | Solved
Reply
Join Date: Jun 2006
Posts: 2
Reputation: noobDesigner is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
noobDesigner's Avatar
noobDesigner noobDesigner is offline Offline
Newbie Poster

Matlab Dataset

  #1  
Jun 30th, 2006
hello!!!

again i encounter a problem .........

I was wondering if anyone can point me in the right direction.

What i am trying to do is create a volume dataset. I have been aiming to create a coloured cube and put a cylindrical object inside it (of a different colour). once i have done this i am to take slices out of it and display it in two dimensions.

wonder if anyone can put me on the right path.......


Mins
"There are only 10 types of people in the world - those who understand binary, and those who don't"
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Posts: 35
Reputation: b4codes is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
b4codes b4codes is offline Offline
Light Poster

Re: Matlab Dataset

  #2  
Jul 13th, 2006
You could have tried kluid (http://www.kluid.com) for this. Well the 2D slice will be either a square with a circle or a rectangle in it depending from which side you cut the volume. But in case you still want to draw the 3d volume here are the codes for cube (you can easily modify it for cylinder also):

function cube(i,d,c,alpha);
% function to draw a 3-D cube in a 3-D plot
%
%
% cube(start,size,color,alpha);
%
% will draw a cube at 'start' of size 'size' of color 'color' and
% transparency alpha (1 for opaque, 0 for transparent)
% Default size is 1
% Default color is blue
% Default alpha value is 1
%
% start is a three element vector [x,y,z]
% size the a three element vector [dx,dy,dz]
% color is a character string to specify color
% (type 'help plot' to see list of valid colors)
%
%
% cube([2 3 4],[1 2 3],'r',0.7);
% axis([0 10 0 10 0 10]);
%

switch(nargin),
case 0
disp('Too few arguements for cube');
return;
case 1
l=1; %default length of side of cube is 1
c='b'; %default color of cube is blue
case 2,
c='b';
case 3,
alpha=1;
case 4,
%do nothing
otherwise
disp('Too many arguements for cube');
end;
x=[i(1)+[0 0 0 0 d(1) d(1) d(1) d(1)]; ...
i(2)+[0 0 d(2) d(2) 0 0 d(2) d(2)]; ...
i(3)+[0 d(3) 0 d(3) 0 d(3) 0 d(3)]]';
for n=1:3,
if n==3,
x=sortrows(x,[n,1]);
else
x=sortrows(x,[n n+1]);
end;
temp=x(3,: );
x(3,: )=x(4,: );
x(4,: )=temp;
h=patch(x(1:4,1),x(1:4,2),x(1:4,3),c);
set(h,'FaceAlpha',alpha);
temp=x(7,: );
x(7,: )=x(8,: );
x(8,: )=temp;
h=patch(x(5:8,1),x(5:8,2),x(5:8,3),c);
set(h,'FaceAlpha',alpha);
end;


: ]

b4codes

*******************************************************

Originally Posted by noobDesigner
hello!!!

again i encounter a problem .........

I was wondering if anyone can point me in the right direction.

What i am trying to do is create a volume dataset. I have been aiming to create a coloured cube and put a cylindrical object inside it (of a different colour). once i have done this i am to take slices out of it and display it in two dimensions.

wonder if anyone can put me on the right path.......


Mins
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Legacy and Other Languages Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Legacy and Other Languages Forum

All times are GMT -4. The time now is 5:29 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC