static void _ResetEyes() { _KinectToMonitor(xLeftEye, yLeftEye, zLeftEye, out xLeftEyeInMonitor, out yLeftEyeInMonitor, out zLeftEyeInMonitor); Graph3d.setlefteye(xLeftEyeInMonitor, yLeftEyeInMonitor, zLeftEyeInMonitor); double EyesDistance = 65 / PixelLength; _KinectToMonitor( (int)(xLeftEye + x12 * EyesDistance), (int)(yLeftEye + y12 * EyesDistance), (int)(zLeftEye + z12 * EyesDistance) , out xRightEyeInMonitor, out yRightEyeInMonitor, out zRightEyeInMonitor); Graph3d.setrighteye(xRightEyeInMonitor, yRightEyeInMonitor, zRightEyeInMonitor); }
/// <summary> /// This procedure contains the user code. Input parameters are provided as regular arguments, /// Output parameters as ref arguments. You don't have to assign output parameters, /// they will have a default value. /// </summary> private void RunScript(object x, object y, ref object A) { { var AnntennGraph = new Graph3d((u,v) => {return new Point3d(u, v, u * u - v * v);}); AnntennGraph.BakeSurface(RhinoDocument, 100, 100); } { var AnntennGraph = new Graph3d((u,v) => {return new Point3d(u, v, u * u * u + v * v);}); var surf2 = AnntennGraph.GetSurface(100, 100); surf2.Translate(2, 0, 0); RhinoDocument.Objects.Add(surf2); } }
static public bool initfinger(int MaxX, int MaxY, bool FullScreen, int smoothFactor = 2) { int Xres = 1, Yres = 0; Smooth = smoothFactor; fingerLocation = new int[smoothFactor + 1, 3]; noseLocation = new int[20, 6]; Console.WriteLine("Put the Xbox Kinect in your left side..."); Console.WriteLine("If you entered Monitor's screen coordinates already press ENTER to load them!"); Console.Write("But if not, enter your monitor size in inch : "); bool loaded = false; try { MonitorInch = Convert.ToInt32(Console.ReadLine()); } catch { if (ReadMonitorFromFile()) { loaded = true; } else { Console.WriteLine("Monitor coordinates have not been saved!"); bool get = true; do { Console.Write("Enter your monitor size in inch : "); try { MonitorInch = Convert.ToInt32(Console.ReadLine()); get = false; } catch { Console.WriteLine("You should enter a number in inch!"); } } while (get); } } if (!loaded) { try { Console.Write("Enter current X resolution of your monitor : "); Xres = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter current Y resolution of your monitor : "); Yres = Convert.ToInt32(Console.ReadLine()); } catch { Console.WriteLine("Wrong number!"); Console.ReadKey(); Graph.closegraph(); } } if (FullScreen) { Graph.fullscreen(); } Graph.initgraph(MaxX, MaxY); if (!loaded) { double d = Math.Sqrt(Xres * 1.0 * Xres + Yres * 1.0 * Yres); PixelLength = (MonitorInch * 25.4) / d; if (FullScreen) { double xPixel, yPixel; if (MaxX * Yres < Xres * MaxY) { xPixel = MaxX * Yres / MaxY; yPixel = Yres; } else { xPixel = Xres; yPixel = Xres * MaxY / MaxX; } PixelLength *= Math.Sqrt( (xPixel * 1.0 * xPixel + yPixel * 1.0 * yPixel) / (MaxX * 1.0 * MaxX + MaxY * 1.0 * MaxY)); } } EnableSmoothSetting(100, 0, 100, 0, 0); initkinect(ColorFormat.Rgb640x480Fps30, DepthFormat.R640x480Fps30); Graph3d.mouseCursor = new Bitmap(GraphKinect.Properties.Resources.hand1); Graph3d.initmouse(); Graph3d.getmouse = new GetMouse3D(getfinger); return(KinectCalibration()); }