/// <summary> /// Fast test to check if a bounding box intersects a pick frustum. /// </summary> /// <param name="box"></param> /// <param name="boxCompletelyInFrustum"> /// Set to true if the box is completely contained in the pick frustum. /// When doing a window or crossing pick, you can immediately return a /// hit if the object's bounding box is completely inside of the pick frustum. /// </param> /// <returns> /// False if bounding box is invalid or box does not intersect the pick frustum /// </returns> /// <since>5.0</since> public bool PickFrustumTest(Geometry.BoundingBox box, out bool boxCompletelyInFrustum) { boxCompletelyInFrustum = false; IntPtr const_ptr_this = ConstPointer(); return(UnsafeNativeMethods.CRhinoPickContext_PickBox(const_ptr_this, ref box, ref boxCompletelyInFrustum)); }
public void SetPoints(IEnumerable <Geometry.Point3d> points, System.Drawing.Color blendColor) { m_order = new LinkedList <DirectedOrder>(); var _points = new List <Geometry.Point3d>(points); m_points = _points.ToArray(); m_colors_argb = new int[] { blendColor.ToArgb() }; m_bbox = new Geometry.BoundingBox(m_points); }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <param name="soleProviderId">the sole provider to call.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId) { Geometry.Point3d min = new Geometry.Point3d(); Geometry.Point3d max = new Geometry.Point3d(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBoxSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId, ref min, ref max)) { Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); return(bb); } return(new Geometry.BoundingBox()); }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType) { Rhino.Geometry.Point3d min = new Geometry.Point3d(); Rhino.Geometry.Point3d max = new Geometry.Point3d(); Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBox(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max)) { bb.Min = min; bb.Max = max; } return(bb); }
static int OnBBox(int serialNumber, IntPtr pViewport, IntPtr pObject, Guid plugInId, int type, ref Geometry.Point3d min, ref Geometry.Point3d max) { try { Provider p = Provider.FromSerialNumber(serialNumber); if (p != null) { Geometry.BoundingBox bbox = p.BoundingBox(new Rhino.DocObjects.ViewportInfo(pViewport), DocObjects.RhinoObject.CreateRhinoObjectHelper(pObject), plugInId, (MeshTypes)type); min = bbox.Min; max = bbox.Max; return(1); } } catch (Exception ex) { Rhino.Runtime.HostUtils.ExceptionReport(ex); } return(0); }
public void SetPoints(IEnumerable <Rhino.Geometry.Point3d> points, IEnumerable <System.Drawing.Color> colors) { var _points = new List <Geometry.Point3d>(points); var _colors = new List <System.Drawing.Color>(colors); if (_points.Count != _colors.Count) { throw new ArgumentException("length of points must be the same as length of colors"); } m_order = new LinkedList <DirectedOrder>(); m_points = _points.ToArray(); m_colors_argb = new int[_colors.Count]; for (int i = 0; i < _colors.Count; i++) { m_colors_argb[i] = _colors[i].ToArgb(); } m_bbox = new Geometry.BoundingBox(m_points); }
private static void ExtendBoundingBoxForDocumentAnimation(int serial, uint pDoc_serial, IntPtr pArchive_start, IntPtr pArchive_stop, ref Geometry.BoundingBox bbox) { var client = FromSerialNumber(serial); if (client != null) { RhinoDoc doc = RhinoDoc.FromRuntimeSerialNumber(pDoc_serial); BinaryArchiveReader archive_start = new BinaryArchiveReader(pArchive_start); BinaryArchiveReader archive_stop = new BinaryArchiveReader(pArchive_stop); client.ExtendBoundingBoxForDocumentAnimation(doc, archive_start, archive_stop, ref bbox); } }
private static void ExtendBoundingBoxForObjectAnimation(int serial, uint pDoc_serial, uint obj_serial, ref Geometry.Transform transform, IntPtr pArchive_start, IntPtr pArchive_stop, ref Geometry.BoundingBox bbox) { var client = FromSerialNumber(serial); if (client != null) { RhinoDoc doc = RhinoDoc.FromRuntimeSerialNumber(pDoc_serial); Rhino.DocObjects.RhinoObject obj = new DocObjects.RhinoObject(obj_serial); BinaryArchiveReader archive_start = new BinaryArchiveReader(pArchive_start); BinaryArchiveReader archive_stop = new BinaryArchiveReader(pArchive_stop); client.ExtendBoundingBoxForObjectAnimation(doc, obj, ref transform, archive_start, archive_stop, ref bbox); } }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType) { Rhino.Geometry.Point3d min = new Geometry.Point3d(); Rhino.Geometry.Point3d max = new Geometry.Point3d(); Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBox(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max)) { bb.Min = min; bb.Max = max; } return bb; }
/// <summary> /// Returns a bounding box for the custom render meshes for the given object. /// </summary> /// <param name="vp"> the viewport being rendered.</param> /// <param name="obj">Rhino object of interest.</param> /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param> /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param> /// <param name="soleProviderId">the sole provider to call.</param> /// <returns>ON_BoundingBox for the meshes.</returns> public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId) { Geometry.Point3d min = new Geometry.Point3d(); Geometry.Point3d max = new Geometry.Point3d(); if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBoxSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId, ref min, ref max)) { Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox(); return bb; } return new Geometry.BoundingBox(); }