/// <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 coodinates 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> public bool PickFrustumTest(Rhino.Geometry.Mesh mesh, MeshPickStyle pickStyle, out Rhino.Geometry.Point3d hitPoint, out Rhino.Geometry.Point2d hitSurfaceUV, out Rhino.Geometry.Point2d hitTextureCoordinate, out double depth, out double distance, out MeshHitFlag hitFlag, out int hitIndex) { hitPoint = Rhino.Geometry.Point3d.Unset; hitSurfaceUV = Rhino.Geometry.Point2d.Unset; hitTextureCoordinate = Rhino.Geometry.Point2d.Unset; depth = -1; distance = -1; hitIndex = -1; IntPtr pConstThis = ConstPointer(); IntPtr pConstMesh = mesh.ConstPointer(); int vef_flag = -1; bool rc = UnsafeNativeMethods.CRhinoPickContext_PickMesh(pConstThis, pConstMesh, (int)pickStyle, ref hitPoint, ref hitSurfaceUV, ref hitTextureCoordinate, ref depth, ref distance, ref vef_flag, ref hitIndex); hitFlag = (MeshHitFlag)vef_flag; 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="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 double depth, out double distance, out MeshHitFlag hitFlag, out int hitIndex) { hitPoint = Geometry.Point3d.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_PickMesh2(const_ptr_this, const_ptr_mesh, (int)pickStyle, ref hitPoint, ref depth, ref distance, ref vef_flag, ref hitIndex); hitFlag = (MeshHitFlag)vef_flag; 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="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> public bool PickFrustumTest(Rhino.Geometry.Mesh mesh, MeshPickStyle pickStyle, out Rhino.Geometry.Point3d hitPoint, out double depth, out double distance, out MeshHitFlag hitFlag, out int hitIndex) { hitPoint = Rhino.Geometry.Point3d.Unset; depth = -1; distance = -1; hitIndex = -1; IntPtr pConstThis = ConstPointer(); IntPtr pConstMesh = mesh.ConstPointer(); int vef_flag = -1; bool rc = UnsafeNativeMethods.CRhinoPickContext_PickMesh2(pConstThis, pConstMesh, (int)pickStyle, ref hitPoint, ref depth, ref distance, ref vef_flag, ref hitIndex); hitFlag = (MeshHitFlag)vef_flag; return rc; }