Top |
#define | GRAPHENE_POINT3D_INIT() |
graphene_point3d_t * | graphene_point3d_alloc () |
void | graphene_point3d_free () |
graphene_point3d_t * | graphene_point3d_init () |
graphene_point3d_t * | graphene_point3d_init_from_point () |
graphene_point3d_t * | graphene_point3d_init_from_vec3 () |
void | graphene_point3d_to_vec3 () |
bool | graphene_point3d_equal () |
bool | graphene_point3d_near () |
void | graphene_point3d_scale () |
void | graphene_point3d_cross () |
float | graphene_point3d_dot () |
float | graphene_point3d_length () |
void | graphene_point3d_normalize () |
void | graphene_point3d_normalize_viewport () |
float | graphene_point3d_distance () |
void | graphene_point3d_interpolate () |
const graphene_point3d_t * | graphene_point3d_zero () |
graphene_point3d_t is a data structure capable of describing a point with three coordinates:
graphene_point3d_t.x
graphene_point3d_t.y
graphene_point3d_t.z
#define GRAPHENE_POINT3D_INIT(_x,_y,_z) (graphene_point3d_t) { .x = (_x), .y = (_y), .z = (_z) }
Initializes a graphene_point3d_t to the given coordinates when declaring it.
Since: 1.0
graphene_point3d_t *
graphene_point3d_alloc (void
);
Allocates a graphene_point3d_t structure.
[constructor]
the newly allocated structure.
Use graphene_point3d_free()
to free the resources
allocated by this function.
[transfer full]
Since: 1.0
void
graphene_point3d_free (graphene_point3d_t *p
);
Frees the resources allocated via graphene_point3d_alloc()
.
Since: 1.0
graphene_point3d_t * graphene_point3d_init (graphene_point3d_t *p
,float x
,float y
,float z
);
Initializes a graphene_point3d_t with the given coordinates.
p |
the graphene_point3d_t to initialize |
|
x |
the X coordinate of the point |
|
y |
the Y coordinate of the point |
|
z |
the Z coordinate of the point |
Since: 1.0
graphene_point3d_t * graphene_point3d_init_from_point (graphene_point3d_t *p
,const graphene_point3d_t *src
);
Initializes a graphene_point3d_t using the coordinates of another graphene_point3d_t.
Since: 1.0
graphene_point3d_t * graphene_point3d_init_from_vec3 (graphene_point3d_t *p
,const graphene_vec3_t *v
);
Initializes a graphene_point3d_t using the components of a graphene_vec3_t.
Since: 1.0
void graphene_point3d_to_vec3 (const graphene_point3d_t *p
,graphene_vec3_t *v
);
Stores the coordinates of a graphene_point3d_t into a graphene_vec3_t.
Since: 1.0
bool graphene_point3d_equal (const graphene_point3d_t *a
,const graphene_point3d_t *b
);
Checks whether two given points are equal.
Since: 1.0
bool graphene_point3d_near (const graphene_point3d_t *a
,const graphene_point3d_t *b
,float epsilon
);
Checks whether the two points are near each other, within
an epsilon
factor.
Since: 1.0
void graphene_point3d_scale (const graphene_point3d_t *p
,float factor
,graphene_point3d_t *res
);
Scales the coordinates of the given graphene_point3d_t by
the given factor
.
p |
||
factor |
the scaling factor |
|
res |
return location for the scaled point. |
[out caller-allocates] |
Since: 1.0
void graphene_point3d_cross (const graphene_point3d_t *a
,const graphene_point3d_t *b
,graphene_point3d_t *res
);
Computes the cross product of the two given graphene_point3d_t.
Since: 1.0
float graphene_point3d_dot (const graphene_point3d_t *a
,const graphene_point3d_t *b
);
Computes the dot product of the two given graphene_point3d_t.
Since: 1.0
float
graphene_point3d_length (const graphene_point3d_t *p
);
Computes the length of the vector represented by the coordinates of the given graphene_point3d_t.
Since: 1.0
void graphene_point3d_normalize (const graphene_point3d_t *p
,graphene_point3d_t *res
);
Computes the normalization of the vector represented by the coordinates of the given graphene_point3d_t.
Since: 1.0
void graphene_point3d_normalize_viewport (const graphene_point3d_t *p
,const graphene_rect_t *viewport
,float z_near
,float z_far
,graphene_point3d_t *res
);
Normalizes the coordinates of a graphene_point3d_t using the given viewport and clipping planes.
The coordinates of the resulting graphene_point3d_t will be in the [ -1, 1 ] range.
p |
||
viewport |
a graphene_rect_t representing a viewport |
|
z_near |
the coordinate of the near clipping plane, or 0 for the default near clipping plane |
|
z_far |
the coordinate of the far clipping plane, or 1 for the default far clipping plane |
|
res |
the return location for the normalized graphene_point3d_t. |
[out caller-allocates] |
Since: 1.4
float graphene_point3d_distance (const graphene_point3d_t *a
,const graphene_point3d_t *b
,graphene_vec3_t *delta
);
Computes the distance between the two given graphene_point3d_t.
a |
||
b |
||
delta |
return location for the distance components on the X, Y, and Z axis. |
[out caller-allocates][optional] |
Since: 1.4
void graphene_point3d_interpolate (const graphene_point3d_t *a
,const graphene_point3d_t *b
,double factor
,graphene_point3d_t *res
);
Linearly interpolates each component of a
and b
using the
provided factor
, and places the result in res
.
a |
||
b |
||
factor |
the interpolation factor |
|
res |
the return location for the interpolated graphene_point3d_t. |
[out caller-allocates] |
Since: 1.0
const graphene_point3d_t *
graphene_point3d_zero (void
);
Retrieves a constant point with all three coordinates set to 0.
Since: 1.0
#define GRAPHENE_POINT3D_INIT_ZERO GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f)
Initializes a graphene_point3d_t to (0, 0, 0) when declaring it.
Since: 1.0
typedef struct { float x; float y; float z; } graphene_point3d_t;
A point with three components: X, Y, and Z.
Since: 1.0