IntPtr m_ptr; //CArgsRhinoSweep2* public static ArgsSweep2 Construct(Curve rail1, Curve rail2, IEnumerable <Curve> crossSections, IEnumerable <double> crossSectionParameters1, IEnumerable <double> crossSectionParameters2, bool closed, double sweep_tol, double angle_tol, bool maintain_height) { ArgsSweep2 rc = new ArgsSweep2(); List <Curve> xsec = new List <Curve>(crossSections); List <double> xsec_t1 = new List <double>(crossSectionParameters1); List <double> xsec_t2 = new List <double>(crossSectionParameters2); if (xsec.Count < 1) { throw new ArgumentException("must have at least one cross section"); } if (xsec.Count != xsec_t1.Count || xsec.Count != xsec_t2.Count) { throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters"); } IntPtr pConstRail1 = rail1.ConstPointer(); IntPtr pConstRail2 = rail2.ConstPointer(); using (var sections = new Pixel.Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections)) { IntPtr pSections = sections.ConstPointer(); double[] tvals1 = xsec_t1.ToArray(); double[] tvals2 = xsec_t2.ToArray(); rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep2_New(pConstRail1, pConstRail2, pSections, tvals1, tvals2, closed, sweep_tol, angle_tol, maintain_height); } 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 Pixel.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); }