Example #1
0
        public static void DrawPath(ICanvas2D dc, Matrix3x2 xform, string path, OutlineFillStyle style)
        {
            var shapes = ParseShapes(path);

            foreach (var shape in shapes)
            {
                var points = shape.AsSpan();

                if (points[0].Equals(points[points.Length - 1]))
                {
                    points = points.Slice(0, points.Length - 1);
                    dc.DrawPolygon(points, style);
                    continue;
                }

                if (style.HasFill)
                {
                    dc.DrawPolygon(points, style.FillColor);
                }
                if (style.HasOutline)
                {
                    dc.DrawLines(points, style.OutlineWidth, style.OutlineColor);
                }
            }
        }
        public static void DrawTo(IScene3D context)
        {
            var color = ColorStyle.GetDefaultFrom(context, COLOR.Red);
            var style = new OutlineFillStyle(color, COLOR.Black, 0.1f);

            context.DrawSphere(Point3.UnitY, 2.5f, style);

            context.DrawSegment((0, 4, 0), (0, 8, 0), 1.5f, (style, LineCapStyle.Round, LineCapStyle.Triangle));

            for (int i = 0; i < 3; ++i)
            {
                var angle = (i * 120) * (float)Math.PI / 180f;
                var h     = new Point3((float)Math.Cos(angle), 0, (float)Math.Sin(angle));

                var a = new Point3(0, 4, 0) + h * 0.5f;
                var b = new Point3(0, 2, 0) + h * 2;
                var c = new Point3(0, 0, 0) + h * 2;
                var d = new Point3(0, -2, 0) + h * 2;
                var e = new Point3(0, 0.15f, 0) + h * 0.5f;

                context.DrawSegments(Point3.Array(a, b, c), 0.5f, (style, LineCapStyle.Triangle, LineCapStyle.Flat));
                context.DrawSegment(c, d, 1f, (style, LineCapStyle.Triangle, LineCapStyle.Flat));

                // connection to central sphere
                context.DrawSegment((c + d) * 0.5f, e, 0.25f, (style, LineCapStyle.Triangle, LineCapStyle.Flat));

                // exhaust plume
                context.DrawSegment(d - Vector3.UnitY, d - Vector3.UnitY * 3, 0.5f, ((COLOR.White, COLOR.Blue.WithAlpha(150), 0.5f), LineCapStyle.Round, LineCapStyle.Triangle));
            }
        }
Example #3
0
        void IScene3D.DrawSphere(Point3 center, float diameter, OutlineFillStyle brush)
        {
            var c = center.XYZ;

            if (!_FrustumNearPlane.IsInPositiveSideOfPlane(c))
            {
                return;
            }

            var pp = _ProjectPoint(c).SelectXY();
            var pr = _ProjectRadius(c, diameter);

            _RenderTarget.DrawEllipse(pp, pr, pr, brush);
        }
 /// <inheritdoc/>
 public void DrawSphere(Point3 center, float diameter, OutlineFillStyle style)
 {
     _Check(); Decompose3D.DrawSphere(_Target, center, diameter, style);
 }
 /// <inheritdoc/>
 public void DrawSphere(Point3 center, float diameter, OutlineFillStyle style)
 {
     Decompose3D.DrawSphere(this, center, diameter, style);
 }