Exemplo n.º 1
0
        /// <summary>
        /// Attempts to copy the contents of a Rhino.Geometry.Arc to a RMA.OpenNURBS.OnArc.
        /// </summary>
        /// <param name="source">A source arc.</param>
        /// <param name="destination">A destination OnArc.</param>
        /// <returns>true if the operation succeeded; false otherwise.</returns>
        public static bool TryCopyToOnArc(Rhino.Geometry.Arc source, object destination)
        {
            bool   rc  = false;
            IntPtr ptr = GetInternalPointer(destination, "RMA.OpenNURBS.OnArc");

            if (IntPtr.Zero != ptr)
            {
                UnsafeNativeMethods.ON_Arc_Copy(ptr, ref source, false);
                rc = true;
            }
            return(rc);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Attempts to copy the contents of a RMA.OpenNURBS.OnArc to a Rhino.Geometry.Arc.
        /// </summary>
        /// <param name="source">A source OnArc.</param>
        /// <param name="destination">A destination arc.</param>
        /// <returns>true if the operation succeeded; false otherwise.</returns>
        public static bool TryCopyFromOnArc(object source, out Rhino.Geometry.Arc destination)
        {
            destination = new Rhino.Geometry.Arc();
            bool   rc  = false;
            IntPtr ptr = GetInternalPointer(source, "RMA.OpenNURBS.OnArc");

            if (IntPtr.Zero != ptr)
            {
                UnsafeNativeMethods.ON_Arc_Copy(ptr, ref destination, true);
                rc = true;
            }
            return(rc);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create Rhino open ArcCurve from Edge(Arc).
        /// </summary>
        public static Rhino.Geometry.ArcCurve ToRhinoArcCurve(Geometry.Edge obj)
        {
            if (obj.Points.Count == 3)
            {
                Rhino.Geometry.Arc arc = new Rhino.Geometry.Arc(obj.Points[0].ToRhino(), obj.Points[1].ToRhino(), obj.Points[2].ToRhino());
                return(new Rhino.Geometry.ArcCurve(arc));
            }

            else
            {
                Rhino.Geometry.Interval interval = new Rhino.Geometry.Interval(obj.StartAngle, obj.EndAngle);
                Rhino.Geometry.Plane    plane    = new Rhino.Geometry.Plane(obj.Points[0].ToRhino(), obj.XAxis.ToRhino(), obj.Normal.Cross(obj.XAxis).Normalize().ToRhino());
                Rhino.Geometry.Circle   circle   = new Rhino.Geometry.Circle(plane, obj.Radius);
                Rhino.Geometry.Arc      arc      = new Rhino.Geometry.Arc(circle, interval);
                return(new Rhino.Geometry.ArcCurve(arc));
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Attempts to copy the contents of a RMA.OpenNURBS.OnArc to a Rhino.Geometry.Arc.
 /// </summary>
 /// <param name="source">A source OnArc.</param>
 /// <param name="destination">A destination arc.</param>
 /// <returns>true if the operation succeeded; false otherwise.</returns>
 public static bool TryCopyFromOnArc(object source, out Rhino.Geometry.Arc destination)
 {
   destination = new Rhino.Geometry.Arc();
   bool rc = false;
   IntPtr ptr = GetInternalPointer(source, "RMA.OpenNURBS.OnArc");
   if (IntPtr.Zero != ptr)
   {
     UnsafeNativeMethods.ON_Arc_Copy(ptr, ref destination, true);
     rc = true;
   }
   return rc;
 }