public void ComputeCoordinatesEuclidean(Node parentNode) { /* * if (parentNode.nodeNumDecendents == 0) * { * return; * } * else * { * Matrix4x4 translationMatrix = Matrix4x4.Translate(new Vector3(HyperbolicMath.euclideanDistance(parentNode.nodeHemsphereRadius) + parentNode.nodeEuclideanPosition.x, parentNode.nodeEuclideanPosition.y, parentNode.nodeEuclideanPosition.z)); * foreach (Node child in parentNode.nodeChildren) * { * Vector3 childCoord = Point4d.projectAndGetVect3(child.nodeRelativeHyperbolicProjectionPosition); * childCoord = translationMatrix.MultiplyPoint(childCoord); * * Quaternion rotation = Quaternion.Euler(child.nodeHemsphereTheta, 0.0f, child.nodeHemspherePhi); * // Set the translation, rotation and scale parameters. * //Matrix4x4 m = Matrix4x4.TRS(new Vector3(HyperbolicMath.euclideanDistance(parentNode.nodeHemsphereRadius) + parentNode.nodeEuclideanPosition.x, parentNode.nodeEuclideanPosition.y, parentNode.nodeEuclideanPosition.z), rotation, new Vector3(globalScaler, globalScaler, globalScaler)); * Matrix4x4 m = Matrix4x4.TRS(new Vector3(0.0f, 0.0f, 0.0f), rotation, new Vector3(globalScaler, globalScaler, globalScaler)); * Vector3 tempVect3 = m.MultiplyPoint3x4(childCoord); * child.nodeEuclideanPosition = new Point4d(tempVect3.x, tempVect3.y, tempVect3.z); * ComputeCoordinatesEuclidean(child); * } * } */ if (parentNode.nodeNumDecendents == 0) { return; } else { //Matrix4d rotationOfCoordinate = HyperbolicTransformation.buildCanonicalOrientationEuclidean(HyperbolicTransformation.ORIGIN4, parentNode.nodeEuclideanPosition); float parentPhi = Point4d.getPhiByPoint(parentNode.nodeEuclideanPosition); float parentTheta = Point4d.getThetaByPoint(parentNode.nodeEuclideanPosition); Debug.Log(parentNode.nodeEuclideanPosition.x + " " + parentNode.nodeEuclideanPosition.y + " " + parentNode.nodeEuclideanPosition.z); foreach (Node child in parentNode.nodeChildren) { Vector3 childCoord = Point4d.projectAndGetVect3(child.nodeRelativeHyperbolicProjectionPosition); //Matrix4x4 scaler = Matrix4x4.Scale(new Vector3(globalScaler, globalScaler, globalScaler)); //scaler.MultiplyPoint3x4(childCoord); //Debug.Log(rotationOfCoordinate.matrix4d); //rotationOfCoordinate.matrix4d.MultiplyPoint3x4(childCoord); //child.nodeHemsphereTheta / Mathf.PI * 180, 0.0f, child.nodeHemspherePhi / Mathf.PI * 180 //Quaternion rotation = Quaternion.Euler(parentNode.nodeHemsphereTheta / Mathf.PI * 180, parentNode.nodeHemspherePhi / Mathf.PI * 180, 0.0f); //Quaternion rotation = Quaternion.Euler(child.nodeHemsphereTheta + parentTheta, 0.0f, child.nodeHemspherePhi + parentPhi); //Quaternion rotation = Quaternion.Euler(parentPhi / Mathf.PI * 180, 0.0f, parentTheta / Mathf.PI * 180); float xAngRot; float yAngRot; if (parentNode.nodeParent == null) { xAngRot = Point4d.getRotAngleX(parentNode.nodeEuclideanPosition); yAngRot = Point4d.getRotAngleY(parentNode.nodeEuclideanPosition); } else { xAngRot = -Point4d.getRotAngleX(parentNode.nodeEuclideanPosition - parentNode.nodeParent.nodeEuclideanPosition); yAngRot = Point4d.getRotAngleY(parentNode.nodeEuclideanPosition - parentNode.nodeParent.nodeEuclideanPosition); } //xAngRot += Point4d.getRotAngleX(new Point4d(childCoord.x, childCoord.y, childCoord.z)); //yAngRot += Point4d.getRotAngleY(new Point4d(childCoord.x, childCoord.y, childCoord.z)); Quaternion rotation = Quaternion.Euler(xAngRot / Mathf.PI * 180, yAngRot / Mathf.PI * 180, 0.0f); //Matrix4x4 rotationMatrix = Matrix4x4.Rotate(rotation); //childCoord = rotationMatrix.MultiplyPoint(childCoord); //rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f); Matrix4x4 m = Matrix4x4.TRS(new Vector3(HyperbolicMath.euclideanDistance(parentNode.nodeHemsphereRadius) + parentNode.nodeEuclideanPosition.x, parentNode.nodeEuclideanPosition.y, parentNode.nodeEuclideanPosition.z), rotation, new Vector3(globalScaler, globalScaler, globalScaler)); //Matrix4x4 m = Matrix4x4.TRS(new Vector3(HyperbolicMath.euclideanDistance(parentNode.nodeHemsphereRadius) + parentNode.nodeEuclideanPosition.x, parentNode.nodeEuclideanPosition.y, parentNode.nodeEuclideanPosition.z), rotation, new Vector3(globalScaler, globalScaler, globalScaler)); childCoord = m.MultiplyPoint(childCoord); //rotation = Quaternion.Euler(parentTheta, 0.0f, parentPhi); Debug.Log(parentNode.nodeName + " " + child.nodeName + " " + (parentTheta / Mathf.PI * 180) + " " + (parentPhi / Mathf.PI * 180)); //m = Matrix4x4.Rotate(rotation); //childCoord = m.MultiplyPoint3x4(childCoord); child.nodeEuclideanPosition = new Point4d(childCoord.x, childCoord.y, childCoord.z); ComputeCoordinatesEuclidean(child); } } //ComputeCoordinatesEuclideanTest(parentNode, 0.0f, 0.0f); }