ObservableResearchModeData.MoveToAverageCenter(UnityEngine.Transform, UnityEngine.Vector3[], UnityEngine.Vector3, UnityEngine.Vector3)

Here are the examples of the csharp api ObservableResearchModeData.MoveToAverageCenter(UnityEngine.Transform, UnityEngine.Vector3[], UnityEngine.Vector3, UnityEngine.Vector3) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : ObservableResearchModeData.cs
License : MIT License
Project Creator : vbandi

private void HandlePointCloudUpdated(float[] c, float[] points)
    {
        Profiler.BeginSample(nameof(HandlePointCloudUpdated));
        
        // var c = _researchMode.GetCenterPoint();
        Vector3 center = new Vector3(c[0], c[1], c[2]);

        // var pointCloud = _researchMode.GetPointCloudBuffer();
        
        var size = points.Length / 3;
        var pointCloud = new Vector3[size];

        for (int i = 0; i < size; i++)
        {
            var xIndex = i * 3;
            pointCloud[i] = new Vector3(points[xIndex], points[xIndex + 1], points[xIndex + 2]);
        }
        
        PointCloud.OnNext((pointCloud, center));

        if (!(ClosestPoints.HasObservers || SurfaceNormal.HasObservers || SurfaceQuad.HasObservers))
            return;

        var closestPoints =
            GetClosestPoints(center, pointCloud, NumberOfClosesPointsForNormalCalculation);
            
        ClosestPoints.OnNext(closestPoints);

        if (!(SurfaceNormal.HasObservers || SurfaceQuad.HasObservers))
            return;

        var normal = CalculateNormal(center, closestPoints, MinTriangleSize);
        SurfaceNormal.OnNext((center, normal));

        if (!SurfaceQuad.HasObservers || PauseSurfaceQuadCalculation)
            return;

        var quad = SurfaceQuadFactory.Invoke();
        MoveToAverageCenter(quad, closestPoints, center, normal);
        SurfaceQuad.OnNext(quad);
        
        Profiler.EndSample();
    }