#include <ArsToolbox.h>
Static Public Member Functions | |
static int | lineLineCrossPoint (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double *cpx, double *cpy) |
GOS - Determines cross point (intersection) of two lines. | |
static int | circleCircleIntersection (double x0, double y0, double r0, double x1, double y1, double r1, double *xi, double *yi, double *xi_prime, double *yi_prime) |
GOS - Determines intersection between two circles. | |
static double | vectorsAngle (double v1ex, double v1ey, double v2ex, double v2ey) |
GOS - Returns angle of two vectors. | |
static double | vectorNorm (double v1x, double v1y) |
GOS - Returns vector size. | |
static int | circleLineIntersection (double p1x, double p1y, double p2x, double p2y, double cx, double cy, double r, double *v1x, double *v1y, double *v2x, double *v2y, bool line) |
GOS - Determines if line and circle have crossing points. | |
static int | circleLineIntersection (double p1x, double p1y, double p2x, double p2y, double cx, double cy, double r, double *v1x, double *v1y, double *v2x, double *v2y) |
Determines if line and circle have crossing points. | |
static int | createLineTo (double sx, double sy, double angle, double length, double *ex, double *ey) |
GOS - Creates end point for line (segment) from point, angle and length. | |
static double | linePointDistance (double dX1, double dY1, double dX2, double dY2, double dPX, double dPY) |
static double | trim (double value, double min, double max) |
static int | distancePointLine (VecPosition point, VecPosition lineStart, VecPosition lineEnd, double *distance) |
GOS - Method computes the distance from a point to a line. | |
static double | computeLeastInterceptTime (VecPosition b0, VecPosition v0, VecPosition r0, double vR, double tau=2.0) |
GOS - Method counts time (using Newton's iteration method) player needs to get to the ball. |
Definition at line 14 of file ArsToolbox.h.
int ArsToolbox::lineLineCrossPoint | ( | double | x1, | |
double | y1, | |||
double | x2, | |||
double | y2, | |||
double | x3, | |||
double | y3, | |||
double | x4, | |||
double | y4, | |||
double * | cpx, | |||
double * | cpy | |||
) | [static] |
GOS - Determines cross point (intersection) of two lines.
Determines intersection of two lines by using one parameterized formula and nominating it's X and Y to formula of second line
x1 | X coordinate of start of 1st line | |
y1 | Y coordinate of start of 1st line | |
x2 | X coordinate of start of 2nd line | |
y2 | Y coordinate of start of 2nd line | |
x3 | X coordinate of end of 1st line | |
y3 | Y coordinate of end of 1st line | |
x4 | X coordinate of end of 2nd line | |
y4 | Y coordinate of end of 2nd line | |
cpx | intersection X | |
cpy | intersection Y |
Definition at line 25 of file ArsToolbox.cpp.
int ArsToolbox::circleCircleIntersection | ( | double | x0, | |
double | y0, | |||
double | r0, | |||
double | x1, | |||
double | y1, | |||
double | r1, | |||
double * | xi, | |||
double * | yi, | |||
double * | xi_prime, | |||
double * | yi_prime | |||
) | [static] |
GOS - Determines intersection between two circles.
Determines intersection of two circles by using one parameterized circle formula and nominating it's X and Y to formula of second circle
x0 | X coordinate of centre of 1st circle | |
y0 | Y coordinate of centre of 1st circle | |
r0 | radius of 1st circle | |
x1 | X coordinate of centre of 2nd circle | |
y1 | Y coordinate of centre of 2nd circle | |
r1 | radius of 2nd circle | |
xi | X of first intersection | |
yi | Y of first intersection | |
xi_prime | X of second intersection | |
yi_prime | Y of secound intersection |
Definition at line 77 of file ArsToolbox.cpp.
double ArsToolbox::vectorsAngle | ( | double | v1ex, | |
double | v1ey, | |||
double | v2ex, | |||
double | v2ey | |||
) | [static] |
GOS - Returns angle of two vectors.
Determines angle A between two vectors V1, V2: cos(A) = (V1.x*V2.x + V1.y*V2.y) / (vectorNorm(V1) * vectorNorm(V2))
v1ex | X of V1 | |
v1ey | Y of V1 | |
v2ex | X of V2 | |
v2ey | Y of V2 |
Definition at line 151 of file ArsToolbox.cpp.
double ArsToolbox::vectorNorm | ( | double | v1x, | |
double | v1y | |||
) | [static] |
GOS - Returns vector size.
Returns vector size: size = sqrt(x^2 + y^2)
v1x | x coordinate | |
v1y | y coordinate |
Definition at line 166 of file ArsToolbox.cpp.
int ArsToolbox::circleLineIntersection | ( | double | p1x, | |
double | p1y, | |||
double | p2x, | |||
double | p2y, | |||
double | cx, | |||
double | cy, | |||
double | r, | |||
double * | v1x, | |||
double * | v1y, | |||
double * | v2x, | |||
double * | v2y, | |||
bool | line | |||
) | [static] |
GOS - Determines if line and circle have crossing points.
This function creates line formula as follows: x = p1x + (p2x - p1x)*t y = p1y + (p2y - p1y)*t
And then places it to circle formula: (x - cx)^2 + (y - cy)^2 = r^2
Solution is kvadratic function with no, 1 or 2 solutions (points)
line | if true, then points [p1x, p1y], [p2x, p2y] are for line, segment (dash) otherwise |
Definition at line 206 of file ArsToolbox.cpp.
Referenced by circleLineIntersection(), and Player::passTo().
int ArsToolbox::circleLineIntersection | ( | double | p1x, | |
double | p1y, | |||
double | p2x, | |||
double | p2y, | |||
double | cx, | |||
double | cy, | |||
double | r, | |||
double * | v1x, | |||
double * | v1y, | |||
double * | v2x, | |||
double * | v2y | |||
) | [static] |
Determines if line and circle have crossing points.
This function creates line formula as follows: x = p1x + (p2x - p1x)*t y = p1y + (p2y - p1y)*t
And then places it to circle formula: (x - cx)^2 + (y - cy)^2 = r^2
Solution is kvadratic function with no, 1 or 2 solutions (points)
line | if true, then points [p1x, p1y], [p2x, p2y] are for line, segment (dash) otherwise |
Definition at line 186 of file ArsToolbox.cpp.
References circleLineIntersection().
int ArsToolbox::createLineTo | ( | double | sx, | |
double | sy, | |||
double | angle, | |||
double | length, | |||
double * | ex, | |||
double * | ey | |||
) | [static] |
GOS - Creates end point for line (segment) from point, angle and length.
Function determines vector from angle and length, then adds original position to this vector
sx | original X | |
sy | original Y | |
angle | angle of vector | |
length | length of vector | |
ex | pointer to endpoint X variable | |
eY | pointer to endpoint Y variable |
Definition at line 300 of file ArsToolbox.cpp.
Referenced by Player::passTo().
double ArsToolbox::linePointDistance | ( | double | dX1, | |
double | dY1, | |||
double | dX2, | |||
double | dY2, | |||
double | dPX, | |||
double | dPY | |||
) | [static] |
double ArsToolbox::trim | ( | double | value, | |
double | min, | |||
double | max | |||
) | [static] |
Definition at line 322 of file ArsToolbox.cpp.
Referenced by Player::circleKickToPass(), Player::passTo(), Player::passToFitness(), and Player::passToTeammateFitness().
int ArsToolbox::distancePointLine | ( | VecPosition | point, | |
VecPosition | lineStart, | |||
VecPosition | lineEnd, | |||
double * | distance | |||
) | [static] |
GOS - Method computes the distance from a point to a line.
point | The point the distance is computets from. | |
lineStart | The point where the line starts. | |
lineEnd | The point where the line ends. | |
*distance | The pointer where to store the distance. |
Definition at line 342 of file ArsToolbox.cpp.
References VecPosition::getX(), VecPosition::getY(), VecPosition::setX(), and VecPosition::setY().
Referenced by computeLeastInterceptTime().
double ArsToolbox::computeLeastInterceptTime | ( | VecPosition | b0, | |
VecPosition | v0, | |||
VecPosition | r0, | |||
double | vR, | |||
double | tau = 2.0 | |||
) | [static] |
GOS - Method counts time (using Newton's iteration method) player needs to get to the ball.
b0 | Actual ball position | |
v0 | Actual velocity vector | |
r0 | Actual player position | |
vR | Maximum possible player speed (parameter of soccer server) | |
tau | Value used in expression to count dumped velocity of the ball. Implicit value is set to 2.0 |
Definition at line 376 of file ArsToolbox.cpp.
References distancePointLine(), VecPosition::getMagnitude(), VecPosition::getX(), VecPosition::getY(), and VecPosition::normalize().
Referenced by Player::getPlayerRoles().