How can i get nodes in space?

1 view (last 30 days)
Mahmoud Sami
Mahmoud Sami on 19 Apr 2018
Edited: Mahmoud Sami on 27 Apr 2018
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 Comments
John D'Errico
John D'Errico on 27 Apr 2018
Ok. Those are two points in space. We got that. But what is orthogonal mode?
What "nodes" do you want to see?
Mahmoud Sami
Mahmoud Sami on 27 Apr 2018
That is the start and the end nodes the in between nodes can be generated random V=[5360 8850 23962;10000*rand(n-3,3); 9630 4010 11216];

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 27 Apr 2018
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 Comments
Walter Roberson
Walter Roberson on 27 Apr 2018
Is it correct that you want to minimize the number of turns?
Mahmoud Sami
Mahmoud Sami on 27 Apr 2018
Edited: Mahmoud Sami on 27 Apr 2018
Yes, the turn in my problem cost more (The 1 kg for elbow cost nearly double 1 kg of pipe)

Sign in to comment.

Categories

Find more on Interpolation in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!