Hello all!
I have the following issue: I have two subpaths that I am trying to join. See the following pic:
I would like to know what the easiest way of joining the two centered arc subpaths around the left-most box. I would also like to know how to change the color. Here is a code snippet of what I am currently doing:
if (m_status[i] == 1){
g.setColour (Colours::yellow.withAlpha (1.f));
}
else if (m_status[i] == 2){
g.setColour (Colours::red.withAlpha (1.f));
}
else {
g.setColour (Colours::green.withAlpha (1.f));
}
if (m_xVel[i] == 0.f && m_yVel[i] == 0.f){
angle = m_heading[i];
}
else {
angle = atan2(m_yVel[i],m_xVel[i])+MY_PI;
}
myPath.addCentredArc( fvX,
fvY,
VEHICLE_SPIN_RADIUS * (float)getWidth() / MAP_WIDTH_MM,
VEHICLE_SPIN_RADIUS * (float)getWidth() / MAP_WIDTH_MM,
angle, // rotate by velocity vector
0.f,
MY_PI,
true);
/*float xs,ys,xe,ye;
xs = myPath.getBounds().getX()*cos(angle);
ys = myPath.getBounds().getX()*sin(angle);
xe = (myPath.getBounds().getX()+(2.f*VEHICLE_SPIN_RADIUS * (float)getWidth() / MAP_WIDTH_MM))*cos(angle);
ye = (myPath.getBounds().getX()*(2.f*VEHICLE_SPIN_RADIUS * (float)getHeight() / MAP_HEIGHT_MM))*sin(angle);
l.setStart(xs,ys);
l.setEnd(xe,ye);
g.drawArrow(l,3,0,0);*/
//myPath.lineTo(xs+m_xVel[i]*CRITICAL_TIME* (float)getWidth() / MAP_WIDTH_MM,ys+fvY + m_yVel[i]*CRITICAL_TIME* (float)getHeight() / MAP_HEIGHT_MM);
/*if (i==0){
//m_xVel[i] -= 1000;
m_yVel[i] += 200;
} debug for juce forum screenshot*/
myPath.addCentredArc( fvX + m_xVel[i]*CRITICAL_TIME* (float)getWidth() / MAP_WIDTH_MM,
fvY + m_yVel[i]*CRITICAL_TIME* (float)getHeight() / MAP_HEIGHT_MM,
VEHICLE_SPIN_RADIUS * (float)getWidth() / MAP_WIDTH_MM,
VEHICLE_SPIN_RADIUS * (float)getWidth() / MAP_WIDTH_MM,
angle, // rotate by velocity vector
MY_PI,
2.f*MY_PI,
true);
g.strokePath (myPath, PathStrokeType (3.0f));
Currently, I have a status int (m_status[i]) that I am trying to use to set the color, but despite the status triggering the different conditions, the color remains the same. So I don’t think I’m understanding how strokePath works. Any help on the two issues I’m having would be most appreciated. Thanks!