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: 

Unique 3d rotation using the activeX 3d graph

Hi Ben:
 
  
0 Kudos
Message 11 of 28
(1,408 Views)

Take a look and the version 5 of that llb.

It plots a 3-d line in space. This may help you visualize what is happening.

The tricky part (for me) was figuring out an axis about which to rotate the object to get it pointed the way I wanted.

Somewhere in the code I sent is the VI that does that. In my *5 version I am trying to trace a spiral in space. So I had a two pints in space I needed to connect. Those two points drive my logic on finding the correct axis.

 

Gotta run!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 28
(1,405 Views)

Create transform is the VI that does the roatation.

 

Start by looking at the VI's that create the axis. The axis are just long thin cyliners with a cone at the end. To create the XYZ axis I rotate the cylinders and cones about an axis.

 

After some experimenting, I found that I get an object to point in a specific direction by findining a vector that bisects the angle between straight up and the direction I want to point. Then I rotate the object 180 about that bisecting vector.

All of this code is in the llb I provided.
 
Have Fun!
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 28
(1,396 Views)

Hi Everyone: 

It has been a couple of weeks since the last post to this thread so I thought I would give everyone an update.  I did figure out how to do this 3D rotation mathematically and it was not all that hard after all.  I am still using the 3D graph indicator.  Then given the amount of rotation on each of the 3 axes the final position is calculated using a 3D rotation matrix.  Here are a couple of other documents out there in cyberspace that helped me understand what I needed to do.

www.cprogramming.com/tutorial/3d/rotation.html

http://www.imaging.robarts.ca/coders/content/programmingLinks/TheMathematicsofthe3DRotationMatrix.ht...

If anyone is looking for more information about how I did it (example code and whatnot), then post to this thread and I'll respond as soon as I can.

Greycat

Special thanks to unclebump for setting me on the right path to the information I needed ... Thanks

 

0 Kudos
Message 14 of 28
(1,374 Views)
Greycat,
First off let me say thanks to you and everyone who contributed to this post. It sounds like everyone has done amazing work and all the LabVIEW developers appreciate it. I would like to impose on you for one more thing. Would you be willing to post the final working version of your code so that everyone will have access to your solution? Again, we all appreciate your time and efforts.
 
Best Regards,
 
Chris C
Applications Engineering
National Instruments
Message 15 of 28
(1,357 Views)
Yes I will post my final work ... documented and altered a bit so that it will be usable by everyone ... post will be forthcoming within the next week.
 
Greycat
Message 16 of 28
(1,347 Views)
Ok so here is my example.  Sorry about it being a little convoluted.  If more information is required please refer to the document links I posted previously in this thread, or post to this thread and I'll see if I can answer your questions.  If I've made any glaring mistakes, please feel free to correct me, I'm new to 3D mathematics.  Here it is ... Have fun.
 
Greycat
 
 
Message 17 of 28
(1,415 Views)
  Sorry about the previous midthread post.   Ok so here is my example.  Sorry about it being a little convoluted.  If more information is required please refer to the document links I posted previously in this thread, or post to this thread and I'll see if I can answer your questions.  If I've made any glaring mistakes, please feel free to correct me, I'm new to 3D mathematics.  Here it is ... Have fun.
 
Greycat
Message 18 of 28
(1,316 Views)

Thank you Greycat!

And...

Congratulations on your promotion to "Proven Member" !

 

IBen

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 19 of 28
(1,307 Views)

Very nice, Greycat!

Always remember that you don't need to duplicate code 3x on the diagram, you can always use autoindexing and do all steps in the same loop. For demonstration, I modified your example to fit one screen (LabVIEW 7.1). Note that also most of the array operation seem easier if you start out with a transposed version of your data.

You also don't need any of the local variables.

I added an event structure so things only get recalculated whenever an angle is changed. Your version continuously does the same calculation over and over for no good reason. (Add an indicator to the iteration terminal of the big while loop to see ;))

Enjoy!

 

Message 20 of 28
(1,297 Views)