public GrayScanTask(Window window, CaptureCamera captureCamera, Projector projector) : base(window) { CaptureCamera = captureCamera; Projector = projector; Projector.Scene = new Scene(new ScreenCamera(Projector.Window)); }
public ChessboardSearchTask(Window window, CaptureCamera captureCamera, Chessboard chessboard) : base(window) { CaptureCamera = captureCamera; Chessboard = chessboard; WriteLine("Taking Snapshot"); }
public NullProjector(Window window) : base("Null", "N/A", new Size(256, 256), new PointF(128, 128), 128) { Color = Color.Pink; Scene = new Scene(ViewProject.Identity); Window = window; }
public ChessboardShapeTask(Window window, Projector projector, Chessboard chessboard) : base(window) { Projector = projector; Chessboard = chessboard; ColoredChessboard = new ColoredChessboard(Chessboard, Color.Black, Color.White); LoadOrDefault(projector.Window.ClientSize); }
public static void Run(string name, Func<Task> work) { Debug.Assert(Windows.IsEmpty()); Monitor = new Window(name); Monitor.Load += (s, e) => Begin(work).ContinueWith(End); Application.Run(Monitor); }
public RealProjector(string name, string uuid, Size imageSize, PointF principal, double focalLength, Screen screen) : base(name, uuid, imageSize, principal, focalLength) { Window = new Window("Pentacorn Projector") { LocatedOnScreen = screen, FullScreen = true, }; Color = Color.DarkBlue; Window.Scene = new Scene(new ScreenCamera(Window)) { new Clear(Color.White), }; }
public VirtualProjector(Window window, OrbitCamera orbitCamera) : base("Null", "N/A", orbitCamera.Intrinsics.ImageSize, orbitCamera.Intrinsics.PrincipalPoint, orbitCamera.Intrinsics.FocalLength) { Color = Color.Yellow; Scene = new Scene(ViewProject.Identity); Window = window; View = orbitCamera.View; World = orbitCamera.World; OrbitCamera = orbitCamera; }
public CalibrateIndirectlyTask(Window window, IEnumerable<CaptureCamera> captureCameras, Projector projector, Chessboard chessboard) : base(window) { CaptureCameras = captureCameras; Chessboard = chessboard; Projector = projector; ProjectorQuadCorners = Chessboard.GetDefaultImageQuadCorners(projector.Window.ClientSize); WorldToProjectorHom = Chessboard.GetHomographyTo(ProjectorQuadCorners); ColoredChessboard = new ColoredChessboard(Chessboard, Color.Black, Color.White, WorldToProjectorHom.ToMatrixFromHomogeneous3x3()); Circles = Chessboard.Saddles.Select(s => new Circle2D(s.ToVector3(z: 0.01f), 10, 4, Color.Crimson) { AlreadyInScreenSpace = false } ).ToList(); }
public static IDisposable AttachInputToCamera(IObservable<Input> whenInput, Window window, OrbitCamera camera) { var whenFocusedInput = whenInput.Where(input => window.Focused); var whenLeftMouseDown = whenFocusedInput.Where(input => input.LeftMouseDown); var whenLeftMouseUp = whenFocusedInput.Where(input => input.LeftMouseUp); var whenFocusedDrag = from begin in whenLeftMouseDown let fro = new { YawPitch = camera.YawPitch, Center = camera.Center } from during in whenFocusedInput.TakeUntil(whenLeftMouseUp) select new { From = fro, To = during, Delta = during.MousePosition - begin.MousePosition }; var halfOrbitPerPixel = MathHelper.Pi / window.Width * new Vector2(-1, -1); var meterPerPixel = 27.0f / window.Width; return new CompositeDisposable( // Scroll Wheel Camera Distance whenFocusedInput.Where(input => input.WheelDelta != 0).Subscribe(input => camera.Distance -= input.WheelDelta), // Shift Drag Camera Centroid Translate whenFocusedDrag.Where(d => d.To.KeyPressed(Keys.LeftShift)) .Subscribe(drag => camera.Center = drag.From.Center + drag.Delta.X * meterPerPixel * camera.World.Left + drag.Delta.Y * meterPerPixel * camera.World.Up), // Normal Drag Camera Orbit Rotate whenFocusedDrag.Where(d => !d.To.KeyPressed(Keys.LeftShift)) .Subscribe(drag => camera.YawPitch = drag.From.YawPitch + drag.Delta * halfOrbitPerPixel)); }
public WorkFlowTask(Window window) { Window = window; }
public WorkFlowTask(WorkFlowTask parent) { Window = parent.Window; }
public Trigger(Func<Task> action, IObservable<Input> trigger, Keys keys, Window window) : this(action, trigger.Where(input => window.Focused && input.KeyDown(keys))) { }
public Trigger(Func<Task> action, Keys keys, Window window) : this(action, Program.WhenInput, keys, window) { }
public CalibrateTask(Window window, Camera camera, Chessboard chessboard) : base(window) { Camera = camera; Chessboard = chessboard; }
internal static void Register(Window window) { Debug.Assert(!Windows.Contains(window)); Windows.Add(window); }