public Vector3D Move(Ray3D ray) { if (!isMoving) return new Vector3D(); Vector3D t = Vector3D.CrossProduct(ray.Direction, Direction); Vector3D n = Vector3D.CrossProduct(Direction, t); var i = ray.PlaneIntersection(Origin, n); if (!i.HasValue) return new Vector3D(); Point3D mousePoint = i.Value; double x = 0; double y = 0; double z = 0; switch (Type) { case ManipulatorType.TranslateX: x = mousePoint.X - _lastMousePoint.X; break; case ManipulatorType.TranslateY: y = mousePoint.Y - _lastMousePoint.Y; break; case ManipulatorType.TranslateZ: z = mousePoint.Z - _lastMousePoint.Z; break; } _lastMousePoint = mousePoint; var delta = new Vector3D(x, y, z); /* TranslateTransform3D transform = this.Transform as TranslateTransform3D; transform.OffsetX += x; transform.OffsetY += y; transform.OffsetZ += z;*/ return delta; }
public void InitMove(Ray3D ray) { Vector3D t = Vector3D.CrossProduct(ray.Direction, Direction); Vector3D n = Vector3D.CrossProduct(Direction, t); var intersection=ray.PlaneIntersection(Origin, n); if (!intersection.HasValue) return; _mouseDownPoint = intersection.Value; _lastMousePoint = _mouseDownPoint; originalMaterial = Material; Fill = Brushes.Yellow; isMoving = true; }
public void InitMove(Ray3D ray) { Vector3D t = Vector3D.CrossProduct(ray.Direction, Direction); Vector3D n = Vector3D.CrossProduct(Direction, t); var intersection = ray.PlaneIntersection(Origin, n); if (!intersection.HasValue) { return; } _mouseDownPoint = intersection.Value; _lastMousePoint = _mouseDownPoint; originalMaterial = Material; Fill = Brushes.Yellow; isMoving = true; }
public Vector3D Move(Ray3D ray) { if (!isMoving) { return(new Vector3D()); } Vector3D t = Vector3D.CrossProduct(ray.Direction, Direction); Vector3D n = Vector3D.CrossProduct(Direction, t); var i = ray.PlaneIntersection(Origin, n); if (!i.HasValue) { return(new Vector3D()); } Point3D mousePoint = i.Value; double x = 0; double y = 0; double z = 0; switch (Type) { case ManipulatorType.TranslateX: x = mousePoint.X - _lastMousePoint.X; break; case ManipulatorType.TranslateY: y = mousePoint.Y - _lastMousePoint.Y; break; case ManipulatorType.TranslateZ: z = mousePoint.Z - _lastMousePoint.Z; break; } _lastMousePoint = mousePoint; var delta = new Vector3D(x, y, z); /* TranslateTransform3D transform = this.Transform as TranslateTransform3D; * transform.OffsetX += x; * transform.OffsetY += y; * transform.OffsetZ += z;*/ return(delta); }
public bool RayIntersection(Ray3D ray, out Point3D[] result) { throw new NotImplementedException(); // http://www.devmaster.net/wiki/Ray-sphere_intersection }