VectorizerFigure is the base class all Figures in Vectorizer derive from. The following code block presents an overview of how the VectorizerEllipse is implemented.

In brief, every new Figure needs to implement two methods: Rebuild and Validate. The former defines how to recreate the Figure based on the new values of the parameters. The latter defines when the parameter values define a valid figure.

    public class VectorizerEllipse : VectorizerFigure
        [Range(3f, 320f)] public int Tessellation = 32;

        [Range(0.001f, 256f)] public float SemiMajorAxis = 8;
        [Range(0.001f, 256f)] public float SemiMinorAxis = 8;

        public override void Rebuild()
            // This function is called every time the parameters change.
            // Therefore, we need to clear the instructions having old values.

            // We add a new Fill Ellipse instruction based on the current values.
            // To avoid an overlap between the interior part and the outline,
            // we reduce the length of the semi-major and semi-minor axis
            // by half the stroke thickness' width.
            Designer.AddInstruction(new FillEllipse(Tessellation, SemiMajorAxis-StrokeThickness/2,
                SemiMinorAxis - StrokeThickness / 2));

            // If this figure has a stroke part (HasStroke), then we 
            // need to add the corresponding instructions.
            if (HasStroke)
                Designer.AddInstruction(new DrawEllipse(Tessellation, SemiMajorAxis, SemiMinorAxis,
                // This instruction makes sure that the vertices belonging to the
                // interior area have the same exact values as those on the outline,
                // to account for floating-point errors.
                Designer.AddInstruction(new WeldPolygonVerticesInstruction());

        protected override bool Validate()
            // return true when the figure is valid according to the current
            // value of the parameters.
            return SemiMajorAxis >= 0.01f && SemiMinorAxis >= 0.01f;

        // To make your figure appear in the menu, implement a similar function
        [MenuItem("GameObject/Vectorizer/Add Ellipse")]
        public static void CreatePolygon()