简体   繁体   中英

Displaying multiple Point 3D s in Helix Tool Kit

I need to display multiple 3d points in a Helix View Port.

private void DisplayPointCloud(double[] datapoints)
    {

                newTime = stopwatch.Elapsed;
                foreach (double Datapoint in datapoints)
                {

                    Point3D temp = new Point3D(Random(), Random(), Datapoint);

            Dispatcher.Invoke(() =>
                    {
                        DataList.Add(temp);
                    });
                        
                }
       
        oldTime = newTime;
    }

I am displaying data in Helix Viewport in a separate thread. I need to show multiple datapoints in the UI without showing one by one which I'm doing right now. Main reason I need to do so is minimize the lag in UI Thread.

HelixToolkit have a good samples on github .

Regarind points.. you can use PointsVisual3D in your view and bind your source collection of Point3D to property Points.

<h:HelixViewport3D x:Name="ViewPort3D" InfiniteSpin="True" ShowFrameRate="True">
            <h:DefaultLights />
            <h:PointsVisual3D Points="{Binding Points3DCollection}" Color="Red" Size="6" />
        </h:HelixViewport3D>

Even if you will decide to populate Points3DCollection from different non UI thread - it will not solve issue with UI Thread. The root cause - Helix alway will repaint this collection after change camera position. Repaint performs in UI thread.

For increase responsive for rest of controls on your form - you can try create new thread for you HelixViewPort3D (see Dwayne Need article ), but it will not significant increase speed of repaint your 3D scene.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM