Main Page | Modules | Data Structures | File List | Data Fields | Globals

Metrics

Rect, point and rect list calculations. More...


Files

file  metrics.c
 Metric functions Rect, point and rect list calculations.
file  metrics.h
 Metrics Declarations and structures for metrics.

Data Structures

struct  TPoint
 2 dimension point More...
struct  TSPoint
 3 dimension point More...
struct  TRect
 2 dimension rectangle More...
struct  TSize
 2 dimension rectange size More...

Defines

#define _PointInRect(p, r)   (p.x >= r.a.x && p.y >= r.a.y && p.x <= r.b.x && p.y <= r.b.y)
 Inline version of PointInRect (faster, use only if you need high performances).
#define _RectOverlay(r, d)   !( (r).a.x > (d).b.x || (r).a.y > (d).b.y || (r).b.x < (d).a.x || (r).b.y < (d).a.y )
 Inline version of RectOverlay (faster, use only if you need high performances).
#define _RectIntersept(i, r, d)   (i)->b.x = max((r).a.x, min((r).b.x, (d).b.x)); (i)->b.y = max((r).a.y, min((r).b.y, (d).b.y)); (i)->a.x = min((r).b.x, max((r).a.x, (d).a.x)); (i)->a.y = min((r).b.y, max((r).a.y, (d).a.y));
 Inline version of RectIntersept (faster, use only if you need high performances).

Typedefs

typedef TPoint TPoint
 2 dimension point
typedef TPointPPoint
 2 dimension point
typedef TSPoint TSPoint
 3 dimension point
typedef TSPointPSPoint
 3 dimension point
typedef TRect TRect
 2 dimension rectangle
typedef TRectPRect
 2 dimension rectangle
typedef TSize TSize
 2 dimension rectange size
typedef TSizePSize
 2 dimension rectange size

Functions

void PointAssign (TPoint *p, l_int x, l_int y)
 Assign a point with the specified x and y coordinates.
l_bool PointInRect (TPoint p, TRect r)
 Calculates wherever a point is located in the specified rectangle.
void RectAssign (TRect *r, l_int ax, l_int ay, l_int bx, l_int by)
 Assigns the specified coordinates to a rectangle structure.
void RectMove (TRect *d, TRect r, TPoint p)
 Moves a rectangle using a point to define x and y move.
void RectUnMove (TRect *d, TRect r, TPoint p)
 Moves a rectangle back from a prevoius call of RectMove.
l_int GetXDelta (TRect r)
 Calculates the position of the x coordinate of the rectangle.
l_int GetYDelta (TRect r)
 Calculates the position of the y coordinate of the rectangle.
l_int GetWidth (TRect r)
 Calculates the width of the rectangle.
l_int GetHeight (TRect r)
 Calculates the height of the rectangle.
l_bool RectOverlay (TRect r, TRect d)
 Dertermines if rects r and d has a common part.
void RectIntersept (TRect *i, TRect r, TRect d)
 Calculate the common part of r and d ans assign it into i.

Detailed Description

Rect, point and rect list calculations.


Define Documentation

#define _PointInRect p,
 )     (p.x >= r.a.x && p.y >= r.a.y && p.x <= r.b.x && p.y <= r.b.y)
 

Inline version of PointInRect (faster, use only if you need high performances).

See also:
PointInRect

#define _RectIntersept i,
r,
 )     (i)->b.x = max((r).a.x, min((r).b.x, (d).b.x)); (i)->b.y = max((r).a.y, min((r).b.y, (d).b.y)); (i)->a.x = min((r).b.x, max((r).a.x, (d).a.x)); (i)->a.y = min((r).b.y, max((r).a.y, (d).a.y));
 

Inline version of RectIntersept (faster, use only if you need high performances).

See also:
RectIntersept

#define _RectOverlay r,
 )     !( (r).a.x > (d).b.x || (r).a.y > (d).b.y || (r).b.x < (d).a.x || (r).b.y < (d).a.y )
 

Inline version of RectOverlay (faster, use only if you need high performances).

See also:
RectOverlay


Function Documentation

l_int GetHeight TRect  r  ) 
 

Calculates the height of the rectangle.

Returns:
height of rectangle

l_int GetWidth TRect  r  ) 
 

Calculates the width of the rectangle.

Returns:
width of rectangle

l_int GetXDelta TRect  r  ) 
 

Calculates the position of the x coordinate of the rectangle.

Returns:
x varation between r.b and r.a

l_int GetYDelta TRect  r  ) 
 

Calculates the position of the y coordinate of the rectangle.

Returns:
y varation between r.b and r.a

void PointAssign TPoint p,
l_int  x,
l_int  y
 

Assign a point with the specified x and y coordinates.

Parameters:
p Pointer to the point to assign
x Value of x
y Value of y

l_bool PointInRect TPoint  p,
TRect  r
 

Calculates wherever a point is located in the specified rectangle.

Returns:
true if the rect contains the point, otherwise false

void RectAssign TRect r,
l_int  ax,
l_int  ay,
l_int  bx,
l_int  by
 

Assigns the specified coordinates to a rectangle structure.

Passed values are not checked.

Parameters:
r Pointer to the rect to assign
ax Minimal value of x
ay Minimal value of y
bx Maximal value of x
by Maximal value of y

void RectIntersept TRect i,
TRect  r,
TRect  d
 

Calculate the common part of r and d ans assign it into i.

Parameters:
i Rect to assign the result in
r First rect
d Second rect
Warning:
r and d MUST have a common part (use RectOverlay to be sure)

void RectMove TRect d,
TRect  r,
TPoint  p
 

Moves a rectangle using a point to define x and y move.

Parameters:
d Rect where result will be assigned
r Rect to move
p Point defining the move
See also:
RectUnMove

l_bool RectOverlay TRect  r,
TRect  d
 

Dertermines if rects r and d has a common part.

Returns:
'true' if both rects has a common part, else returns false.

void RectUnMove TRect d,
TRect  r,
TPoint  p
 

Moves a rectangle back from a prevoius call of RectMove.

It corresponds to a negative move.

Parameters:
d Rect where result will be assigned
r Rect to move
p Point defining the move
See also:
RectMove


Generated on Fri Oct 29 14:32:53 2004 for oZone GUI by doxygen 1.3.8