Reputation: 1
I have a problem displaying a 3D pointcloud in my WPF application. I want to display the corner points of a 2x2x2 box, but my view stays empty and just the black background is shown.
I've compared my code to several examples, but I could not see any serious difference, e.g: How to plot 3D colored points with Helix toolkit or https://qiita.com/systeman/items/0e539e606def64ed6c3f and many more.
I've reduced the code to the minimal to eliminate as much sources of error as possible. So this is what's left, but still not working:
MainWindow.xaml.cs:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = this;
}
public PointGeometry3D Geometry
{
get
{
var vc = new Vector3Collection();
var id = new IntCollection();
vc.Add(new Vector3(0, 0, 0));
id.Add(0);
vc.Add(new Vector3(2, 0, 0));
id.Add(1);
vc.Add(new Vector3(0, 2, 0));
id.Add(2);
vc.Add(new Vector3(0, 0, 2));
id.Add(3);
vc.Add(new Vector3(2, 2, 0));
id.Add(4);
vc.Add(new Vector3(0, 2, 2));
id.Add(5);
vc.Add(new Vector3(2, 0, 2));
id.Add(6);
vc.Add(new Vector3(2, 2, 2));
id.Add(7);
var g = new PointGeometry3D() { Positions = vc, Indices = id };
return g;
}
}
}
MainWindow.xaml:
<hx:Viewport3DX>
<hx:Viewport3DX.Camera>
<hx:PerspectiveCamera Position="0,0,10" LookDirection="0,0,-1" UpDirection="0,1,0"/>
</hx:Viewport3DX.Camera>
<hx:AmbientLight3D/>
<hx:PointGeometryModel3D Geometry="{Binding Geometry}" Size="2 2" Color="Bisque"/>
</hx:Viewport3DX>
Can you help please?
Upvotes: 0
Views: 1695