KIIIA
12-13-2011, 10:14 PM
Hello,
i am currently working on a script where i need to place vertices on the straight line between two points.
The vertices need to be placed not only at the centerpoint, but at any position on this line i specify.
I tried lots of things, but i can only get it to work right with the center value strangely, which looks like this:
#Get Coordinate at between two coordinates according to a factor
def get_point_inbetween(self,obj_1_ws_coords, obj_2_ws_coords, summand ):
#Calculation
coord_x = (obj_1_ws_coords[0] + obj_2_ws_coords[0]) / 2 + summand
coord_y = (obj_1_ws_coords[1] + obj_2_ws_coords[1]) / 2 + summand
coord_z = (obj_1_ws_coords[2] + obj_2_ws_coords[2]) / 2 + summand
return [coord_x, coord_y, coord_z]
Only when summand is 0 it works properly.....but summand is ment to be a value letting me "slide" along the line!
Anybody an idea how to achieve the correct result?
i am currently working on a script where i need to place vertices on the straight line between two points.
The vertices need to be placed not only at the centerpoint, but at any position on this line i specify.
I tried lots of things, but i can only get it to work right with the center value strangely, which looks like this:
#Get Coordinate at between two coordinates according to a factor
def get_point_inbetween(self,obj_1_ws_coords, obj_2_ws_coords, summand ):
#Calculation
coord_x = (obj_1_ws_coords[0] + obj_2_ws_coords[0]) / 2 + summand
coord_y = (obj_1_ws_coords[1] + obj_2_ws_coords[1]) / 2 + summand
coord_z = (obj_1_ws_coords[2] + obj_2_ws_coords[2]) / 2 + summand
return [coord_x, coord_y, coord_z]
Only when summand is 0 it works properly.....but summand is ment to be a value letting me "slide" along the line!
Anybody an idea how to achieve the correct result?
