Cross-platform C SDK logo

Cross-platform C SDK

2D Rectangles

❮ Back
Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

Functions

R2Dr2d (...)
bool_tr2d_contains (...)
bool_tr2d_clip (...)

Types and Constants

R2DkZERO

A rectangle (or frame) (Figure 1) is used to locate elements in user interfaces or other 2D systems through a point of origin V2D and a size S2D.

Drawing a plan several rectangular elements are located, as a user interface.
Figure 1: Positioning elements using rectangles.

kZERO

const R2Df kR2D_ZEROf;

const R2Dd kR2D_ZEROd;

const R2D R2D::kZERO;

Value [0,0,0,0].


r2d ()

Create a rectangle from its components.

R2Df
r2df(const real32_t x,
     const real32_t y,
     const real32_t width,
     const real32_t height);

R2Dd
r2dd(const real64_t x,
     const real64_t y,
     const real64_t width,
     const real64_t height);

R2D
R2D(const real x,
    const real y,
    const real width,
    const real height);
x

Origin x coordinate.

y

Coordinate and origin.

width

Width.

height

Height.

Return

The rectangle.


r2d_contains ()

Check if a point is inside the rectangle.

bool_t
r2d_containsf(const R2Df *r2d,
              const real32_t x,
              const real32_t y);

bool_t
r2d_containsd(const R2Dd *r2d,
              const real64_t x,
              const real64_t y);

bool_t
R2D::contains(const R2D *r2d,
              const real x,
              const real y);
r2d

Rectangle.

x

X coordinate of the point.

y

Coordinate and point.

Return

TRUE if the point is inside.


r2d_clip ()

Check if a rectangle, or part of it, is contained in another rectangle.

bool_t
r2d_clipf(const R2Df *viewport,
          const R2Df *r2d);

bool_t
r2d_clipd(const R2Dd *viewport,
          const R2Dd *r2d);

bool_t
R2D::clip(const R2D *viewport,
          const R2D *r2d);
viewport

Container rectangle.

r2d

Rectangle to check.

Return

TRUE if the r2d rectangle is completely outside of viewport.

Remarks

Useful to avoid processing or drawing objects that are totally outside the viewing area.

❮ Back
Next ❯