# Get local position from absolute position

Hi!
I have polygon-triangle with 3 vericies (points 0-2). I have absilute position this verticies (points 0-2). I have local system coordinate i (vector point 0 → point 1), j (i * k), k (normal polygon) . How I can get local position point 2?

it’s work

``````def get_point_position_in_polygon(point_position, index_polygon, normal_polygon, obj_human=None):
if obj_human == None:
obj_human = get_human_obj()
polygon = obj_human.data.polygons[index_polygon]
vertices =  obj_human.data.vertices
vertice0 = vertices[polygon.vertices[0]].co
vertice1 = vertices[polygon.vertices[1]].co
vertice2 = vertices[polygon.vertices[2]].co
height, point_on_mesh = len_to_plain(vertice0, vertice1, vertice2, point_position)
len_0_1 = get_lenght_between_points(vertice0, vertice1)
len_0_2 = get_lenght_between_points(vertice0, vertice2)

vector_k = normal_polygon
vector_0_2 = [0, 0, 0]
vector_i = [0, 0, 0]
for i in range(3):
vector_i[i] = (vertice1[i] - vertice0[i]) / len_0_1
vector_0_2[i] = (vertice2[i] - vertice0[i])
vector_k = multiplication_2_vectors(vector_i, vector_0_2)
vector_j = multiplication_2_vectors(vector_k, vector_i)
len_vector_j = get_lenght_between_points([0, 0, 0], vector_j)
len_vector_k = get_lenght_between_points([0, 0, 0], vector_k)
for i in range(3):
vector_j[i] = vector_j[i] / len_vector_j
vector_k[i] = vector_k[i] / len_vector_k

matrix = np.array([[vector_i[0], vector_i[1], vector_i[2], 0],
[vector_j[0], vector_j[1], vector_j[2], 0],
[vector_k[0], vector_k[1], vector_k[2], 0],
[vertice0[0], vertice0[1], vertice0[2], 1]]).T
#matrix = np.array([[vector_i[0], vector_i[1], vector_i[2]],
#                    [vector_j[0], vector_j[1], vector_j[2]],
#                    [vector_k[0], vector_k[1], vector_k[2]]]).T
matrix_inverse = np.linalg.inv(matrix)
#print(matrix)
#print(matrix_inverse)

matrix_2 = vector_to_arr(vertice2)
matrix_2.append(1)
#matrix_2 = vector_0_2
matrix_point_on_mesh = vector_to_arr(point_on_mesh)
matrix_point_on_mesh.append(1)
#position_local_2 = np.dot(matrix_inverse, matrix_2)
position_local_2 = np.dot(matrix_inverse, matrix_2)
position_local_point = np.dot(matrix_inverse, matrix_point_on_mesh)
``````