public ScreenOffset CalculateScreenOffset(IWorldElement <Event> element, double width, double height, double roll, double pitch, double yaw) { //roll = 0; //pitch = MathHelper.PiOver2; //yaw = 0;// MathHelper.PiOver2; return(World.Offset(element, new Rectangle(0, 0, (int)width, (int)height), roll, pitch, yaw)); }
public ScreenOffset Offset <TElement> (IWorldElement <TElement> point, Rectangle bounds, double roll, double pitch, double yaw) where TElement : IHasLocation { #region HACK based on bearing //var offset = new ScreenOffset(); //var bearing = CentreOfWorld.Bearing(point.Element.GeoLocation); //var diff = yaw - bearing; //// let vof be 90 degrees (45 each side of straight ahead //var vof = (90.0).ToRad(); //offset.TranslateX = (Viewport.Width/2)*(1 + (diff/vof)); //offset.TranslateY = Viewport.Height/2; //var distance = CentreOfWorld.DistanceInKilometres(point.Element.GeoLocation); //offset.Scale = 1; // Do something here with distance and range etc //return offset; #endregion HACK var mat = Matrix.CreateFromYawPitchRoll((float)yaw, (float)pitch, (float)roll); var currentAttitude = WorldAdjustment * mat; //var currentAttitude = // Required for Android // Matrix.CreateRotationY(MathHelper.PiOver2) * // Matrix.CreateRotationZ(-MathHelper.PiOver2) * // mat; //var currentAttitude = // Required for iOS // Matrix.CreateRotationZ(-MathHelper.PiOver2) * // mat; // var currentAttitude = // REquired for UWP Mobile //Matrix.CreateRotationY(MathHelper.PiOver2) * //Matrix.CreateRotationZ(-MathHelper.PiOver2) * //mat; return(WorldHelpers.Offset(point.PositionInWorld, bounds, Viewport, Projection, View, currentAttitude)); }