Arduino Forum

Forum 2005-2010 (read only) => Software => Interfacing => Topic started by: kiltjim on Dec 05, 2009, 12:51 am

Title: Simplest way to display 3D image (accelerometer)
Post by: kiltjim on Dec 05, 2009, 12:51 am
I've seen quite a few samples of displaying a box or sphere using Processing and rotating it in space according to the orientation of an accelerometer.  This is nice, but what if I have a solid model of a more complex shape?  I can generate the solid model into a variety of file types, so format shouldn't be any issue.

What would be the best program to do this in?  I am more of an electronics guy, and I've never played with anything more powerful than VB, so keep that in mind.... :D
Title: Re: Simplest way to display 3D image (accelerometer)
Post by: bill2009 on Dec 05, 2009, 03:09 am
Not exactly what you want but I built one of those acclerometer-driven rotating-rectangular-prism apps in Processing then "skinned" the rectangular prism with 6 .jpg's to make a model of a cardboard shipping box (sparkfun as it happens).  It was exceptionally cute because I mounted the arduino and accelerometer IN the sparkfun box that I was modelling.

Sadly, the computer that I did that work on is out of service at the moment but trust me it was great.

So, one way to go would be to break down your model to a smallish number of solids skinned with images.
Title: Re: Simplest way to display 3D image (accelerometer)
Post by: kiltjim on Dec 05, 2009, 06:07 pm
Not ever working with Processing, do you have to assign each image to each surface?  I am just thinking that this is going to be an extremely arduous task for anything beyond a very basic shape.  I will look at this as a starting point, maybe I can figure out how to get more complicated with it.

One of the projects I had in mind was an image of a car that shows the 'stance' in space in relation to the accelerometer.  I can draw the vehicle in Solidworks, Autocad, Rhino, etc.  I know Rhino and Solidworks will allow me to put an image over a surface, and make it look somewhat real.

Does anyone know how I could then get the model and the Arduino to talk to each other?  Can import anything like this into Processing?  I only mention Processing because I know it gets along with the Arduino, but I am willing to look at other programs as well.
Title: Re: Simplest way to display 3D image (accelerometer)
Post by: PaulS on Dec 05, 2009, 06:46 pm
If you can export the data as a VRML file from the CAD system, you could write an application based on OpenGL that could display that VRML file. Then, you could change the point of view of the OpenGL camera, based on data read from the serial port.

It's not trivial, but it isn't all that difficult, either.

Unless you are not familiar with VRML files and OpenGL, that is.
Title: Re: Simplest way to display 3D image (accelerometer)
Post by: Osgeld on Dec 05, 2009, 06:47 pm
who the heck is familiar with VRML, its been dead for over a decade

my advice is to hunt around on sourceforge, there is bound to be a 3d data plotter program or framework
Title: Re: Simplest way to display 3D image (accelerometer)
Post by: PaulS on Dec 05, 2009, 06:59 pm
I am, and it is far from dead.
Title: Re: Simplest way to display 3D image (accelerometer)
Post by: kiltjim on Dec 07, 2009, 12:28 am
@PaulS:

On your advice, I looked at VRML, and lo and behold, it is a format that Solidworks readily supports.  Any help putting a VRML image into a window inside a VB application, or inside Processing?

Title: Re: Simplest way to display 3D image (accelerometer)
Post by: PaulS on Dec 07, 2009, 12:42 am
Getting the VRML file was the easy part. Writing the OpenGl based application, and importing the VRML file is the hard part. I can do it, because I do that stuff for a living. It's not a drag-and-drop or plug-and-play solution, though. You will be spending some time learning C++, Visual Studio, Windows application development, and VRML file structure (although that is the easiest part).