04-05-2020 04:20 AM
Hi every one,
i am trying to create a straight line using two points (0,0,0) and (1,1,1) in 3D picture.
After i try i see that i don't get straight line that starts and (0,0,0) the origin, and ends in (1,1,1).
i am using LabVIEW 19(no vision)
The question is:
How should I use LabView commands in order to transform a vector V0 (thin cylinder) to vector V1, where:
V0 is along the Z axis, its length is sqrt(3)/2, and its center is at the origin
V1 is located such that its bottom part is at the origin and its top part at (1,1,1)
The transformation i have in mind is:
I added VI that i used to do it.
I need some help and thank you.
04-05-2020 02:23 PM
I've not done much with 3D drawing in LabVIEW, but have a lot of experience with 3D rotations. Given a right-hand XYZ coordinate system, here is how I would draw a vector from 0,0,0 to 1,1,1 (note that there are multiple ways to do this):
Bob Schor
04-06-2020 09:34 AM - edited 04-06-2020 10:14 AM
the center of mass of the thin cylinder is at 0,0,0
like this:
all the rotation you do is relative to this point
@RomDev wrote:
"i am trying to create a straight line using two points (0,0,0) and (1,1,1) in 3D picture."
to achieve this in a 3d picture control, use "create mesh with attributes"
..\LabVIEW 2019\examples\Graphics and Sound\3D Picture Control\Creating Points and Lines.vi
or do your own version of 3d Bresenham Algorithm:
e.g. https://www.geeksforgeeks.org/bresenhams-algorithm-for-3-d-line-drawing/
and use spheres exclusively
04-28-2020 04:35 PM
Hi RomDev,
A universal approach is to create a cylinder of the right length. By default the cylinder center is at (0,0,0) and it is aligned along the Z-axis.
LabVIEW provides a tool to rotate the cylinder a certain angle around a given axis. You calculate the angle by using the dot product and the rotation axis using the cross product, as shown in the block diagram below.
So the block diagram above is going to move a vector from the Z-axis centered at the origin to the origin and end positions given by the controls ( (0,0,0) and (1,1,1) by default).
The VI is also attached here in LabVIEW 2019 format.
Regards