Discussion:
3d plot sphere with vectors
(too old to reply)
John Pierson
2008-08-13 14:40:05 UTC
Permalink
Hi, I'm trying to create a 3d shpere [i've doen that bit] with a number of vector lines out from the plot within the 3d enviroment, can this be done by adding aditional plots, if so how can they be done?? The vector lines i'm trying to make will be controlled by a source, and destination coordiantes defined by:  {theta, phi, r} - in sherical coordinates,  also can they be plotted as just lines, and idealy with arrows on the destination end?? Help!! VI attatched, any help apreciated!!


Ball and vector.vi:
http://forums.ni.com/ni/attachments/ni/170/348970/1/Ball and vector.vi
RER
2008-08-14 12:40:18 UTC
Permalink
Dear John,The function you are looking for is the 3D curve.vi – you can specify 3 separate coordinates for x, y, z to form a vector. How you specify these coordinates is up to you – I imagine that, with a little thought, you would have no problems specifying these radially.Another important function, that is rather easy to miss, is the setplots.vi. By default you can only make a single plot on a 3D graph. But, using the setplots function, you can add as many plots as you require.The only last thing to remember is that you must specify the plot number when you are changing properties of a specific plot.Please see the attached code for further help.It sounds like you are creating quite an exciting application! Best of luck to you!!Kind regards,


Ballandvector.vi:
http://forums.ni.com/ni/attachments/ni/170/349251/1/Ballandvector.vi
Ben
2008-08-14 13:10:05 UTC
Permalink
You can choose the coordinates system used when plotting. See here.<img src="Loading Image..." border="0"> &nbsp;BenMessage Edited by Ben on 08-14-2008 07:46 AM


CoordinateSystem.PNG:
http://forums.ni.com/ni/attachments/ni/170/349259/1/CoordinateSystem.PNG
John Pierson
2008-08-15 07:40:17 UTC
Permalink
Hi i understood how to carry out corrdinate conversion, it was the format i was having issue with.I'll givwe reply 1 a try, many thanks
John Pierson
2008-08-15 07:40:17 UTC
Permalink
Hi could you convert the labview edition from 8.5 to 8.2 for me??my labview won't read it.
RER
2008-08-15 09:10:17 UTC
Permalink
Apologies John, I made an incorrect assumption.Please find the attached 8.2 code.


Ballandvector.vi:
http://forums.ni.com/ni/attachments/ni/170/349541/1/Ballandvector.vi
John Pierson
2008-08-15 09:40:19 UTC
Permalink
no my mistake i didn't say which version i was using!
John Pierson
2008-08-15 10:10:11 UTC
Permalink
One last thing, i'd like to make the vi accept a number of vectors to plot, i've tried to do this using a for loop, and attatching the plot number to the plot number +1, but this seems to give one plots and the ball and then an error, if i set it to +2 it gives me both lines but no balls.&nbsp;I'm a touch confused.&nbsp;help is again very much apreciated!&nbsp;see attatched!


4gems.vi:
http://forums.ni.com/ni/attachments/ni/170/349555/1/4gems.vi
John Pierson
2008-08-15 10:10:11 UTC
Permalink
Ah found it, there is a 'number of plots' part that has to include the ball as well as the linesmy bad.
RER
2008-08-15 11:10:07 UTC
Permalink
Great news! I am guessing that, before you resolved your own issue, you were over writing the sphere plot. So, by adding two to the for loop iteration rather than one you are able to avoid this (i.e. during the first run of the for loop, you are writing to plot number 2, rather than overwriting the sphere in plot number 1).&nbsp;John, for the sake of your fellow developers, could you please post your new and improved vi on here. That way, if another developer stumbles on to this thread they will have a prebuilt piece of code.&nbsp;:robotvery-happy:&nbsp;Thanks for your time John, Best wishes,
John Pierson
2008-08-15 13:10:05 UTC
Permalink
Indeed that is how i did it and it works nicely. The vI is attatched!!


4gems.vi:
http://forums.ni.com/ni/attachments/ni/170/349573/1/4gems.vi

Loading...