From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3-D?

Hi all.

I am writing a LabView VI and I was hoping to create a 3-D cube that rotates
around each of its 3 axes (pitch, roll and yaw). The only was I have found
to do this so far, is to draw 12 lines an XY graph to form the cube, as in
the example Bouncing Cube in LabVeiw 6i. This method, however, is very
complicated due to the equations, and I was wondering if anyone knows
another way? I have been told you can have graphical objects, for example
lines and shapes but I can't find out how to create them.

Thank you,
Sarah
0 Kudos
Message 1 of 9
(3,553 Views)
Sarah,

Rotating a 3D object is going to be somewhat difficult no matter what your approach, simply because the mathematics are not trivial. However, I do have this example that might get you started in the right direction...it is a pared-down version of the "Rotating Graphics (Pixmaps) in LabVIEW" example on the NI Developer Exchange. Unzip the attached file and when you open the main VI (Image Spin.vi), give it the path to the cube3.bmp file I have also attached. Then you will see the cube rotating about the x and y axes. Of course, rotating around the z axis would be much more difficult since you would need to know what the entire back of the cube looked like, but hopefully this example will get you started in the right direction.

For more example V
Is involving picture manipulation, I recommend you visit NI Developer Zone > Development Library > Measurement and Automation Software > LabVIEW > Development System > Building User Interfaces > Displaying Data > Pictures.

There are other threads on the Developer Exchange discussing this topic, but they mostly suggest using a picture control, which is demonstrated in the attached example.

Good luck, and have a nice day.

Sincerely,
Darren
0 Kudos
Message 2 of 9
(3,553 Views)
If you go to www.codeproject.com and look under their OpenGL section there
is an example of a 3-d rendered Active-x control. You can use Active-x
controls in a LabVIEW vi.

Once you have got the OpenGL stuff sussed you 'should' be able to create
fully featured 3-d representations of whatever you wish. I'm not saying all
of this will be easy.

Hope this helps

Andy

"Wawa" wrote in message
news:a3rgfv$l4t$1@helle.btinternet.com...
> Hi all.
>
> I am writing a LabView VI and I was hoping to create a 3-D cube that
rotates
> around each of its 3 axes (pitch, roll and yaw). The only was I have
found
> to do this so far, is to draw 12 lines an XY graph to form the cube, as in
> the example Bouncing Cube in LabVeiw 6i. This metho
d, however, is very
> complicated due to the equations, and I was wondering if anyone knows
> another way? I have been told you can have graphical objects, for example
> lines and shapes but I can't find out how to create them.
>
> Thank you,
> Sarah
>
>
0 Kudos
Message 3 of 9
(3,553 Views)
Didn't think of doing it in OpenGL. I can program in OpenGL, but I haven't
got a clue about activeX. I just read the LabView help on ActiveX and it
didn't really make sense to me! Thanks for suggesting a route for me to go
down though.

"Andrew Buchan" wrote in message
news:0Ph88.2074$jL6.765127@news6-win.server.ntlworld.com...
> If you go to www.codeproject.com and look under their OpenGL section there
> is an example of a 3-d rendered Active-x control. You can use Active-x
> controls in a LabVIEW vi.
>
> Once you have got the OpenGL stuff sussed you 'should' be able to create
> fully featured 3-d representations of whatever you wish. I'm not saying
all
> of this will be easy.
>
> Hope this helps
>
> Andy
>
> "Wawa"
@student.lboro.ac.uk> wrote in message
> news:a3rgfv$l4t$1@helle.btinternet.com...
> > Hi all.
> >
> > I am writing a LabView VI and I was hoping to create a 3-D cube that
> rotates
> > around each of its 3 axes (pitch, roll and yaw). The only was I have
> found
> > to do this so far, is to draw 12 lines an XY graph to form the cube, as
in
> > the example Bouncing Cube in LabVeiw 6i. This method, however, is very
> > complicated due to the equations, and I was wondering if anyone knows
> > another way? I have been told you can have graphical objects, for
example
> > lines and shapes but I can't find out how to create them.
> >
> > Thank you,
> > Sarah
> >
> >
>
>
0 Kudos
Message 5 of 9
(3,553 Views)
Sarah
You can probably get the effect you want by using the 3D graph control. This
is in the Full Development System and above (not Base Package). You will be
able to plot any 3d shape, surface, wireframe. You can then interactively
rotate this with the mouse or programmatically using a Property node.

I have an example (in LV 6.1 or 6i) which you can have - I will email it to
you.

Regards
Ian Bell
NI UK

"Wawa" wrote in message
news:a3rgfv$l4t$1@helle.btinternet.com...
> Hi all.
>
> I am writing a LabView VI and I was hoping to create a 3-D cube that
rotates
> around each of its 3 axes (pitch, roll and yaw). The only was I have
found
> to do this so far, is to draw 12 lines an XY graph to form the cube, as in
> the example Bounc
ing Cube in LabVeiw 6i. This method, however, is very
> complicated due to the equations, and I was wondering if anyone knows
> another way? I have been told you can have graphical objects, for example
> lines and shapes but I can't find out how to create them.
>
> Thank you,
> Sarah
>
>
0 Kudos
Message 4 of 9
(3,553 Views)
> I am writing a LabView VI and I was hoping to create a 3-D cube that rotates
> around each of its 3 axes (pitch, roll and yaw). The only was I have found
> to do this so far, is to draw 12 lines an XY graph to form the cube, as in
> the example Bouncing Cube in LabVeiw 6i. This method, however, is very
> complicated due to the equations, and I was wondering if anyone knows
> another way? I have been told you can have graphical objects, for example
> lines and shapes but I can't find out how to create them.
>


Still another way of doing this, which will still require a bit of
programming, is to use the picture control. The basic picture element
you want to use is the polygon. You take the coordinates of the cube
and either move the cube or the view p
osition. You then map the points
back into a plane and call polygon to draw each of them.

This requires a bit of linear algebra and/or trig, but nothing all that
advanced. There are probably a number of implementations available on
devzone, info-labview, or other ftp sites.

Greg McKaskle
0 Kudos
Message 6 of 9
(3,553 Views)
Hi, Sarah.
I don't think that your problem is very complicated.
Each point in the space is described by three coordinates or by its vector. Any motion of the point is some operation with this vector in terms of mathemeatics. Almost all operations with vectors can be described by a 2D matrix. For example if you know the initial vector of the point A and you know the motion matrix M then the new vector of this point will be equal to B=MxA.
So your problem is to find the correct rotational matrix. Actually they are very simple. For example for rotation arround OZ the matrix is
cosA sinA 0
sinA -cosA 0
0 0 1
where A is the angle of rotation.
Practically the same are for other axes.

I've written the program you want. It performs r
otation of the cube around all 3 axes.
It uses 3D graphs and it is written with LV6i

Good luck.

Oleg Chutko.
Message 7 of 9
(3,553 Views)
The following webpage contains an example that draws a cube where each face of the cube is a different color.
When you run the VI, place the mouse cursor on the graph, hold down the left mouse button, and then move the mouse to rotate the cube.

http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/96d968d612f01e8586256a9d007614bf?OpenDocument

You could modify the code so that you can programmatically rotate the cube with the 'ViewLongtidue' and 'ViewLatitude' property nodes.

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 8 of 9
(3,553 Views)
Thanks for all your help everyone!
0 Kudos
Message 9 of 9
(3,553 Views)