Having thought about why I found the way adding control points to curves confusing I'd like to add a builder that would be used like this:
Curve curve = Curve.builder()
.anchorPoint(new Vector2f(0,0))
.anchorPoint(new Vector2f(0.5f,0.5f))
.controlPoint1(new Vector2f(0.6f,0.5f))
.controlPoint2(new Vector2f(0.8f,2f))
.anchorPoint(new Vector2f(1,2f))
.build();
This example produces a straight line from (0,0) -> (0.5,0.5), then a cubic Besier curves between (0.5,0.5) -> (1,2) with control points (0.6,0.5) and (0.8,2).
The builder statically prevents end being called when not at an anchor, or controlPoint1 or controlPoint2 or nextAnchor being called at the wrong time
Having thought about why I found the way adding control points to curves confusing I'd like to add a builder that would be used like this:
This example produces a straight line from (0,0) -> (0.5,0.5), then a cubic Besier curves between (0.5,0.5) -> (1,2) with control points (0.6,0.5) and (0.8,2).
The builder statically prevents
endbeing called when not at an anchor, orcontrolPoint1orcontrolPoint2ornextAnchorbeing called at the wrong time