Ejemplo n.º 1
0
        /// <summary> RunCommandPickPlane is a helper method for picking an existing surface to draw on </summary>
        /// <param name="mRhinoDoc"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        protected Result RunCommandPickPlane(RhinoDoc mRhinoDoc, RunMode mode)
        {
            //routine for picking an existing surface to draw on

            //please select a plane

            Rhino.DocObjects.ObjectType filter = Rhino.DocObjects.ObjectType.Surface;
            Rhino.DocObjects.ObjRef     objref = null;
            Rhino.Commands.Result       rc     = Rhino.Input.RhinoGet.GetOneObject("Select surface", false, filter, out objref);
            if (rc != Rhino.Commands.Result.Success || objref == null)
            {
                return(rc);
            }

            Rhino.Geometry.Surface refSrf = objref.Surface();
            refSrf.FrameAt(.5, .5, out plane1);

            Point3d  pOrigin = refSrf.PointAt(1, 1);
            Point3d  pY      = refSrf.PointAt(0.5, 1);
            Point3d  pX      = refSrf.PointAt(1, 0.75);
            Vector3d vX      = Rhino.Geometry.Point3d.Subtract(pX, pOrigin);
            Vector3d vY      = Rhino.Geometry.Point3d.Subtract(pY, pOrigin);

            plane1 = new Plane(pOrigin, vX, vY);

            Rhino.DocObjects.RhinoObject rhobj = objref.Object();
            rhobj.Select(false);

            mRhinoDoc.Objects.AddPoint(pOrigin);
            mRhinoDoc.Objects.AddPoint(pX);
            mRhinoDoc.Objects.AddPoint(pY);
            mRhinoDoc.Views.Redraw();

            return(Result.Success);
        }
Ejemplo n.º 2
0
 //initialize data
 //double w_interval;
 //public double UMin { get; private set; }
 //public double UMax { get; private set; }
 //public double VMin { get; private set; }
 //public double VMax { get; private set; }
 //public double WMin { get; private set; }
 //public double WMax { get; private set; }
 public SurfaceEnvironmentType(Surface srf, int x, int y, int z)
     : base(x, y, 1)
 {
     _srf = srf;
     //UMin = _box.Min.X;
     //UMax = _box.Max.X;
     //VMin = _box.Min.Y;
     //VMax = _box.Max.Y;
        // WMin = _box.Min.Z;
     //WMax = _box.Max.Z;
     uv_positions = new Point3d[u,v,1];
     u_interval = _srf.Domain(0).Length / u;
     v_interval = _srf.Domain(1).Length / v;
     //w_interval = (WMax - WMin) / w;
     trail = new float[u, v, 1];
     temptrail = new float[u, v, 1];
     particle_ids = new int[u, v, 1];
     griddata = new int[u, v, 1];
     agedata = new int[u, v, 1];
     grid_age = 0;
     for (int i = 0; i < u; i++)
     {
         for (int j = 0; j < v; j++)
         {
             //for (int k = 0; k < w; k++)
             //{
                 uv_positions[i, j, 0] = _srf.PointAt(i * u_interval + u_interval / 2, j * v_interval + v_interval / 2);
                 trail[i, j, 0] = 0;
                 temptrail[i, j, 0] = 0;
                 particle_ids[i, j, 0] = -2;
                 griddata[i, j, 0] = 2;
                 agedata[i, j, 0] = 0;
             //}
         }
     }
     projectvalue = 5;
     diffdamp = 0.1F;
     age_flag = false;
     _escape_p = 0;
     env_type = 2;
 }