/// <since>5.0</since> public Geometry.Point2d ClientToScreen(Geometry.Point2d clientPoint) { System.Drawing.Rectangle screen = ScreenRectangle; double x = clientPoint.X + screen.Left; double y = clientPoint.Y + screen.Top; return(new Geometry.Point2d(x, y)); }
/// <since>5.8</since> public Geometry.Point2d ScreenToClient(Geometry.Point2d screenPoint) { System.Drawing.Rectangle screen = ScreenRectangle; double x = screenPoint.X - screen.Left; double y = screenPoint.Y - screen.Top; return(new Geometry.Point2d(x, y)); }
/// <summary> /// Creates a detail view object that is displayed on this page and adds it to the doc. /// </summary> /// <param name="title">The detail view title.</param> /// <param name="corner0">Corners of the detail view in world coordinates.</param> /// <param name="corner1">Corners of the detail view in world coordinates.</param> /// <param name="initialProjection">The defined initial projection type.</param> /// <returns>Newly created detail view on success. null on error.</returns> /// <example> /// <code source='examples\vbnet\ex_addlayout.vb' lang='vbnet'/> /// <code source='examples\cs\ex_addlayout.cs' lang='cs'/> /// <code source='examples\py\ex_addlayout.py' lang='py'/> /// </example> public DetailViewObject AddDetailView(string title, Geometry.Point2d corner0, Geometry.Point2d corner1, DefinedViewportProjection initialProjection) { IntPtr ptr_detail = UnsafeNativeMethods.CRhinoPageView_AddDetailView(RuntimeSerialNumber, corner0, corner1, title, (int)initialProjection); DetailViewObject rc = null; if (ptr_detail != IntPtr.Zero) { uint sn = UnsafeNativeMethods.CRhinoObject_RuntimeSN(ptr_detail); rc = new DetailViewObject(sn); } return(rc); }
/// <summary>Utility for picking meshes</summary> /// <param name="mesh">mesh to test</param> /// <param name="pickStyle">mode used for pick test</param> /// <param name="hitPoint">location returned here for point picks</param> /// <param name="hitSurfaceUV"> /// If the mesh has surface parameters, set to the surface parameters of the hit point /// </param> /// <param name="hitTextureCoordinate"> /// If the mesh has texture coordinates, set to the texture coordinate of the hit /// point. Note that the texture coordinates can be set in many different ways /// and this information is useless unless you know how the texture coordinates /// are set on this particular mesh. /// </param> /// <param name="depth"> /// depth returned here for point picks /// LARGER values are NEARER to the camera. /// SMALLER values are FARTHER from the camera. /// </param> /// <param name="distance"> /// planar distance returned here for point picks. /// SMALLER values are CLOSER to the pick point /// </param> /// <param name="hitFlag"> /// For point picks, How to interpret the hitIndex (vertex hit, edge hit, or face hit) /// </param> /// <param name="hitIndex"> /// index of vertex/edge/face that was hit. Use hitFlag to determine what this index /// corresponds to /// </param> /// <returns></returns> /// <since>5.0</since> public bool PickFrustumTest(Geometry.Mesh mesh, MeshPickStyle pickStyle, out Geometry.Point3d hitPoint, out Geometry.Point2d hitSurfaceUV, out Geometry.Point2d hitTextureCoordinate, out double depth, out double distance, out MeshHitFlag hitFlag, out int hitIndex) { hitPoint = Geometry.Point3d.Unset; hitSurfaceUV = Geometry.Point2d.Unset; hitTextureCoordinate = Geometry.Point2d.Unset; depth = -1; distance = -1; hitIndex = -1; IntPtr const_ptr_this = ConstPointer(); IntPtr const_ptr_mesh = mesh.ConstPointer(); int vef_flag = -1; bool rc = UnsafeNativeMethods.CRhinoPickContext_PickMesh(const_ptr_this, const_ptr_mesh, (int)pickStyle, ref hitPoint, ref hitSurfaceUV, ref hitTextureCoordinate, ref depth, ref distance, ref vef_flag, ref hitIndex); hitFlag = (MeshHitFlag)vef_flag; return(rc); }