void PhasorArrow
::drawSymbols(QPainter *painter,
const QPointF *points,
int numPoints
) const {
int off = 0;
if ( pen1.width() > 1 )
{
pen1.setCapStyle( Qt::FlatCap );
off = 1;
}
painter->setPen( pen1 );
/* Calculating the angle */
float x1 = points[0].x();
float x2 = points[1].x();
float y1 = points[0].y();
float y2 = points[1].y();
const float ang_diff = M_PI/9;
const float magnitude = 15.0;
float angulo = atan2((y2-y1),(x2-x1)) + M_PI;
float right_x = x2+magnitude*cos(angulo - ang_diff);
float right_y = y2+magnitude*sin(angulo - ang_diff);
float left_x = x2+magnitude*cos(angulo + ang_diff);
float left_y = y2+magnitude*sin(angulo + ang_diff);
float miolo = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
float mag = sqrt(miolo);
if (mag > 25)
{
QwtPainter::drawLine( painter, right_x, right_y, x2, y2
);
QwtPainter::drawLine( painter, left_x, left_y, x2, y2
);
}
}
void PhasorArrow::drawSymbols(QPainter *painter, const QPointF *points, int numPoints) const
{
int off = 0;
QPen pen1 = pen();
if ( pen1.width() > 1 )
{
pen1.setCapStyle( Qt::FlatCap );
off = 1;
}
painter->setPen( pen1 );
/* Calculating the angle */
float x1 = points[0].x();
float x2 = points[1].x();
float y1 = points[0].y();
float y2 = points[1].y();
const float ang_diff = M_PI/9;
const float magnitude = 15.0;
float angulo = atan2((y2-y1),(x2-x1)) + M_PI;
float right_x = x2+magnitude*cos(angulo - ang_diff);
float right_y = y2+magnitude*sin(angulo - ang_diff);
float left_x = x2+magnitude*cos(angulo + ang_diff);
float left_y = y2+magnitude*sin(angulo + ang_diff);
float miolo = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
float mag = sqrt(miolo);
if (mag > 25)
{
QwtPainter::drawLine( painter, right_x, right_y, x2, y2 );
QwtPainter::drawLine( painter, left_x, left_y, x2, y2 );
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks