public void readyPatch(int patchIndex) { ITimeDiffeomorphism patch = _surface.getPatches()[patchIndex]; float time = Time.time; Debug.Log(_centers.GetLength(1)); for (int i = 0; i < _centers.GetLength(1); ++i) { Vector2 uv_coord = _centers[patchIndex, i]; Vector3 image = patch.call(uv_coord, time); Vector3[] basis = new Vector3[2]; basis[0] = patch.uVelocity(uv_coord, time); basis[1] = patch.vVelocity(uv_coord, time); //TODO: make not ugly _vertices.Add(new Vector3(image.x + (_triangleLength * (Mathf.Sin(0) * basis[0].x + Mathf.Cos(0) * basis[1].x)), image.y + (_triangleLength * (Mathf.Sin(0) * basis[0].y + Mathf.Cos(0) * basis[1].y)), image.z + (_triangleLength * (Mathf.Sin(0) * basis[0].z + Mathf.Cos(0) * basis[1].z)))); _vertices.Add(new Vector3(image.x + (_triangleLength * (Mathf.Sin(2.0944f) * basis[0].x + Mathf.Cos(2.0944f) * basis[1].x)), image.y + (_triangleLength * (Mathf.Sin(2.0944f) * basis[0].y + Mathf.Cos(2.0944f) * basis[1].y)), image.z + (_triangleLength * (Mathf.Sin(2.0944f) * basis[0].z + Mathf.Cos(2.0944f) * basis[1].z)))); _vertices.Add(new Vector3(image.x + (_triangleLength * (Mathf.Sin(4.18879f) * basis[0].x + Mathf.Cos(4.18879f) * basis[1].x)), image.y + (_triangleLength * (Mathf.Sin(4.18879f) * basis[0].y + Mathf.Cos(4.18879f) * basis[1].y)), image.z + (_triangleLength * (Mathf.Sin(4.18879f) * basis[0].z + Mathf.Cos(4.18879f) * basis[1].z)))); for (int q = 0; q < 3; ++q) { _colors.Add(Color.red); } } }
public LinearSurfaceInterpolation(AbstractSurface m1, AbstractSurface m2) { ITimeDiffeomorphism[] _patches1 = m1.getPatches(); ITimeDiffeomorphism[] _patches2 = m1.getPatches(); _patches = new ITimeDiffeomorphism[] { new LinearInterpolationDiffeomorpism(_patches1[0], _patches2[0]) }; }
public AbstractSurface(ITimeDiffeomorphism patch) { _patches = new ITimeDiffeomorphism[] { patch }; }
public Vector2 randomPointOnUVPlane(ITimeDiffeomorphism patch) { float[] bounds = patch.getUVBounds(); return(new Vector2(Random.Range(bounds[0], bounds[1]), Random.Range(bounds[2], bounds[3]))); }
public LinearInterpolationDiffeomorpism(ITimeDiffeomorphism d1, ITimeDiffeomorphism d2) { _d1 = d1; _d2 = d2; }