How can i get nodes in space?
1 次查看(过去 30 天)
显示 更早的评论
I have two points in space (x,y,z) and i need to make a nodes between them but in orthogonal mode (i mean the angle between any two nodes will be 0, 90 ,270 ,180) and i need to know that nodes and I,J,K for it.
Sample point 1 (5360, 8850, 23962) & point 2 (9630, 4010, 11216).
2 个评论
John D'Errico
2018-4-27
Ok. Those are two points in space. We got that. But what is orthogonal mode?
What "nodes" do you want to see?
回答(1 个)
Walter Roberson
2018-4-27
Only points on the line connecting those two points can satisfy the condition. As soon as you add an point that is off of the connecting line, the angle between the new point and the endpoints will not be a multiple of 90 degrees.
A----1---------2--B--------------3
4
The angles A-1, A-2, A-3, B-1, B-2, B-3 are all multiples of 90 degrees (being 0 or 180 degrees), but as soon as you add point 4, then even though point 4 is 90 degrees to point 1, it cannot be a multiple of 90 degrees to point A or B.
I am going to guess that your coordinates are intended to be integers.
So, what you do is find point2 - point1 = [9630, 4010, 11216] - [5360, 8850, 23962] = [4270, -4840, -12746] . Now find the gcd() of all of those values: gcd(gcd(4270,-4840),-12746) = 2. Then (point2-point1)/the_gcd = [2135, -2420, -6373]. This is your fundamental vector.
The points that are 0 or 180 degrees from each other and point1 and point2 are then point1 + k*[2135, -2420, -6373] for each integer k.
How far can we go? Well, ceil(point1./t) = [3 -3 -3] so you can go as small as k = -3 while still staying with positive coordinates.
5 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!