BuildIt.AR.WorldHelpers.Offset C# (CSharp) Метод

Offset() публичный статический Метод

public static Offset ( System.Vector3 point, Rectangle bounds, Viewport viewport, System.Matrix projection, System.Matrix view, System.Matrix currentAttitude ) : ScreenOffset
point System.Vector3
bounds Rectangle
viewport Viewport
projection System.Matrix
view System.Matrix
currentAttitude System.Matrix
Результат ScreenOffset
        public static ScreenOffset Offset(Vector3 point, Rectangle bounds, Viewport viewport, Matrix projection,
            Matrix view, Matrix currentAttitude)
        {
            // Create a World matrix for the point.
            var world = Matrix.CreateWorld(point, new Vector3(0, 0, -1), new Vector3(0, 1, 0));

            // Use Viewport.Project to project the point from 3D space into screen coordinates.
            var projected = viewport.Project(Vector3.Zero, projection, view, world*currentAttitude);

            if (projected.Z > 1 || projected.Z < 0)
            {
                // If the point is outside of this range, it is behind the camera.
                // So hide the TextBlock for this point.
                return default(ScreenOffset);
            }

            // Create a TranslateTransform to position the TextBlock.
            // Offset by half of the TextBlock's RenderSize to center it on the point.
            var tt = new ScreenOffset
            {
                TranslateX = projected.X - (bounds.Width/2),
                TranslateY = projected.Y - (bounds.Height/2),

                Scale = 1/projected.Z
            };
            return tt;
        }
    }