# Convert point's coordinates to a new coordinate system

Hi,
How can I obtain point’s coordinates in a specific coordinate system ?
It seems pretty simple but I can’t find the node to do that.
Thank you

Hi @BCochin,

Here is a possible way with python and a custom node : Have you tried comparing the point to the coordinate system’s origin?

4 Likes

Thank you Alban,
This is not what I’m searching for.
I’m looking for a mathematical conversion of the point P coordinates from the general coordinate system (O, x, y, z) to any other coordinate system (A, i, j, k).

Thank you for this proposal. It’s close to what I’m looking for. But your solution works only if coordinate systems are parallel. I’m searching for the general solution.

I was expecting to find something already existing. I will try to code the node, if I can remember my math…

Ok, I made a custom node to do it.

pointRelativeCoordinate.dyf (63.9 KB)

If someone wants to convert it in python to make it faster, feel free … I will probably do it soon or later, but probably later…

1 Like

Here is the python version:

``````def det(M):
result = M*(M*M-M*M)-M*(M*M-M*M)+M*(M*M-M*M)
return result

ptP = IN
cs = IN

pI, pJ, pK = ptP.X, ptP.Y, ptP.Z
aI, aJ, aK = cs.Origin.X, cs.Origin.Y, cs.Origin.Z

vecAP=[pI-aI, pJ-aJ, pK-aK]
vecU=[cs.XAxis.X, cs.XAxis.Y, cs.XAxis.Z]
vecV=[cs.YAxis.X, cs.YAxis.Y, cs.YAxis.Z]
vecW=[cs.ZAxis.X, cs.ZAxis.Y, cs.ZAxis.Z]

M=[vecU, vecV, vecW]

M1=[vecAP, vecV, vecW]
M2=[vecU, vecAP, vecW]
M3=[vecU, vecV, vecAP]

pU=det(M1)/det(M)
pV=det(M2)/det(M)
pK=det(M3)/det(M)

OUT = [pU, pV, pK]
``````

pointRelativeCoordinatePython.dyf (17.2 KB)

1 Like

Glad you solved it. For cases where the CS is not parallel, you could actually use the override for the `Geometry.Transform` node, feeding the identity transform as the context:

Under the hood it would do similar math

Hi,
I am unable to open this file. An error message saying “Error opening corrupted file” appears.

Please guide me in rectifying this

Thank you

I am not able to find some of the nodes in dynamo such as ‘pointRelativeCoordinate’ and ‘displayCoordinatesystem’. Should I install any package for it? I am not able to open the .dyf file also as it gives a message that the file is corrupted.

Thank you

Hi,
.dyf files are custom nodes that you need to load in your own library. I haven’t build any package so you have to install them manually.
This is pretty simple :