Example #1
0
        /// <summary>
        ///     Adds the line to the given <paramref name="path" /> after transforming it by the given
        ///     <paramref name="transform" />.
        /// </summary>
        /// <param name="path">The path to add the line to.</param>
        /// <param name="transform">The transform.</param>
        public void AddToPath(IGraphicsPath path, Matrix3x2 transform)
        {
            Vector2 zero = Vector2.Transform(Vector2.Zero, transform);
            Vector2 rad  = Vector2.Transform(Radius, transform);

            rad = Radius * (Vector2.Distance(zero, rad) / Radius.Length());

            Vector2 angVec = Vector2.Transform(new Vector2(0, 1), Matrix3x2.CreateRotation(Angle) * transform);
            float   ang    = AngleBetween(new Vector2(0, 1), angVec - zero);

            path.AddArc(
                Vector2.Transform(End, transform),
                rad,
                ang,
                Clockwise /* TODO probably need to work this out somehow */,
                IsLarge);
        }
Example #2
0
 /// <summary>
 /// Adds an arc to the path at the specified <paramref name="location"/>
 /// </summary>
 /// <param name="path">Path to add the arc to</param>
 /// <param name="location">Location of the bounding rectangle of the arc</param>
 /// <param name="startAngle">Start angle in degrees</param>
 /// <param name="sweepAngle">Sweep angle (positive or negative) in degrees</param>
 public static void AddArc(this IGraphicsPath path, RectangleF location, float startAngle, float sweepAngle)
 {
     path.AddArc(location.X, location.Y, location.Width, location.Height, startAngle, sweepAngle);
 }
Example #3
0
        /// <summary>
        ///     Adds the line to the given <paramref name="path" /> after transforming it by the given
        ///     <paramref name="transform" />.
        /// </summary>
        /// <param name="path">The path to add the line to.</param>
        /// <param name="transform">The transform.</param>
        public void AddToPath(IGraphicsPath path, Matrix3x2 transform)
        {
            Vector2 zero = Vector2.Transform(Vector2.Zero, transform);
            Vector2 rad = Vector2.Transform(Radius, transform);
            rad = Radius * (Vector2.Distance(zero, rad) / Radius.Length());

            Vector2 angVec = Vector2.Transform(new Vector2(0, 1), Matrix3x2.CreateRotation(Angle) * transform);
            float ang = AngleBetween(new Vector2(0, 1), angVec - zero);

            path.AddArc(
                Vector2.Transform(End, transform),
                rad,
                ang,
                Clockwise /* TODO probably need to work this out somehow */,
                IsLarge);
        }