public void ApplyRotation(int axis) { string axisName; switch (axis) { case 0: axisName = "X"; rotationAngle = float.Parse(vectorInputFields[3].text); break; case 1: axisName = "Y"; rotationAngle = float.Parse(vectorInputFields[4].text); break; case 2: axisName = "Z"; rotationAngle = float.Parse(vectorInputFields[5].text); break; default: axisName = "NDF"; break; } if (currentPoint != null) { Instantiate(initPointPrefab, currentPoint.transform.position, Quaternion.identity); GameObject dummyPoint = Instantiate(trailPointPrefab, currentPoint.transform.position, Quaternion.identity); angleStep = rotationAngle / numSteps; for (int n = 0; n < numSteps && n * angleStep < Mathf.Abs(rotationAngle); n++) { LinearTrans.Rot3D(dummyPoint, axis, angleStep); Instantiate(trailPointPrefab, dummyPoint.transform.position, Quaternion.identity); } PopVectorUI(currentVectorElements, (Vector3)currentPoint.transform.position); transMat = LinearTrans.Rot3D(currentPoint, axis, rotationAngle); PopVectorUI(resultVectorElements, (Vector3)currentPoint.transform.position); PopMatrix(transMat, "Rot" + axisName + " " + rotationAngle + "º"); } else { Debug.Log("Select a valid Point!"); } }
public void ApplyMirror(int plane) { string planeName; GameObject planeObj; switch (plane) { case 0: planeName = "XY"; planeObj = Instantiate(planesPrefabs[0], Vector3.zero, Quaternion.identity); Destroy(planeObj, 6.0f); break; case 1: planeName = "XZ"; planeObj = Instantiate(planesPrefabs[1], Vector3.zero, Quaternion.identity); planeObj.transform.Rotate(new Vector3(90, 0, 0)); Destroy(planeObj, 6.0f); break; case 2: planeName = "YZ"; planeObj = Instantiate(planesPrefabs[2], Vector3.zero, Quaternion.identity); planeObj.transform.Rotate(new Vector3(0, 90, 0)); Destroy(planeObj, 6.0f); break; default: planeName = "NDF"; break; } if (currentPoint != null) { Instantiate(initPointPrefab, currentPoint.transform.position, Quaternion.identity); PopVectorUI(currentVectorElements, (Vector3)currentPoint.transform.position); transMat = LinearTrans.Mirror3D(currentPoint, plane); PopVectorUI(resultVectorElements, (Vector3)currentPoint.transform.position); PopMatrix(transMat, "Mirror " + planeName); } else { Debug.Log("Select a valid Point!"); } }