到目前为止,我还是Helix的新手,我正在构建一个WPF应用程序,将Helix视口窗口加载到面板内,然后通过WPF中的创建按钮实例化多维数据集(CubedVisual3D),并创建立方体,但是当我单击或拖动/移动它时,它不会移动。我该怎么做呢?最好的方法? example image
private void Helix_ViewPort_MouseDown(object sender, MouseButtonEventArgs e)
{
Console.WriteLine("Mouse down.");
Point mousePos = e.GetPosition(MyViewPort);
PointHitTestParameters hitParams = new PointHitTestParameters(mousePos);
HitTestResult result = VisualTreeHelper.HitTest(MyViewPort, mousePos);
RayMeshGeometry3DHitTestResult rayMeshResult = result as
RayMeshGeometry3DHitTestResult;
if (rayMeshResult != null)
{
MeshGeometry3D mesh = new MeshGeometry3D(); mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex1]);
mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex2]);
mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex3]);
mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);
GeometryModel3D marker = new GeometryModel3D(mesh, new DiffuseMaterial(Brushes.Blue));
}
Console.WriteLine(result);
}
答案 0 :(得分:0)
请参阅操纵器演示。 helixtoolkit github源码下有很多演示。