Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
general.h File Reference

Go to the source code of this file.

Functions

int general_bytes2int (unsigned char byte_high, unsigned char byte_low)
 
unsigned int general_bytes2uint (unsigned char byte_high, unsigned char byte_low)
 
void general_int2bytes (int integer, unsigned char *byte_high, unsigned char *byte_low)
 
double general_gaussrand (double mu, double sigma)
 
float general_gaussian (float mu, float sigma, int x)
 
float general_dist_squared (int x1, int y1, int x2, int y2)
 
float general_dist2seg (int x, int y, int p1[], int p2[])
 
void general_circle (int **arr, int cx, int cy, int radius)
 
void general_circle_eight_points (int **arr, int cx, int cy, int x, int y)
 
void general_circle_four_points (int **arr, int cx, int cy, int x, int y)
 
void general_circle_horizontal_line (int **arr, int x, int y, int len)
 

Detailed Description

Author
Eriks Zaharans
Date
1 Jul 2013

DESCRIPTION

General function library header file.

Definition in file general.h.

Function Documentation

int general_bytes2int ( unsigned char  byte_high,
unsigned char  byte_low 
)

Convert two bytes to int (two's complement)

Parameters
byte_highHigh byte of data
byte_lowLow byte of data
Returns
Integer (two's complement)

Definition at line 29 of file general.c.

unsigned int general_bytes2uint ( unsigned char  byte_high,
unsigned char  byte_low 
)

Convert two bytes to unsigned int

Parameters
byte_highHigh byte of data
byte_lowLow byte of data
Returns
Unsigned integer

Definition at line 52 of file general.c.

void general_circle ( int **  arr,
int  cx,
int  cy,
int  radius 
)

Draw (fill) filled circle in 2D array http://en.wikipedia.org/wiki/Midpoint_circle_algorithm // Code modified

Parameters
cxCenter x coordinate
cyCenter y coordinate
radiusRadius of circle
Returns
Void

Definition at line 180 of file general.c.

void general_circle_eight_points ( int **  arr,
int  cx,
int  cy,
int  x,
int  y 
)

Draw (fill) eight points - Part of general_circle() function http://en.wikipedia.org/wiki/Midpoint_circle_algorithm // Code modified

Parameters
cxCenter x coordinate
cyCenter y coordinate
xX coordinate
yY coordinate
Returns
Void

Definition at line 212 of file general.c.

void general_circle_four_points ( int **  arr,
int  cx,
int  cy,
int  x,
int  y 
)

Draw (fill) four points - Part of general_circle() function http://en.wikipedia.org/wiki/Midpoint_circle_algorithm // Code modified

Parameters
cxCenter x coordinate
cyCenter y coordinate
xX coordinate
yY coordinate
Returns
Void

Definition at line 230 of file general.c.

void general_circle_horizontal_line ( int **  arr,
int  x,
int  y,
int  len 
)

Draw (fill) horizontal line - Part of general_circle() function http://en.wikipedia.org/wiki/Midpoint_circle_algorithm // Code modified

Parameters
xStart x coordinate
yStart y coordinate
lenLength of line
Returns
Void

Definition at line 244 of file general.c.

float general_dist2seg ( int  x,
int  y,
int  p1[],
int  p2[] 
)

Calculate distance from point to line segment

Parameters
xX coordinate of point
yY coordinate of point
p1Array of x and y coordinates for 1st line point
p2Array of x and y coordinates for 2nd line point
Returns
Distance from point to line segment

Definition at line 154 of file general.c.

float general_dist_squared ( int  x1,
int  y1,
int  x2,
int  y2 
)

Calculate squared distance between two points

Parameters
x1X coordinate of 1st point
y1Y coordinate of 1st point
x2X coordinate of 2nd point
y2Y coordinate of 1st point
Returns
Squared distance between points

Definition at line 141 of file general.c.

float general_gaussian ( float  mu,
float  sigma,
int  x 
)

Calculate Gaussian

Parameters
muMean of gaussian
sigmaVariance of gaussian
xPosition on x axis
Returns
Gaussian value at x

Definition at line 128 of file general.c.

double general_gaussrand ( double  mu,
double  sigma 
)

Random number based on normal (gaussian) distribution http://c-faq.com/lib/gaussian.html [Donald E. Knuth]

Parameters
muMean of gaussian
sigmaVariance of gaussian
Returns
Random number based on normal distribution

Definition at line 91 of file general.c.

void general_int2bytes ( int  integer,
unsigned char *  byte_high,
unsigned char *  byte_low 
)

Convert int to two bytes (two's complement)

Parameters
integerInteger to be converted
byte_highPointer to high byte of data
byte_lowPointer to low byte of data
Returns
Integer (two's complement)

Definition at line 69 of file general.c.