
November 5th, 2022, 01:21 PM
#1
Math: how move a line in same direction?
heres a line:
Origin:
X0 = 0
Y0 = 0
Z0 = 0
Destination:
X1 = 100
Y1 = 0
Z1 = 500
using the same direction, how can i move a line using Math?

November 6th, 2022, 02:13 AM
#2
Re: Math: how move a line in same direction?
Victor Nijegorodov

November 13th, 2022, 03:10 PM
#3
Re: Math: how move a line in same direction?
Victor i don't get notifications... can you see it please? is maybe because i'm login even not be here?
i use the Hotmail mail.
or i din't get the Translation or something is wrong
what i mean is that i only need move the line in same direction, like just i line dot.
i found 1 way(always with float types):
1  calculate the line distance;
2  calculate the X and Y distance;
3  divide the XDistance with LineDistance and the same for YDistance for get the XSteps and YSteps;
4  now i can add\sub the Steps for the next\previous line dot and with same orientation\angle:
Move line back(same can be done on Z):
Code:
//Getting Line Distance(float results):
float DX = abs(X1  X0);
float DY = abs(Y1  Y0);
float DZ = abs(Z1  Z0);
float LineDistance =abs( sqrt(pow(DX,2) + pow(DY,2) + pow(DZ,2)));
//Getting the Steps incrementation(float results):
float XSteps = DX/LineDistance;
float YSteps = DY/LineDistance;
float ZSteps = DZ/LineDistance;
float NewX0 = X0  XSteps;
float NewY0 = Y0  YSteps;
float NewZ0 = Z0  ZSteps;
float NewX1 = X1  XSteps;
float NewY1 = Y1  YSteps;
float NewZ1 = Z1  ZSteps;
for move front we add the steps.
but sometimes i fail on calculations... and i fail much more in using the 'int' instead 'float' on calculations
Last edited by Cambalinho; November 13th, 2022 at 03:13 PM.

November 14th, 2022, 04:19 AM
#4
Re: Math: how move a line in same direction?
Originally Posted by Cambalinho
Victor i don't get notifications...
Yes, it is a new bug in the forum's engine. The Admin promised that this bug will be fixed in some weeks...
Originally Posted by Cambalinho
or i din't get the Translation or something is wrong
What "Translation" do you mean?
Originally Posted by Cambalinho
what i mean is that i only need move the line in same direction, like just i line dot.
...
What do you mean by the "same direction"?
Victor Nijegorodov

November 14th, 2022, 03:12 PM
#5
Re: Math: how move a line in same direction?
see these line with origin and destinity: LineSteps line(0,200,0,400,200,500);
now i need move the line... how can i subtract 1 from (0,200,0), but continue with same line size or (400,200,500) minus 1?

November 14th, 2022, 04:48 PM
#6
Re: Math: how move a line in same direction?
Well, "subtract 1 from" something is easy. The only questio is in what direction are you going to move your line!
Victor Nijegorodov

November 14th, 2022, 05:10 PM
#7
Re: Math: how move a line in same direction?

November 16th, 2022, 04:47 AM
#8
Re: Math: how move a line in same direction?
hello. did i miss something?
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
