Cross-platform C SDK logo

Cross-platform C SDK

2D Boxes

❮ 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

Box2Dbox2d (...)
voidbox2d_add (...)
voidbox2d_addn (...)
voidbox2d_add_circle (...)
voidbox2d_merge (...)
bool_tbox2d_is_null (...)

Types and Constants

Box2DkNULL

2D containers or (Bounding boxes) delimit the area of the plane occupied by different geometric elements (Figure 1). They are useful in the collision detection or clipping operations, which prevent non-visible figures from being drawn, improving overall performance.

Drawing of a plan where a 2D container appears that integrates several figures.
Figure 1: Container with various geometric elements.

kNULL

const Box2Df kBOX2D_NULLf;

const Box2Dd kBOX2D_NULLd;

const Box2D Box2D::kNULL;

Represents a null box (without geometry).


box2d ()

Create a new box with the indicated limits.

Box2Df
box2df(const real32_t minX,
       const real32_t minY,
       const real32_t maxX,
       const real32_t maxY);

Box2Dd
box2dd(const real64_t minX,
       const real64_t minY,
       const real64_t maxX,
       const real64_t maxY);

Box2D
Box2D(const real minX,
      const real minY,
      const real maxX,
      const real maxY);
minX

The lower limit on X.

minY

The lower limit on Y.

maxX

The upper limit on X.

maxY

The upper limit on Y.

Return

The newly created box.


box2d_add ()

Expand the dimensions of the box to contain the entry point. If the point is already within its area, the box is not modified.

void
box2d_addf(Box2Df *box,
           const V2Df *p);

void
box2d_addd(Box2Dd *box,
           const V2Dd *p);

void
Box2D::add(Box2D *box,
           const V2D *p);
box

The container.

p

The point to include.


box2d_addn ()

Expand the dimensions of the box to contain several points. It is equivalent to calling the method box2d_addf successively.

void
box2d_addnf(Box2Df *box,
            const V2Df *p,
            const uint32_t n);

void
box2d_addnd(Box2Dd *box,
            const V2Dd *p,
            const uint32_t n);

void
Box2D::addn(Box2D *box,
            const V2D *p,
            const uint32_t n);
box

The container.

p

Vector points to include.

n

Number of points.


box2d_add_circle ()

Expand the dimensions of the container to accommodate a circle.

void
box2d_add_circlef(Box2Df *box,
                  const Cir2Df *cir);

void
box2d_add_circled(Box2Dd *box,
                  const Cir2Dd *cir);

void
Box2D::add_circle(Box2D *box,
                  const Cir2D *cir);
box

The container.

cir

Circle.


box2d_merge ()

Expand the dimensions of dest to contain src.

void
box2d_mergef(Box2Df *dest,
             const Box2Df *src);

void
box2d_merged(Box2Dd *dest,
             const Box2Dd *src);

void
Box2D::merge(Box2D *dest,
             const Box2D *src);
dest

The container that will be expanded.

src

The container that must be added.


box2d_is_null ()

Check if a container is null (without any geometry inside).

bool_t
box2d_is_nullf(const Box2Df *box);

bool_t
box2d_is_nulld(const Box2Dd *box);

bool_t
Box2D::is_null(const Box2D *box);
box

The container.

Return

TRUE if is null, FALSE if contains any geometry.

❮ Back
Next ❯