IntPtr m_ptr; //CArgsRhinoSweep1* public static ArgsSweep1 Construct(Curve rail, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParameters, Vector3d roadlike_up, bool closed, double sweep_tol, double angle_tol, int miter_type) { ArgsSweep1 rc = new ArgsSweep1(); List <Curve> xsec = new List <Curve>(crossSections); List <double> xsec_t = new List <double>(crossSectionParameters); if (xsec.Count < 1) { throw new ArgumentException("must have at least one cross section"); } if (xsec.Count != xsec_t.Count) { throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters"); } IntPtr pConstRail = rail.ConstPointer(); Runtime.InteropWrappers.SimpleArrayCurvePointer sections = new Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections); IntPtr pSections = sections.ConstPointer(); double[] tvals = xsec_t.ToArray(); rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep1_New(pConstRail, pSections, tvals, roadlike_up, closed, sweep_tol, angle_tol, miter_type); sections.Dispose(); return(rc); }
/// <since>5.0</since> public Brep[] PerformSweep(Curve rail, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParameters) { List <Curve> sections = new List <Curve>(crossSections); List <double> parameters = new List <double>(crossSectionParameters); if (sections.Count > 1 && sections.Count == parameters.Count) { Curve[] crvs = sections.ToArray(); double[] par = parameters.ToArray(); Array.Sort(par, crvs); crossSections = crvs; crossSectionParameters = par; } ArgsSweep1 sweep = ArgsSweep1.Construct(rail, crossSections, crossSectionParameters, m_roadlike_up, m_bClosed, m_sweep_tol, m_angle_tol, m_miter_type); Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer(); IntPtr pArgsSweep1 = sweep.NonConstPointer(); IntPtr pBreps = breps.NonConstPointer(); UnsafeNativeMethods.RHC_Sweep1(pArgsSweep1, pBreps, m_shape_blending); Brep[] rc = breps.ToNonConstArray(); sweep.Dispose(); breps.Dispose(); return(rc); }
/// <since>5.0</since> public Brep[] PerformSweepRebuild(Curve rail, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParameters, int rebuildCount) { ArgsSweep1 sweep = ArgsSweep1.Construct(rail, crossSections, crossSectionParameters, m_roadlike_up, m_bClosed, m_sweep_tol, m_angle_tol, m_miter_type); Runtime.InteropWrappers.SimpleArrayBrepPointer breps = new Rhino.Runtime.InteropWrappers.SimpleArrayBrepPointer(); IntPtr pArgsSweep1 = sweep.NonConstPointer(); IntPtr pBreps = breps.NonConstPointer(); UnsafeNativeMethods.RHC_Sweep1Rebuild(pArgsSweep1, pBreps, rebuildCount, m_shape_blending); Brep[] rc = breps.ToNonConstArray(); sweep.Dispose(); breps.Dispose(); return(rc); }
IntPtr m_ptr; //CArgsRhinoSweep1* public static ArgsSweep1 Construct(Curve rail, IEnumerable<Curve> crossSections, IEnumerable<double> crossSectionParameters, Vector3d roadlike_up, bool closed, double sweep_tol, double angle_tol, int miter_type) { ArgsSweep1 rc = new ArgsSweep1(); List<Curve> xsec = new List<Curve>(crossSections); List<double> xsec_t = new List<double>(crossSectionParameters); if (xsec.Count < 1) throw new ArgumentException("must have at least one cross section"); if (xsec.Count != xsec_t.Count) throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters"); IntPtr pConstRail = rail.ConstPointer(); Runtime.InteropWrappers.SimpleArrayCurvePointer sections = new Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections); IntPtr pSections = sections.ConstPointer(); double[] tvals = xsec_t.ToArray(); rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep1_New(pConstRail, pSections, tvals, roadlike_up, closed, sweep_tol, angle_tol, miter_type); sections.Dispose(); return rc; }