Example #1
0
        /// <summary>
        /// Scale the NDC rectangle to the dimensions given.
        /// </summary>
        /// <param name="icrc">Context.</param>
        void IRequireTransforms.Transforms(IChartRenderContext icrc)
        {
            var matx = MatrixSupport.ProjectForQuadrant(4, icrc.SeriesArea);

            Rectangle.Transform = new MatrixTransform()
            {
                Matrix = matx
            };
        }
        /// <summary>
        /// The geometry is a circle of radius 10 centered at (0,0).
        /// </summary>
        /// <param name="area">Projection area.</param>
        /// <returns>MP matrix for this component's geometry.</returns>
        Matrix IProvideCustomTransform.TransformFor(Rect area)
        {
            var range = 2.0 * RADIUS;
            var mmatx = new Matrix(1.0 / range, 0, 0, -1.0 / range, RADIUS / range, RADIUS / range);
            var pmatx = MatrixSupport.ProjectForQuadrant(4, area);
            // lock aspect ratio to smallest dimension so it's a circle
            var scale = Math.Min(pmatx.M11, pmatx.M22);

            pmatx.M11 = pmatx.M22 = scale;
            // TODO adjust offset so it's centered
            var matx = MatrixSupport.Multiply(mmatx, pmatx);

            _trace.Verbose($"{Name} mat:{matx} M:{mmatx} P:{pmatx}");
            return(matx);
        }