void DebugDrawing::arrow(Vector2<> start, Vector2<> end, Drawings::PenStyle penStyle, int width, ColorRGBA color) { Vector2<> startToEnd((end.x - start.x) / 4, (end.y - start.y) / 4); Vector2<> perpendicular(startToEnd.y, -1 * startToEnd.x); // start to endpoint line((int)start.x, (int)start.y, (int)(end.x), (int)(end.y), penStyle, width, color); // endpoint to left and right line((int)(end.x), (int)(end.y), (int)(end.x - startToEnd.x + perpendicular.x), (int)(end.y - startToEnd.y + perpendicular.y), penStyle, width, color); line((int)(end.x), (int)(end.y), (int)(end.x - startToEnd.x - perpendicular.x), (int)(end.y - startToEnd.y - perpendicular.y), penStyle, width, color); }
void DebugDrawing::arrow(Vector2f start, Vector2f end, Drawings::PenStyle penStyle, int width, ColorRGBA color) { Vector2f startToEnd((end.x() - start.x()) / 4, (end.y() - start.y()) / 4); Vector2f perpendicular(startToEnd.y(), -1 * startToEnd.x()); // start to endpoint line((int)start.x(), (int)start.y(), (int)(end.x()), (int)(end.y()), penStyle, width, color); // endpoint to left and right line((int)(end.x()), (int)(end.y()), (int)(end.x() - startToEnd.x() + perpendicular.x()), (int)(end.y() - startToEnd.y() + perpendicular.y()), penStyle, width, color); line((int)(end.x()), (int)(end.y()), (int)(end.x() - startToEnd.x() - perpendicular.x()), (int)(end.y() - startToEnd.y() - perpendicular.y()), penStyle, width, color); }
int main( ) { dp::LockObject l; dp::SyncObject s; dp::CurrentTime start; dp::CurrentTime end; { dp::Lock lock( l ); std::printf( "wait %d milli seconds\n", WAIT_MILLIS ); start.update(); lock.timedWait( s , WAIT_MILLIS ); end.update(); std::printf( "end\n" ); } std::printf( "start time:\n" ); printCurrentTime( start ); std::printf( "end time:\n" ); printCurrentTime( end ); dp::TimeDiff startToEnd( start , end ); std::printf( "start to end:\n" ); printTimeDiff( startToEnd ); dp::TimeDiff endToStart( end , start ); std::printf( "end to start:\n" ); printTimeDiff( endToStart ); return 0; }