Пример #1
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)
        {
            IGH_Goo goo    = null;
            Bitmap  bitmap = new Bitmap(100, 100);

            if (!DA.GetData(0, ref goo))
            {
                return;
            }
            if (!goo.TryGetBitmap(ref bitmap))
            {
                return;
            }

            Corners corners = new Corners(bitmap);

            double threshold = 1.0;

            DA.GetData(2, ref threshold);
            corners.Threshold = (int)(threshold * 255.0);

            double valueModifier = 1.0;

            if (DA.GetData(3, ref valueModifier))
            {
                corners.Value = valueModifier;
            }

            int mode = 0;

            DA.GetData(1, ref mode);

            List <Point3d> points = new List <Point3d>();

            switch ((CornerModes)mode)
            {
            default:
                points = corners.GetSusanCorners();
                break;

            case CornerModes.Fast:
                points = corners.GetFastCorners();
                break;

            case CornerModes.Harris:
                points = corners.GetHarrisCorners();
                break;

            case CornerModes.Morvec:
                points = corners.GetMorvacCorners();
                break;
            }

            DA.SetDataList(0, points);
        }