I am looking for the most optimum way for the following: I need to draw a line in the Viewport in such a way that X coordinate (for both ends of the line) would be always constant and referring to the value defined by screen coordinates.
Y coordinate(for both points) should vary depending on the input 3D point.
I was thinking to use next routine:
Convert 3D World point to 2D Screen point
Modify X value of this screen point, keep Y coordinate
Convert modified point to 3D point in order to be used in Display.DrawLine()
Is it correct way maybe smth easier exists? Am i missing smth?
Dim loc As Drawing.Point = New Drawing.Point((My.Computer.Screen.Bounds.Width) / 2, (My.Computer.Screen.Bounds.Height) / 2)
Dim doc As RhinoDoc = RhinoDoc.ActiveDoc
Dim view As RhinoView = doc.Views.ActiveView
loc = view.ActiveViewport.ScreenToClient(loc)
Dim CoordLine As Line = view.ActiveViewport.ClientToWorld(loc)
Dim CoordWordFromScreen As Point3d = New Point3d(CoordLine.FromX, CoordLine.FromY, 0)
Dim view as RhinoView = doc.Views.ActiveView
If (Not IsNothing(view)) Then
Dim xform as Transform = view.ActiveViewport.GetTransform(CoordinateSystem.Screen, CoordinateSystem.World)
' TODO: transform objects...