Top |
graphene_box_t provides a representation of an axis aligned minimum bounding box using the coordinates of its minimum and maximum vertices.
graphene_box_t *
graphene_box_alloc (void
);
Allocates a new graphene_box_t.
The contents of the returned structure are undefined.
[constructor]
the newly allocated graphene_box_t structure.
Use graphene_box_free()
to free the resources allocated by this function.
[transfer full]
Since: 1.2
void
graphene_box_free (graphene_box_t *box
);
Frees the resources allocated by graphene_box_alloc()
.
Since: 1.2
graphene_box_t * graphene_box_init (graphene_box_t *box
,const graphene_point3d_t *min
,const graphene_point3d_t *max
);
Initializes the given graphene_box_t with two vertices.
box |
the graphene_box_t to initialize |
|
min |
the coordinates of the minimum vertex. |
[nullable] |
max |
the coordinates of the maximum vertex. |
[nullable] |
Since: 1.2
graphene_box_t * graphene_box_init_from_box (graphene_box_t *box
,const graphene_box_t *src
);
Initializes the given graphene_box_t with the vertices of another graphene_box_t.
Since: 1.2
graphene_box_t * graphene_box_init_from_points (graphene_box_t *box
,unsigned int n_points
,const graphene_point3d_t *points
);
Initializes the given graphene_box_t with the given array of vertices.
If n_points
is 0, the returned box is initialized with
graphene_box_empty()
.
box |
the graphene_box_t to initialize |
|
n_points |
the number graphene_point3d_t in the |
|
points |
an array of graphene_point3d_t. |
[array length=n_points] |
Since: 1.2
graphene_box_t * graphene_box_init_from_vec3 (graphene_box_t *box
,const graphene_vec3_t *min
,const graphene_vec3_t *max
);
Initializes the given graphene_box_t with two vertices stored inside graphene_vec3_t.
box |
the graphene_box_t to initialize |
|
min |
the coordinates of the minimum vertex. |
[nullable] |
max |
the coordinates of the maximum vertex. |
[nullable] |
Since: 1.2
graphene_box_t * graphene_box_init_from_vectors (graphene_box_t *box
,unsigned int n_vectors
,const graphene_vec3_t *vectors
);
Initializes the given graphene_box_t with the given array of vertices.
If n_vectors
is 0, the returned box is initialized with
graphene_box_empty()
.
box |
the graphene_box_t to initialize |
|
n_vectors |
the number graphene_point3d_t in the |
|
vectors |
an array of graphene_vec3_t. |
[array length=n_vectors] |
Since: 1.2
bool graphene_box_equal (const graphene_box_t *a
,const graphene_box_t *b
);
Checks whether the two given boxes are equal.
Since: 1.2
void graphene_box_expand (const graphene_box_t *box
,const graphene_point3d_t *point
,graphene_box_t *res
);
Expands the dimensions of box
to include the coordinates at point
.
box |
||
point |
the coordinates of the point to include |
|
res |
return location for the expanded box. |
[out caller-allocates] |
Since: 1.2
void graphene_box_expand_scalar (const graphene_box_t *box
,float scalar
,graphene_box_t *res
);
Expands the dimensions of box
by the given scalar
value.
If scalar
is positive, the graphene_box_t will grow; if scalar
is
negative, the graphene_box_t will shrink.
box |
||
scalar |
a scalar value |
|
res |
return location for the expanded box. |
[out caller-allocates] |
Since: 1.2
void graphene_box_expand_vec3 (const graphene_box_t *box
,const graphene_vec3_t *vec
,graphene_box_t *res
);
Expands the dimensions of box
to include the coordinates of the
given vector.
box |
||
vec |
the coordinates of the point to include, as a graphene_vec3_t |
|
res |
return location for the expanded box. |
[out caller-allocates] |
Since: 1.2
void graphene_box_get_min (const graphene_box_t *box
,graphene_point3d_t *min
);
Retrieves the coordinates of the minimum point of the given graphene_box_t.
Since: 1.2
void graphene_box_get_max (const graphene_box_t *box
,graphene_point3d_t *max
);
Retrieves the coordinates of the maximum point of the given graphene_box_t.
Since: 1.2
void graphene_box_get_center (const graphene_box_t *box
,graphene_point3d_t *center
);
Retrieves the coordinates of the center of a graphene_box_t.
Since: 1.2
float
graphene_box_get_depth (const graphene_box_t *box
);
Retrieves the size of the box
on the Z axis.
Since: 1.2
float
graphene_box_get_height (const graphene_box_t *box
);
Retrieves the size of the box
on the Y axis.
Since: 1.2
float
graphene_box_get_width (const graphene_box_t *box
);
Retrieves the size of the box
on the X axis.
Since: 1.2
void graphene_box_get_size (const graphene_box_t *box
,graphene_vec3_t *size
);
Retrieves the size of the box on all three axes, and stores
it into the given size
vector.
Since: 1.2
void graphene_box_get_bounding_sphere (const graphene_box_t *box
,graphene_sphere_t *sphere
);
Computes the bounding graphene_sphere_t capable of containing the given graphene_box_t.
Since: 1.2
void graphene_box_get_vertices (const graphene_box_t *box
,graphene_vec3_t vertices[]
);
Computes the vertices of the given graphene_box_t.
box |
||
vertices |
return location for an array of 8 graphene_vec3_t. |
[out][array fixed-size=8] |
Since: 1.2
void graphene_box_union (const graphene_box_t *a
,const graphene_box_t *b
,graphene_box_t *res
);
Unions the two given graphene_box_t.
Since: 1.2
bool graphene_box_intersection (const graphene_box_t *a
,const graphene_box_t *b
,graphene_box_t *res
);
Intersects the two given graphene_box_t.
If the two boxes do not intersect, res
will contain a degenerate box
initialized with graphene_box_empty()
.
Since: 1.2
bool graphene_box_contains_box (const graphene_box_t *a
,const graphene_box_t *b
);
Checks whether the graphene_box_t a
contains the given
graphene_box_t b
.
Since: 1.2
bool graphene_box_contains_point (const graphene_box_t *box
,const graphene_point3d_t *point
);
Checks whether box
contains the given point
.
Since: 1.2
const graphene_box_t *
graphene_box_zero (void
);
A graphene_box_t with both the minimum and maximum vertices set at (0, 0, 0).
The returned value is owned by Graphene and should not be modified or freed.
Since: 1.2
const graphene_box_t *
graphene_box_one (void
);
A graphene_box_t with the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).
The returned value is owned by Graphene and should not be modified or freed.
Since: 1.2
const graphene_box_t *
graphene_box_minus_one (void
);
A graphene_box_t with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).
The returned value is owned by Graphene and should not be modified or freed.
Since: 1.2
const graphene_box_t *
graphene_box_one_minus_one (void
);
A graphene_box_t with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).
The returned value is owned by Graphene and should not be modified or freed.
Since: 1.2
const graphene_box_t *
graphene_box_empty (void
);
A degenerate graphene_box_t that can only be expanded.
The returned value is owned by Graphene and should not be modified or freed.
Since: 1.2
const graphene_box_t *
graphene_box_infinite (void
);
A degenerate graphene_box_t that cannot be expanded.
The returned value is owned by Graphene and should not be modified or freed.
Since: 1.2
typedef struct { } graphene_box_t;
A 3D box, described as the volume between a minimum and a maximum vertices.
Since: 1.2