# General Discussion > General Developer Topics >  Math: how move a line in same direction?

## Cambalinho

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?

----------


## VictorN

See https://en.wikipedia.org/wiki/Translation_(geometry)

----------


## Cambalinho

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  :Frown: 
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):


```
//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   :Frown:

----------


## VictorN

> 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...  :Roll Eyes (Sarcastic): 




> or i din't get the Translation or something is wrong


What "Translation" do you mean?




> 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"?

----------


## Cambalinho

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?

----------


## VictorN

Well, "subtract 1 from" something is easy. The only questio is in *what direction* are you going to move your line!

----------


## Cambalinho

on line direction

----------


## Cambalinho

hello. did i miss something?

----------

