3D model of banana

  • Follow


I want to create a 3D model of banana in matlab.how is it possible.
0
Reply striker 1/25/2010 5:53:05 PM

striker wrote:
> I want to create a 3D model of banana in matlab.how is it possible.

Sorry, Matlab is equipped with built-in self-defences against modelling 
fresh fruit.


http://en.wikipedia.org/wiki/Self_Defence_Against_Fresh_Fruit
0
Reply Walter 1/25/2010 7:50:49 PM


Walter Roberson <roberson@hushmail.com> wrote in message <hjksmp$lde$1@canopus.cc.umanitoba.ca>...
> striker wrote:
> > I want to create a 3D model of banana in matlab.how is it possible.
> 
> Sorry, Matlab is equipped with built-in self-defences against modelling 
> fresh fruit.
> 
> 
> http://en.wikipedia.org/wiki/Self_Defence_Against_Fresh_Fruit

sorry i couldnot get ur point
0
Reply striker 1/25/2010 8:28:05 PM

Walter Roberson <roberson@hushmail.com> wrote in message <hjksmp$lde$1@canopus.cc.umanitoba.ca>...
> striker wrote:
> > I want to create a 3D model of banana in matlab.how is it possible.
> 
> Sorry, Matlab is equipped with built-in self-defences against modelling 
> fresh fruit.
> 
> 
> http://en.wikipedia.org/wiki/Self_Defence_Against_Fresh_Fruit

No. That is not true. Only if you have the 16 ton
weight toolbox is that true. And do you have any
idea what the cost of shipping is for the 16 ton
weight toolbox? UPS makes you unload it from
the truck yourself too.

John
0
Reply John 1/25/2010 8:57:04 PM

On Jan 25, 12:53=A0pm, "striker " <friend_...@hotmail.com> wrote:
> I want to create a 3D model of banana in matlab.how is it possible.

---------------------------------------------------------------------------=
-------------
Do you already have a list of (x,y,z) coordinates and you just need to
visualize/plot it?  Or do you also need to get the coordinates in the
first place?
Did you check out the 3D visualization section in the Help?
0
Reply ImageAnalyst 1/25/2010 10:56:20 PM

striker wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message 
> <hjksmp$lde$1@canopus.cc.umanitoba.ca>...
>> striker wrote:
>> > I want to create a 3D model of banana in matlab.how is it possible.

>> Sorry, Matlab is equipped with built-in self-defences against 
>> modelling fresh fruit.

> sorry i couldnot get ur point

*Sigh* Have you ever considered the possibility of telling us what you 
are actually trying to accomplish??


Which varietal of the over 200 kinds of bananas are you trying to model?

How many sides does the banana have? (Note: I have one here at home that 
has one more side than the answer you'll find searching Google, so 
you'll need to cross-check with actual examples of the varietal.)

Are the sides flat? Are they equal area? What is the cross-sectional 
curvature of each? How does that curvature change along the length?

Are you able to create an adequate approximation of the colours 
(including the specular reflectivity) using RGB or HSV? For example, the 
  image here shows a good range of colours, but it also indirectly 
illustrates the point that common image formats are poor at capturing 
the specular information -- a point that will be important if you are 
trying to create realistic CGI models for use in (say) a movie.
http://upload.wikimedia.org/wikipedia/commons/a/a1/RedBananasMetepec.JPG

What is the internal structure of the banana? How ripe is the banana? 
How does the internal structure change with the ripeness? How do the 
tensile, compressive, and shear stresses vary with the ripeness? I 
understand that in some of the varieties of bananas, the phloem bundles 
can be quite strong under tensile stress. The length and arrangement of 
the fibres will be important if your purpose is to do a finite element 
mesh examination of deformation of bananas under stress.

What is the chemical composition of the banana? How does that chemistry 
change with heat? Does the rate of heating matter for this purpose? It 
makes a difference if your purpose is to model the internal change of 
bananas as they are roasted, or as they are prepared in lye for fibre 
extraction.

And, as John mentioned, you may need additional toolkits if your purpose 
is to model the use of bananas as attack weapons.
0
Reply Walter 1/25/2010 11:17:56 PM

I just want to create a model which looks like a banana.so that i can rotate it along any axis and i can scale it in any direction.
0
Reply striker 1/26/2010 12:22:04 PM

On Jan 26, 7:22=A0am, "striker " <friend_...@hotmail.com> wrote:
> I just want to create a model which looks like a banana.so that i can rot=
ate it along any axis and i can scale it in any direction.

---------------------------------------------------------------------------=
-------------------------------------------------
Is it so important that it be a banana, specifically?  Why can't you
do your little practice with, say, a klein bottle, for which MATLAB
already has a demo (see help on the xpklein function)

Simply type "xpklein" in the command window, or run the source code
for it (from the Help documentation):

n =3D 12;
a =3D .2;                         % the diameter of the small tube
c =3D .6;                         % the diameter of the bulb
t1 =3D pi/4 : pi/n : 5*pi/4;      % parameter along the tube
t2 =3D 5*pi/4 : pi/n : 9*pi/4;    % angle around the tube
u  =3D pi/2 : pi/n : 5*pi/2;
[X,Z1] =3D meshgrid(t1,u);
[Y,Z2] =3D meshgrid(t2,u);

% The handle
len =3D sqrt(sin(X).^2 + cos(2*X).^2);
x1 =3D c*ones(size(X)).*(cos(X).*sin(X) ...
    - 0.5*ones(size(X))+a*sin(Z1).*sin(X)./len);
y1 =3D a*c*cos(Z1).*ones(size(X));
z1 =3D ones(size(X)).*cos(X) + a*c*sin(Z1).*cos(2*X)./len;
handleHndl=3Dsurf(x1,y1,z1,X);
set(handleHndl,'EdgeColor',[.5 .5 .5]);
hold on;

% The bulb
r =3D sin(Y) .* cos(Y) - (a + 1/2) * ones(size(Y));
x2 =3D c * sin(Z2) .* r;
y2 =3D - c * cos(Z2) .* r;
z2 =3D ones(size(Y)) .* cos(Y);
bulbHndl=3Dsurf(x2,y2,z2,Y);
set(bulbHndl,'EdgeColor',[.5 .5 .5])

colormap(hsv);
axis vis3d
view(-37,30);
axis off
light('Position',[2 -4 5])
light
hold off
0
Reply ImageAnalyst 1/26/2010 1:19:20 PM

"striker " <friend_019@hotmail.com> wrote in message <hjmmpb$6v4$1@fred.mathworks.com>...
> I just want to create a model which looks like a banana.so that i can rotate it along any axis and i can scale it in any direction.

look at:
http://www.mathworks.com/matlabcentral/fileexchange/5562-tubeplot

or mine:
http://www.mathworks.com/matlabcentral/fileexchange/5468-cylinder-between-2-points

Not sure you can alter the radii along the tube for the first function. Paerhaps its a start?

/Per
0
Reply Per 1/26/2010 1:35:20 PM

Yes the banana shape is important
0
Reply striker 1/26/2010 1:36:04 PM

"striker " <friend_019@hotmail.com> wrote in message <hjmr44$jhg$1@fred.mathworks.com>...
> Yes the banana shape is important

If you modify the PlotTube function a little (see below)
http://www.mathworks.com/matlabcentral/fileexchange/5562-tubeplot

I can get a pretty nice banana with the code (change 20 to 7 and see what happen):

t=linspace(0,pi,50);
tubeplot([cos(t);sin(t);0*t],0.1*t.*(pi-t),20);axis equal
shading interp;lighting phong;light;axis off

/Per

My slightly fix of the original code below. Hope he doesn't mind... Copy and save as tubeplot.m
-------------------------------------------------------

function [x,y,z]=tubeplot(curve,r,n,ct)
% Usage: [x,y,z]=tubeplot(curve,r,n,ct)
% 
% Tubeplot constructs a tube, or warped cylinder, along
% any 3D curve, much like the build in cylinder function.
% If no output are requested, the tube is plotted.
% Otherwise, you can plot by using surf(x,y,z);
%
% Example of use:
% t=linspace(0,2*pi,50);
% tubeplot([cos(t);sin(t);0.2*(t-pi).^2],0.1);
% daspect([1,1,1]); camlight;
%
% Arguments:
% curve: [3,N] vector of curve data
% r      the radius of the tube
% n      number of points to use on circumference. Defaults to 8
% ct     threshold for collapsing points. Defaults to r/2 
%
% The algorithms fails if you have bends beyond 90 degrees.
% Janus H. Wesenberg, july 2004

  if nargin<3 || isempty(n), n=8;
     if nargin<2, error('Give at least curve and radius');
    end;
  end;
  if size(curve,1)~=3
    error('Malformed curve: should be [3,N]');
  end;
  if nargin<4 || isempty(ct)
    ct=-1+0*0.5*r;
  end

  
  %Collapse points within 0.5 r of each other
  npoints=1;
  for k=2:(size(curve,2)-1)
    if norm(curve(:,k)-curve(:,npoints))>ct;
      npoints=npoints+1;
      curve(:,npoints)=curve(:,k);
    end
  end
  %Always include endpoint
  if norm(curve(:,end)-curve(:,npoints))>0
    npoints=npoints+1;
    curve(:,npoints)=curve(:,end);
  end

  %deltavecs: average for internal points.
  %           first strecth for endpoitns.
  dv=curve(:,[2:end,end])-curve(:,[1,1:end-1]);

  %make nvec not parallel to dv(:,1)
  nvec=zeros(3,1);
  [buf,idx]=min(abs(dv(:,1))); nvec(idx)=1;

  xyz=repmat([0],[3,n+1,npoints+2]);
  
  %precalculate cos and sing factors:
  cfact=repmat(cos(linspace(0,2*pi,n+1)),[3,1]);
  sfact=repmat(sin(linspace(0,2*pi,n+1)),[3,1]);
  
  %Main loop: propagate the normal (nvec) along the tube
  for k=1:npoints
    convec=cross(nvec,dv(:,k));
    convec=convec./norm(convec);
    nvec=cross(dv(:,k),convec);
    nvec=nvec./norm(nvec);
    %update xyz:
    xyz(:,:,k+1)=repmat(curve(:,k),[1,n+1])+...
        cfact.*repmat(r(k)*nvec,[1,n+1])...
        +sfact.*repmat(r(k)*convec,[1,n+1]);
  end;
  
  %finally, cap the ends:
  xyz(:,:,1)=repmat(curve(:,1),[1,n+1]);
  xyz(:,:,end)=repmat(curve(:,end),[1,n+1]);
  
  %,extract results:
  x=squeeze(xyz(1,:,:));
  y=squeeze(xyz(2,:,:));
  z=squeeze(xyz(3,:,:));
  
  %... and plot:
  if nargout<3, surf(x,y,z); end;
0
Reply Per 1/26/2010 2:05:20 PM

@ Per Sundqvist

Thank you very much sir..
0
Reply striker 1/26/2010 2:40:20 PM

striker wrote:
> Yes the banana shape is important

If the banana shape is important, then you still need to be able to answer 
questions about the number of sides, relative proportions of the sides, 
curvature of each of the sides, how the curvature varies along the length.

If you don't know that information, then you will not be able to "create a 
model that looks like a banana": at best, you will be able to create something 
that is a rough approximation of the shape of a banana -- and if all you 
create is a rough approximation, then the banana shape is NOT important to you.

Any model will be an approximation, of course, but you have to decide which 
features of the original must be represented and to what precision.

Have you at least taken a real banana and done some measurements with a ruler 
and a French Curve?
0
Reply roberson (2852) 1/26/2010 10:48:40 PM

12 Replies
450 Views

(page loaded in 0.082 seconds)

Similiar Articles:


















7/22/2012 2:18:58 PM


Reply: