Example #1
0
    // Update is called once per frame
    void Update()
    {
        StopWatch.Reset();
        StopWatch.Start();

        // update sensor position
        UpdateSensor(ref SensorField, ref SensorData);

        // update visible mesh vertices
        SubStopWatch.Reset();
        SubStopWatch.Start();
        List <bool> MeshGuide = MeshMan.UpdateVertices(SensorField);

        MeshDensity = MeshMan.Density;
        SubStopWatch.Stop();
        MeshManSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // project to non-occluded vertices
        SubStopWatch.Reset();
        SubStopWatch.Start();
        Oc = new Intersector.Occlusion(OcclusionObjSize, OcclusionObjDistance, SensorField.FOV);
        List <Intersector.PointValue <byte> > Updates =
            VertexInter.ProjectToVisible(SensorData, SensorField, Oc, Observer.ExtraData, MeshGuide);

        SubStopWatch.Stop();
        IntersectSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // update voxel grid
        SubStopWatch.Reset();
        SubStopWatch.Start();
        VoxGridMan.Set(Updates, UpdateVoxStruct);
        SubStopWatch.Stop();
        VoxGridManSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // visualize data
        SubStopWatch.Reset();
        SubStopWatch.Start();
        // render spheres
        if (RenderVerts)
        {
            VertMarkers = Visualizer.CreateMarkers(Updates,
                                                   VertexMarkerSize, 0, 255, MinColor, MaxColor);
            VertVis.Visualize(VertMarkers);
        }
        // color mesh
        if (ColoredMesh)
        {
            Visualizer.ColorMesh(Observer.SurfaceObjects, Observer.ExtraData, MeshGuide,
                                 VoxGridMan, MinColor, MaxColor, 0, 255);
        }
        SubStopWatch.Stop();
        VertVisSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        StopWatch.Stop();
        DriverSpeed = StopWatch.ElapsedTicks / (double)Stopwatch.Frequency;
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        StopWatch.Reset();
        StopWatch.Start();

        // update sensor position
        UpdateSensor();

        // update visible mesh vertices
        SubStopWatch.Reset();
        SubStopWatch.Start();
        List <bool> MeshGuide = MeshMan.UpdateVertices(SensorField);

        MeshDensity = MeshMan.Density;
        SubStopWatch.Stop();
        MeshManSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // project to non-occluded vertices
        SubStopWatch.Reset();
        SubStopWatch.Start();
        Oc = new Intersector.Occlusion(OcclusionObjSize, OcclusionObjDistance, SensorField.FOV);
        List <Intersector.PointValue <byte> > Updates =
            VertexInter.ProjectToVisible(SensorData, SensorField, SensorDataHeight, SensorDataWidth,
                                         Oc, Observer.ExtraData, MeshGuide,
                                         Closest, Furthest, SensorField.Transform.position, SensorFOVReduction, ProximityConfig);

        SubStopWatch.Stop();
        IntersectSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // update voxel grid
        SubStopWatch.Reset();
        SubStopWatch.Start();
        if (VoxGridFilter == DataFilter.live)
        {
            VoxGridMan.Reset();        // reset if filtered to live data only
        }
        VoxGridMan.Set(Updates, true); // true: update voxel structure
        SubStopWatch.Stop();
        VoxGridManSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // visualize data
        SubStopWatch.Reset();
        SubStopWatch.Start();
        HandleVis(Updates, MeshGuide);
        SubStopWatch.Stop();
        VertVisSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        StopWatch.Stop();
        DriverSpeed = StopWatch.ElapsedTicks / (double)Stopwatch.Frequency;
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        StopWatch.Reset();
        StopWatch.Start();

        // call MeshManager to update
        SubStopWatch.Reset();
        SubStopWatch.Start();
        MeshMan.UpdateVertices(ref Vertices);
        SubStopWatch.Stop();
        MeshManSpeed = (double)SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // update VoxelGrid
        SubStopWatch.Reset();
        SubStopWatch.Start();
        VoxGridMan.Set(Vertices);
        SubStopWatch.Stop();
        VoxGridManSpeed = (double)SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        StopWatch.Stop();
        DriverSpeed = (double)StopWatch.ElapsedTicks / (double)Stopwatch.Frequency;
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        StopWatch.Reset();
        StopWatch.Start();

        // update sensor position
        UpdateSensor(ref SensorField, ref SensorData);

        // update visible mesh vertices
        SubStopWatch.Reset();
        SubStopWatch.Start();
        List <bool> MeshGuide = MeshMan.UpdateVertices(SensorField);

        MeshDensity = MeshMan.Density;
        SubStopWatch.Stop();
        MeshManSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // project to non-occluded vertices
        SubStopWatch.Reset();
        SubStopWatch.Start();
        Oc = new Intersector.Occlusion(OcclusionObjSize, OcclusionObjDistance, SensorField.FOV);
        List <Intersector.PointValue <byte> > Updates =
            VertexInter.ProjectToVisible(SensorData, SensorField, Oc, Observer.ExtraData, MeshGuide,
                                         Closest, Furthest, SensorField.Transform.position);

        SubStopWatch.Stop();
        IntersectSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // update voxel grid
        SubStopWatch.Reset();
        SubStopWatch.Start();
        // reset if filtered to live data only
        if (VoxGridFilter == DataFilter.live)
        {
            VoxGridMan.Reset();
        }
        VoxGridMan.Set(Updates, UpdateVoxStruct);
        SubStopWatch.Stop();
        VoxGridManSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

        // visualize data
        SubStopWatch.Reset();
        SubStopWatch.Start();
        content = new List <Visualizer.Content>();
        // render spheres
        if (RenderVerts)
        {
            if (VoxGridFilter == DataFilter.mesh || VoxGridFilter == DataFilter.live)
            {
                // render all non-occluded mesh vertices
                content.AddRange(Visualizer.CreateMarkers(Updates,
                                                          VertexMarkerSize, MinColorVal, MaxColorVal, MinColor, MaxColor));
            }
            else
            {
                // render all visible voxel vertices
                List <Voxel <byte> > curVoxels = VoxGridMan.Voxels();
                for (int i = 0; i < curVoxels.Count; i++)
                {
                    List <Intersector.PointValue <byte> > tmp = new List <Intersector.PointValue <byte> >();
                    tmp.Add(new Intersector.PointValue <byte>(curVoxels[i].point, curVoxels[i].value));
                    content.AddRange(Visualizer.CreateMarkers(tmp,
                                                              VertexMarkerSize, MinColorVal, MaxColorVal, MinColor, MaxColor));
                }
            }
        }
        // visualize voxels
        if (VoxVis)
        {
            for (int i = 0; i < Voxels.Count; i++)
            {
                if (BoundsRandNums[i] <= ShowFrac)
                {
                    Bounds voxBound = new Bounds();
                    voxBound.min = Voxels[i].min;
                    voxBound.max = Voxels[i].max;
                    if (VertexInter.AnyInView(MeshManager.IntersectionPoints(voxBound), SensorField))
                    {
                        content.AddRange(Visualizer.CreateBoundingLines(voxBound, BoundsLineWidth, BoundColors[i]));
                    }
                }
            }
        }
        // visualize mesh bounds
        if (MeshBoundsVis)
        {
            for (int i = 0; i < MeshBounds.Count; i++)
            {
                if (BoundsRandNums[i] <= ShowFrac &&
                    VertexInter.AnyInView(MeshManager.IntersectionPoints(MeshBounds[i]), SensorField))
                {
                    content.AddRange(Visualizer.CreateBoundingLines(MeshBounds[i], BoundsLineWidth, BoundColors[i]));
                }
            }
        }
        VertVis.Visualize(content);
        // color mesh
        if (ColoredMesh)
        {
            // color mesh by voxel grid value if Data Filter is not .all. If so, colored all 'no data'
            if (VoxGridFilter != DataFilter.all)
            {
                Visualizer.ColorMesh(Observer.SurfaceObjects, Observer.ExtraData, MeshGuide,
                                     VoxGridMan, MinColor, MaxColor, NoDataColor, MinColorVal, MaxColorVal);
            }
            else
            {
                Visualizer.ColorMesh(Observer.SurfaceObjects, Observer.ExtraData, MeshGuide,
                                     VoxGridMan, NoDataColor, NoDataColor, NoDataColor, MinColorVal, MaxColorVal);
            }
        }
        SubStopWatch.Stop();
        VertVisSpeed = SubStopWatch.ElapsedTicks / (double)Stopwatch.Frequency;



        StopWatch.Stop();
        DriverSpeed = StopWatch.ElapsedTicks / (double)Stopwatch.Frequency;
    }