public void AddVertexManipulable(IVertexManipulable vertexManipulable) { if (vertexManipulable != null) { m_VertexManipulables.Add(vertexManipulable); } }
void Denormalize(IVertexManipulable vm, Rect rect, Vector3 position, Quaternion rotation) { IRectManipulable rm = vm as IRectManipulable; if (rm == null) { return; } for (int i = 0; i < vm.GetManipulableVertexCount(); i++) { Vector3 v = rm.rectManipulatorData.normalizedVertices [i]; v = (rotation * (Vector3.Scale(v, (Vector3)rect.size) + (Vector3)rect.min)) + position; vm.SetManipulatedVertex(i, v); } }
void Normalize(IVertexManipulable vm, Rect rect, Vector3 position, Quaternion rotation) { IRectManipulable rm = vm as IRectManipulable; if (rm == null) { return; } rm.rectManipulatorData.normalizedVertices.Clear(); for (int i = 0; i < vm.GetManipulableVertexCount(); i++) { Vector3 v = vm.GetManipulableVertex(i); v = (Quaternion.Inverse(rotation) * (v - position)) - (Vector3)rect.min; v.x /= rect.width; v.y /= rect.height; rm.rectManipulatorData.normalizedVertices.Add(v); } }