Coming Soon!
Original Post
Greetings,
Allow me to introduce to you the 2D Vector API I am working on code named âSugar2Dâ.
Right now I am in the early-mid stages of development. This project is turning out to be bigger than I (naively) anticipated, so the first release will probably have less functionality than I planned. But I will continue to work on this project until it is complete according to my original vision.
So what is it? It is my attempt to combine the power of Illustrator and Unity. At the lowest level there is a familiar looking path API.
Path myPath = new Path()
.MoveTo(300, 400)
.CurveTo(325, 300, 425, 300, 450, 400)
.SmoothCurveTo(575, 500, 600, 400);
However this is a pure mathematical path - it has no display hierarchy nor styling/rendering.
On top of this layer I have built a DisplayList style API with shapes. A shape can either be a path that you specify, or one of the included primitive shapes (and you can of course define your own primitive shapes).
Rectangle rectangle = new Rectangle(
new Point(-200, -200), // Min Corner
new Size(400, 400), // Size
40, // Corner Radius X
40, // Corner Radius Y
Rectangle.CORNER.ROUND // Corner Style
);
RegularPolygon hexagon = new RegularPolygon(
10, // Number of Sides
175f, // Radius
new Point(-100, 500) // Centre
);
Ellipse circle = new Ellipse(
hexagon.Inradius, // Radius
new Point(0, 0) // Centre
);
RegularPolygon triangle = new RegularPolygon(
3, // Number of Sides
circle.RadiusX, // Radius
new Point(500, 0) // Center
);
Star star = new Star(
8, // Number of Points
triangle.Inradius, // Outer Radius
triangle.Inradius / 2, // Inner Radius
hexagon.Center // Centre
);
Ellipse ellipse = new Ellipse(
hexagon.Inradius, // Radius x-axis
triangle.Inradius, // Radius y-axis
circle.Center, // Centre
Angle.D30 // x-axis Rotation
);
Letâs place these shapes into a DisplayList and add some styling.
StrokeStyle.DefaultStyle.Width = 20f;
StrokeStyle.DefaultStyle.CapStyle = StrokeStyle.CAP_STYLE.ROUND;
------SNIP------
displayList
.Append(star)
.Append(circle)
.Append(
ellipse
.AppendRotate(Angle.D90, circle.Center)
)
.Append(triangle)
.Append(hexagon)
.Append(polyline);
How does it look:
There is much more completed than what I have shown here, but there is also much to do. As I start to complete more functionality I will post progress here.
Hopefully regular progress updates will help keep me motivated & accountable ![]()
Thanks for looking!
R











