问题
I create a simple 3D viewer with Helix toolkit.
I want to plot 3D points which is colored.
I referred to the sample project "SimpleDemo" which is contained in the Example
folder (HelixToolkit.Wpf.SharpDX
).
This is my XAML:
<hx:PointGeometryModel3D x:Name="points"
Geometry="{Binding Points}"
Transform="{Binding Model1Transform}"
Color="{x:Static sdx:Color.White}" />
And drawing core is below.
var points = new PointGeometry3D();
var col = new Color4Collection();
var ptPos = new Vector3Collection();
var ptIdx = new IntCollection();
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
if(depth[y * width + x] < 1000 && depth[y * width + x] > 0) {
ptIdx.Add(ptPos.Count);
ptPos.Add(new Vector3(x, height - y, (-depth[y * width + x] / 3.0f) + 800));
col.Add(rnd.NextColor().ToColor4());
}
}
}
points.Positions = ptPos;
points.Indices = ptIdx;
points.Colors = col;
Points = points;
This program, Some cases are good work.(ex. deal with 200 x 200 points). But other case are not good (ex. deal with 500 x 300 points)
It can draw 3D point which is not colored (black).
Why does it not work properly?
Comments:
- A good work image (colored):
- A not good work image (not colored):
来源:https://stackoverflow.com/questions/28334282/how-to-plot-3d-colored-points-with-helix-toolkit