From: Walter Roberson on
Hane wrote:

>> >> Hane wrote:
>> >>
>> >> > I am trying to generate a 3D object to use in a CAD tool. The
>> object >> is > a cube with a random surface on top of that as one of
>> its faces. >> I > already generated the random surface usig surf
>> command. I should >> only > close the surface like a cube (vertically
>> and horizontally) and >> make it > 3D but I do not know HOW?

> Thanks for your help. I could generate a box around my random surface
> but I still can not merge them together to make a 3D object. Do you have
> any suggestion?

The example in the delaunay3 shows how to create a 3D mesh for a cube; this
could be scaled and translated to be on the bottom of your surf() surface.


Alternately,

>> x = [ 0 1; 1 1; 1 1; 1 1; 1 0; 0 0;0 0;0 0]; y = [0 0; 0 0; 0 1; 1 1; 1 1;
1 1; 1 0; 0 0]; z = [0 0; 0 1; 1 1; 1 0; 0 0; 0 1; 1 1; 1 0];

>> patch(x,y,z,ones(size(z)))

creates a patch for a 3 of the 6 faces of a cube; you could continue along the
same vein but rotated 90 degrees (holding Z the same) to fill the other 3 faces.
From: Steven Lord on

"Hane " <jesuismoi28(a)yahoo.com> wrote in message
news:htrtap$a21$1(a)fred.mathworks.com...
> Hi,
> I am trying to generate a 3D object to use in a CAD tool. The object is a
> cube with a random surface on top of that as one of its faces. I already
> generated the random surface usig surf command. I should only close the
> surface like a cube (vertically and horizontally) and make it 3D but I do
> not know HOW?
>
> I wonder if anybody has any helpful idea?

In what representation do you want the 3D object to be stored?

Do you want a 3-D array with 0's and 1's where elements containing 1 are
inside the object and elements containing 0 are outside?

Do you want a triangulation of the surface of the object a la DELAUNAY?

Do you want a tesselation of the interior of the object a la DELAUNAY3?

Do you want a collection of patch objects representing the various faces of
the 3D object?

If you want a different representation, describe specifically what you want
and someone may have a suggestion for how to achieve that representation.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Hane on
"Steven Lord" <slord(a)mathworks.com> wrote in message <hu3hk8$i18$1(a)fred.mathworks.com>...
>
> "Hane " <jesuismoi28(a)yahoo.com> wrote in message
> news:htrtap$a21$1(a)fred.mathworks.com...
> > Hi,
> > I am trying to generate a 3D object to use in a CAD tool. The object is a
> > cube with a random surface on top of that as one of its faces. I already
> > generated the random surface usig surf command. I should only close the
> > surface like a cube (vertically and horizontally) and make it 3D but I do
> > not know HOW?
> >
> > I wonder if anybody has any helpful idea?
>
> In what representation do you want the 3D object to be stored?
>
> Do you want a 3-D array with 0's and 1's where elements containing 1 are
> inside the object and elements containing 0 are outside?
>
> Do you want a triangulation of the surface of the object a la DELAUNAY?
>
> Do you want a tesselation of the interior of the object a la DELAUNAY3?
>
> Do you want a collection of patch objects representing the various faces of
> the 3D object?
>
> If you want a different representation, describe specifically what you want
> and someone may have a suggestion for how to achieve that representation.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>


I want it to be in stl format, I actually found a code to convert the surf to stl. I generated 6 surfaces (faces) and I simply conbine their stl codes together. It can make my 3D object. I do not know if this is the right approach?