Below is sample operator which shows how to convert window point of mouse position to 3D point in the view using ConvertCoordinate.
https://docs.techsoft3d.com/hps/latest/prog_guide/0301_core.html#layout
https://docs.techsoft3d.com/hps/latest/prog_guide/0302_coordinate_systems.html
namespace wpf_sandbox
{
class MyMarkerOperator : Operator
{
private SegmentKey markersegment;
public MyMarkerOperator() : base(MouseButtons.ButtonLeft(), new ModifierKeys())
{
}
public override string GetName()
{
return "WPF_MyMarkerOperator";
}
public override void OnViewAttached(View in_attached_view)
{
markersegment = in_attached_view.GetSegmentKey().Subsegment("Markers");
markersegment.GetMaterialMappingControl().SetMarkerColor(new RGBAColor(0, 1, 0));
markersegment.GetMarkerAttributeControl().SetSize(1);
markersegment.GetVisibilityControl().SetMarkers(true);
}
public override bool OnMouseMove(MouseState in_state)
{
HPS.KeyPath path = new KeyPath(in_state.GetEventPath());
WindowPoint winpoint = in_state.GetLocation();
HPS.Point point;
path.ConvertCoordinate(Coordinate.Space.Window,
winpoint, Coordinate.Space.Object, out point);
markersegment.InsertMarker(point);
GetAttachedView().Update();
return true;
}
}
}