Engauge Digitizer 2
|
#include "Logger.h"
#include "mmsubs.h"
#include <QImage>
#include <QPointF>
#include <qmath.h>
#include <QTransform>
Go to the source code of this file.
Functions | |
double | angleBetweenVectors (const QPointF &v1, const QPointF &v2) |
Angle between two vectors. Direction is unimportant, so result is between 0 to pi radians. | |
double | angleFromBasisVectors (double xBasisX, double xBasisY, double yBasisX, double yBasisY, double x, double y) |
Four quadrant angle to specified vector, given two orthogonal basis vectors corresonding to +x and +y directions respectively. | |
double | angleFromVectorToVector (const QPointF &vFrom, const QPointF &vTo) |
Angle between two vectors. Direction is positive when rotation is about +z vector, so result is betwen -pi to pi radians. | |
double | dot (const QPointF &vec1, const QPointF &vec2) |
Vector dot product. | |
void | ellipseFromParallelogram (double xTL, double yTL, double xTR, double yTR, double xBR, double yBR, double &angleRadians, double &aAligned, double &bAligned) |
Calculate ellipse parameters that is incribed in a parallelogram centered at the origin, given three successive corners of that parallelogram. | |
double | magnitude (const QPointF &vec) |
Norm of vector. | |
QPointF | normalize (const QPointF &vec) |
Return normalized vector. | |
QRgb | pixelRGB (const QImage &image, int x, int y) |
Get pixel method for any bit depth. | |
QRgb | pixelRGB1 (const QImage &image1Bit, int x, int y) |
Get pixel method for one bit depth. | |
QRgb | pixelRGB8 (const QImage &image8Bit, int x, int y) |
Get pixel method for 8 bit depth. | |
QRgb | pixelRGB32 (const QImage &image32Bit, int x, int y) |
Get pixel method for 32 bit depth. | |
void | projectPointOntoLine (double xToProject, double yToProject, double xStart, double yStart, double xStop, double yStop, double *xProjection, double *yProjection, double *projectedDistanceOutsideLine, double *distanceToLine) |
Find the projection of a point onto a line segment such that the line through the point and its projection are normal to the original line, subject to one constraint. | |
void | setPixelRGB (QImage &image, int x, int y, QRgb q) |
Set pixel method for any bit depth. | |
void | setPixelRGB1 (QImage &image1Bit, int x, int y, QRgb q) |
Set pixel method for one bit depth. | |
void | setPixelRGB8 (QImage &image8Bit, int x, int y, QRgb q) |
Set pixel method for 8 bit depth. | |
void | setPixelRGB32 (QImage &image32Bit, int x, int y, QRgb q) |
Set pixel method for 32 bit depth. |
double angleBetweenVectors | ( | const QPointF & | v1, |
const QPointF & | v2 ) |
Angle between two vectors. Direction is unimportant, so result is between 0 to pi radians.
Definition at line 14 of file mmsubs.cpp.
|
extern |
Four quadrant angle to specified vector, given two orthogonal basis vectors corresonding to +x and +y directions respectively.
This assumes the measurements are performed at the origin
Definition at line 31 of file mmsubs.cpp.
double angleFromVectorToVector | ( | const QPointF & | vFrom, |
const QPointF & | vTo ) |
Angle between two vectors. Direction is positive when rotation is about +z vector, so result is betwen -pi to pi radians.
Definition at line 43 of file mmsubs.cpp.
double dot | ( | const QPointF & | vec1, |
const QPointF & | vec2 ) |
Vector dot product.
Definition at line 63 of file mmsubs.cpp.
void ellipseFromParallelogram | ( | double | xTL, |
double | yTL, | ||
double | xTR, | ||
double | yTR, | ||
double | xBR, | ||
double | yBR, | ||
double & | angleRadians, | ||
double & | aAligned, | ||
double & | bAligned ) |
Calculate ellipse parameters that is incribed in a parallelogram centered at the origin, given three successive corners of that parallelogram.
By symmetry the other corner is not needed.
Definition at line 70 of file mmsubs.cpp.
double magnitude | ( | const QPointF & | vec | ) |
Norm of vector.
Definition at line 193 of file mmsubs.cpp.
QPointF normalize | ( | const QPointF & | vec | ) |
Return normalized vector.
Definition at line 198 of file mmsubs.cpp.
QRgb pixelRGB | ( | const QImage & | image, |
int | x, | ||
int | y ) |
Get pixel method for any bit depth.
Definition at line 209 of file mmsubs.cpp.
QRgb pixelRGB1 | ( | const QImage & | image1Bit, |
int | x, | ||
int | y ) |
Get pixel method for one bit depth.
Definition at line 222 of file mmsubs.cpp.
QRgb pixelRGB32 | ( | const QImage & | image32Bit, |
int | x, | ||
int | y ) |
Get pixel method for 32 bit depth.
Definition at line 241 of file mmsubs.cpp.
QRgb pixelRGB8 | ( | const QImage & | image8Bit, |
int | x, | ||
int | y ) |
Get pixel method for 8 bit depth.
Definition at line 235 of file mmsubs.cpp.
void projectPointOntoLine | ( | double | xToProject, |
double | yToProject, | ||
double | xStart, | ||
double | yStart, | ||
double | xStop, | ||
double | yStop, | ||
double * | xProjection, | ||
double * | yProjection, | ||
double * | projectedDistanceOutsideLine, | ||
double * | distanceToLine ) |
Find the projection of a point onto a line segment such that the line through the point and its projection are normal to the original line, subject to one constraint.
The constraint is that if the project point is outside the (xStart,yStart) to (xStop,yStop) line segment then it will be moved to (xStart,yStart) or (xStop,yStop), whichever is closer.
xToProject | X/theta coordinate to project |
yToProject | Y/radius coordinate to project |
xStart | X/theta at start |
yStart | Y/radius at start |
xStop | X/theta at end |
yStop | Y/radius at end |
xProjection | X/theta coordinate of point projected onto line, moved to between start and end points if outside |
yProjection | Y/radius coordinate of point projected onto line, moved to between start and end points if outside |
projectedDistanceOutsideLine | Specifies how far the projected point was moved because of this constraint - zero if it was not moved or greater than zero if it was moved. |
distanceToLine | Distance between point and close point on the line segment |
Definition at line 251 of file mmsubs.cpp.
void setPixelRGB | ( | QImage & | image, |
int | x, | ||
int | y, | ||
QRgb | q ) |
Set pixel method for any bit depth.
Definition at line 321 of file mmsubs.cpp.
void setPixelRGB1 | ( | QImage & | image1Bit, |
int | x, | ||
int | y, | ||
QRgb | q ) |
Set pixel method for one bit depth.
Definition at line 337 of file mmsubs.cpp.
void setPixelRGB32 | ( | QImage & | image32Bit, |
int | x, | ||
int | y, | ||
QRgb | q ) |
Set pixel method for 32 bit depth.
Definition at line 370 of file mmsubs.cpp.
void setPixelRGB8 | ( | QImage & | image8Bit, |
int | x, | ||
int | y, | ||
QRgb | q ) |
Set pixel method for 8 bit depth.
Definition at line 359 of file mmsubs.cpp.