コード例 #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IField3d <double> f0 = null;
            IField3d <double> f1 = null;

            if (!DA.GetData(0, ref f0))
            {
                return;
            }
            if (!DA.GetData(1, ref f1))
            {
                return;
            }


            DA.SetData(0, FuncField3d.CreateUnion(f0, f1));

            /*
             * // We should now validate the data and warn the user if invalid data is supplied.
             *
             * if (turns <= 0)
             * {
             *  AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Spiral turn count must be bigger than or equal to one");
             *  return;
             * }
             *
             */
        }
コード例 #2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IField3d <double> f0 = null;
            IField3d <double> f1 = null;

            if (!DA.GetData(0, ref f0))
            {
                return;
            }
            if (!DA.GetData(1, ref f1))
            {
                return;
            }


            DA.SetData(0, FuncField3d.CreateIntersection(f0, f1));
        }
コード例 #3
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Mesh m = null;
            List <GH_GeometricGooWrapper> obj = new List <GH_GeometricGooWrapper>();
            double iso = 0d;
            double res = 0d;

            List <Point3d> pts  = new List <Point3d>();
            List <Curve>   crvs = new List <Curve>();


            if (!DA.GetData(0, ref m))
            {
                return;
            }
            if (!DA.GetDataList <GH_GeometricGooWrapper>(1, obj))
            {
                return;
            }
            if (!DA.GetData(2, ref iso))
            {
                return;
            }
            if (!DA.GetData(3, ref res))
            {
                return;
            }

            var hem   = m.ToHeMesh();
            var field = MeshField3d.Double.Create(hem);

            //cast objects to geometry types
            foreach (GH_GeometricGooWrapper g in obj)
            {
                if (g.TypeName == "{Point}")
                {
                    Point3d p = new Point3d();
                    g.CastTo <Point3d>(ref p);
                    pts.Add(p);
                }
                else if (g.TypeName == "{Curve}")
                {
                    Curve c = null;
                    g.CastTo <Curve>(ref c);
                    crvs.Add(c);
                }
                else
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input must be points or curves.");
                    return;
                }
            }

            //if curves are inputted, convert them into points
            Utility.ConvertCrvsToPts(crvs, ref pts, res);

            //get vector of each field pt to the closest point.
            List <double> val = Utility.GetDistanceField(m, pts);

            Interval interval = Utility.GetInterval(val);

            //

            for (int i = 0; i < val.Count; i++)
            {
                val[i] = (SpatialSlur.SlurCore.SlurMath.Remap(val[i], interval.T0, interval.T1, -1, 1)) - iso;
            }


            field.Set(val);
            DA.SetData(0, FuncField3d.Create(i => field.ValueAt(i)));
        }