Geometry Drawing Issues


#1

Hello,

 

I am having trouble getting ellipses to line up with the control points of a path I'm drawing:

 

Is there a way to specify the center of an ellipse? or are the path points off?

 

code:


    juce::Path ssCurve;
    ssCurve.startNewSubPath(0.f, getHeight());
    for (auto& pt : mDrawPts) {
        ssCurve.lineTo(pt.x, pt.y);
        g.drawEllipse(pt.x, pt.y, 5.f, 5.f, 1);
    }
    g.strokePath(ssCurve,PathStrokeType(2.0f));

#2

Is this because the ellipse point is the lower left, not center?


#3

The position is the ellipse's upper left corner, actually.

Just write it yourself:

void drawControlPoint (Graphics& g, float x, float y, float radius, float lineThickness)
{
    g.drawEllipse (x - radius, y - radius, 2.0f * radius, 2.0f * radius, lineThickness);
}