X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Ftools%2FNodeTools.java;h=be778dc367b4bf2d4b0f332f6c5dfc1b6eae95e0;hb=refs%2Fchanges%2F28%2F3328%2F1;hp=458c4717a8ee5ccf75558ab2589f87d048e45738;hpb=f36217aeeb09c0c46f99886ee99772156ce9cfe6;p=simantics%2F3d.git diff --git a/org.simantics.g3d/src/org/simantics/g3d/tools/NodeTools.java b/org.simantics.g3d/src/org/simantics/g3d/tools/NodeTools.java index 458c4717..be778dc3 100644 --- a/org.simantics.g3d/src/org/simantics/g3d/tools/NodeTools.java +++ b/org.simantics.g3d/src/org/simantics/g3d/tools/NodeTools.java @@ -60,22 +60,22 @@ public class NodeTools { public static Vector3d getLocalPosition(IG3DNode node, Vector3d worldCoord) { - + IG3DNode parent = (IG3DNode)node.getParent(); - if (parent == null) {// this is a root node ( has no transformation) - return worldCoord; - } + if (parent == null) {// this is a root node ( has no transformation) + return worldCoord; + } - Vector3d local = getLocalPosition(parent,worldCoord); - local.sub(node.getPosition()); - - Quat4d q = new Quat4d(); - q.set(node.getOrientation()); - q.inverse(); - MathTools.rotate(q, local, local); - - return local; - } + Vector3d local = getLocalPosition(parent,worldCoord); + local.sub(node.getPosition()); + + Quat4d q = new Quat4d(); + q.set(node.getOrientation()); + q.inverse(); + MathTools.rotate(q, local, local); + + return local; + } public static Quat4d getLocalOrientation(IG3DNode node, Quat4d worldRot) {