private static void DrawDirectVsPolygon(ICanvas2D dc) { var l1style = (COLOR.White, LineCapStyle.Flat, LineCapStyle.Round); var l2style = ((COLOR.White, COLOR.Red, 5), LineCapStyle.Flat, LineCapStyle.Round); var x = 50; dc.DrawTextLine((x, 30), "Native", 15, FontStyle.VFlip_Gray.With(COLOR.White)); dc.DrawCircle((x, 50), 10, COLOR.White); dc.DrawCircle((x, 100), 10, (COLOR.White, COLOR.Red, 5)); dc.DrawLine((x, 150), (50, 200), 10, l1style); dc.DrawLine((x, 250), (50, 300), 10, l2style); x = 100; dc.DrawTextLine((x, 30), "Polygonized", 15, FontStyle.VFlip_Gray.With(COLOR.White)); var dc2x = new Decompose2D(dc); dc2x.DrawEllipse((x, 50), 10, 10, COLOR.Yellow); dc2x.DrawEllipse((x, 100), 10, 10, (COLOR.Yellow, COLOR.Red, 5)); dc2x.DrawLines(new[] { new POINT2(x, 150), new POINT2(x, 200) }, 10, l1style); dc2x.DrawLines(new[] { new POINT2(x, 250), new POINT2(x, 300) }, 10, l2style); var dc3d = Canvas2DTransform.Create(dc, Matrix3x2.Identity); x = 150; dc.DrawTextLine((x, 30), "3D", 15, FontStyle.VFlip_Gray.With(COLOR.White)); dc3d.DrawSphere((x, 50, 0), 10, COLOR.White); dc3d.DrawSphere((x, 100, 0), 10, (COLOR.White, COLOR.Red, 5)); dc3d.DrawSegment((x, 150, 0), (x, 200, 0), 10, l1style); dc3d.DrawSegment((x, 250, 0), (x, 300, 0), 10, l2style); x = 200; dc.DrawTextLine((x, 30), "3D Polygonized", 15, FontStyle.VFlip_Gray.With(COLOR.White)); var dc3x = new Decompose3D(dc3d, 5, 3); dc3x.DrawSphere(new Vector3(x, 50, 0), 10, COLOR.Yellow); dc3x.DrawSphere(new Vector3(x, 100, 0), 10, (COLOR.Yellow, COLOR.Red, 5)); dc3x.DrawSegment(new Vector3(x, 150, 0), new Vector3(x, 200, 0), 10, l1style); dc3x.DrawSegment(new Vector3(x, 250, 0), new Vector3(x, 300, 0), 10, l2style); }
public void TestDrawMultiSegment() { var scene = new GltfSceneBuilder(); using (var dc = scene.Create3DContext()) { var style = new LineStyle(COLOR.Red, LineCapStyle.Round, LineCapStyle.Triangle).WithOutline(COLOR.Black, 1); Decompose3D.DrawSegment(dc, Point3.Array((0, 0, 0), (17, 0, 0), (20, 10, 0), (20, 20, 0)), 5, style); Decompose3D.DrawSegment(dc, Point3.Array((0, 0, 20), (0, 15, 20), (30, 0, 20), (0, 0, 20)), 3, style); Decompose3D.DrawSegment(dc, Point3.Array((0, 0, 40), (0, 15, 40)), 3, style); } AttachmentInfo .From("extrude1.glb") .WriteObject(f => scene.Save(f)); }