A 3D box, described as the volume between a minimum and
a maximum vertices.
Allocates a new #graphene_box_t.
The contents of the returned structure are undefined.
the newly allocated #graphene_box_t structure.
Use graphene_box_free() to free the resources allocated by this function
Checks whether the #graphene_box_t @a contains the given
#graphene_box_t @b.
`true` if the box is contained in the given box
a #graphene_box_t
a #graphene_box_t
Checks whether @box contains the given @point.
`true` if the point is contained in the given box
a #graphene_box_t
the coordinates to check
Checks whether the two given boxes are equal.
`true` if the boxes are equal
a #graphene_box_t
a #graphene_box_t
Expands the dimensions of @box to include the coordinates at @point.
a #graphene_box_t
the coordinates of the point to include
return location for the expanded box
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.
a #graphene_box_t
a scalar value
return location for the expanded box
Expands the dimensions of @box to include the coordinates of the
given vector.
a #graphene_box_t
the coordinates of the point to include, as a #graphene_vec3_t
return location for the expanded box
Frees the resources allocated by graphene_box_alloc().
a #graphene_box_t
Computes the bounding #graphene_sphere_t capable of containing the given
#graphene_box_t.
a #graphene_box_t
return location for the bounding sphere
Retrieves the coordinates of the center of a #graphene_box_t.
a #graphene_box_t
return location for the coordinates of
the center
Retrieves the size of the @box on the Z axis.
the depth of the box
a #graphene_box_t
Retrieves the size of the @box on the Y axis.
the height of the box
a #graphene_box_t
Retrieves the coordinates of the maximum point of the given
#graphene_box_t.
a #graphene_box_t
return location for the maximum point
Retrieves the coordinates of the minimum point of the given
#graphene_box_t.
a #graphene_box_t
return location for the minimum point
Retrieves the size of the box on all three axes, and stores
it into the given @size vector.
a #graphene_box_t
return location for the size
Computes the vertices of the given #graphene_box_t.
a #graphene_box_t
return location for an array
of 8 #graphene_vec3_t
Retrieves the size of the @box on the X axis.
the width of the box
a #graphene_box_t
Initializes the given #graphene_box_t with two vertices.
the initialized #graphene_box_t
the #graphene_box_t to initialize
the coordinates of the minimum vertex
the coordinates of the maximum vertex
Initializes the given #graphene_box_t with the vertices of
another #graphene_box_t.
the initialized #graphene_box_t
the #graphene_box_t to initialize
a #graphene_box_t
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().
the initialized #graphene_box_t
the #graphene_box_t to initialize
the number #graphene_point3d_t in the @points array
an array of #graphene_point3d_t
Initializes the given #graphene_box_t with two vertices
stored inside #graphene_vec3_t.
the initialized #graphene_box_t
the #graphene_box_t to initialize
the coordinates of the minimum vertex
the coordinates of the maximum vertex
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().
the initialized #graphene_box_t
the #graphene_box_t to initialize
the number #graphene_point3d_t in the @vectors array
an array of #graphene_vec3_t
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().
true if the two boxes intersect
a #graphene_box_t
a #graphene_box_t
return location for the result
Unions the two given #graphene_box_t.
a #graphene_box_t
the box to union to @a
return location for the result
A degenerate #graphene_box_t that can only be expanded.
The returned value is owned by Graphene and should not be modified or freed.
a #graphene_box_t
A degenerate #graphene_box_t that cannot be expanded.
The returned value is owned by Graphene and should not be modified or freed.
a #graphene_box_t
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.
a #graphene_box_t
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.
a #graphene_box_t
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.
a #graphene_box_t
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.
a #graphene_box_t
Describe a rotation using Euler angles.
The contents of the #graphene_euler_t structure are private
and should never be accessed directly.
Allocates a new #graphene_euler_t.
The contents of the returned structure are undefined.
the newly allocated #graphene_euler_t
Checks if two #graphene_euler_t are equal.
`true` if the two #graphene_euler_t are equal
a #graphene_euler_t
a #graphene_euler_t
Frees the resources allocated by graphene_euler_alloc().
a #graphene_euler_t
Retrieves the order used to apply the rotations described in the
#graphene_euler_t structure, when converting to and from other
structures, like #graphene_quaternion_t and #graphene_matrix_t.
This function does not return the %GRAPHENE_EULER_ORDER_DEFAULT
enumeration value; it will return the effective order of rotation
instead.
the order used to apply the rotations
a #graphene_euler_t
Retrieves the rotation angle on the X axis, in degrees.
the rotation angle
a #graphene_euler_t
Retrieves the rotation angle on the Y axis, in degrees.
the rotation angle
a #graphene_euler_t
Retrieves the rotation angle on the Z axis, in degrees.
the rotation angle
a #graphene_euler_t
Initializes a #graphene_euler_t using the given angles.
The order of the rotations is %GRAPHENE_EULER_ORDER_DEFAULT.
the initialized #graphene_euler_t
the #graphene_euler_t to initialize
rotation angle on the X axis, in degrees
rotation angle on the Y axis, in degrees
rotation angle on the Z axis, in degrees
Initializes a #graphene_euler_t using the angles and order of
another #graphene_euler_t.
If the #graphene_euler_t @src is %NULL, this function is equivalent
to calling graphene_euler_init() with all angles set to 0.
the initialized #graphene_euler_t
the #graphene_euler_t to initialize
a #graphene_euler_t
Initializes a #graphene_euler_t using the given rotation matrix.
If the #graphene_matrix_t @m is %NULL, the #graphene_euler_t will
be initialized with all angles set to 0.
the initialized #graphene_euler_t
the #graphene_euler_t to initialize
a rotation matrix
the order used to apply the rotations
Initializes a #graphene_euler_t using the given normalized quaternion.
If the #graphene_quaternion_t @q is %NULL, the #graphene_euler_t will
be initialized with all angles set to 0.
the initialized #graphene_euler_t
a #graphene_euler_t
a normalized #graphene_quaternion_t
the order used to apply the rotations
Initializes a #graphene_euler_t using the angles contained in a
#graphene_vec3_t.
If the #graphene_vec3_t @v is %NULL, the #graphene_euler_t will be
initialized with all angles set to 0.
the initialized #graphene_euler_t
the #graphene_euler_t to initialize
a #graphene_vec3_t containing the rotation
angles in degrees
the order used to apply the rotations
Initializes a #graphene_euler_t with the given angles and @order.
the initialized #graphene_euler_t
the #graphene_euler_t to initialize
rotation angle on the X axis, in degrees
rotation angle on the Y axis, in degrees
rotation angle on the Z axis, in degrees
the order used to apply the rotations
Reorders a #graphene_euler_t using @order.
This function is equivalent to creating a #graphene_quaternion_t from the
given #graphene_euler_t, and then converting the quaternion into another
#graphene_euler_t.
a #graphene_euler_t
the new order
return location for the reordered
#graphene_euler_t
Converts a #graphene_euler_t into a transformation matrix expressing
the extrinsic composition of rotations described by the Euler angles.
The rotations are applied over the reference frame axes in the order
associated with the #graphene_euler_t; for instance, if the order
used to initialize @e is %GRAPHENE_EULER_ORDER_XYZ:
* the first rotation moves the body around the X axis with
an angle φ
* the second rotation moves the body around the Y axis with
an angle of ϑ
* the third rotation moves the body around the Z axis with
an angle of ψ
The rotation sign convention is left-handed, to preserve compatibility
between Euler-based, quaternion-based, and angle-axis-based rotations.
a #graphene_euler_t
return location for a #graphene_matrix_t
Retrieves the angles of a #graphene_euler_t and initializes a
#graphene_vec3_t with them.
a #graphene_euler_t
return location for a #graphene_vec3_t
Specify the order of the rotations on each axis.
The %GRAPHENE_EULER_ORDER_DEFAULT value is special, and is used
as an alias for one of the other orders.
Rotate in the default order; the
default order is one of the following enumeration values
Rotate in the X, Y, and Z order
Rotate in the Y, Z, and X order
Rotate in the Z, X, and Y order
Rotate in the X, Z, and Y order
Rotate in the Y, X, and Z order
Rotate in the Z, Y, and X order
A 3D volume delimited by 2D clip planes.
The contents of the `graphene_frustum_t` are private, and should not be
modified directly.
Allocates a new #graphene_frustum_t structure.
The contents of the returned structure are undefined.
the newly allocated #graphene_frustum_t
structure. Use graphene_frustum_free() to free the resources
allocated by this function.
Checks whether a point is inside the volume defined by the given
#graphene_frustum_t.
`true` if the point is inside the frustum
a #graphene_frustum_t
a #graphene_point3d_t
Checks whether the two given #graphene_frustum_t are equal.
`true` if the given frustums are equal
a #graphene_frustum_t
a #graphene_frustum_t
Frees the resources allocated by graphene_frustum_alloc().
a #graphene_frustum_t
Retrieves the planes that define the given #graphene_frustum_t.
a #graphene_frustum_t
return location for an array
of 6 #graphene_plane_t
Initializes the given #graphene_frustum_t using the provided
clipping planes.
the initialized frustum
the #graphene_frustum_t to initialize
a clipping plane
a clipping plane
a clipping plane
a clipping plane
a clipping plane
a clipping plane
Initializes the given #graphene_frustum_t using the clipping
planes of another #graphene_frustum_t.
the initialized frustum
the #graphene_frustum_t to initialize
a #graphene_frustum_t
Initializes a #graphene_frustum_t using the given @matrix.
the initialized frustum
a #graphene_frustum_t
a #graphene_matrix_t
Checks whether the given @box intersects a plane of
a #graphene_frustum_t.
`true` if the box intersects the frustum
a #graphene_frustum_t
a #graphene_box_t
Checks whether the given @sphere intersects a plane of
a #graphene_frustum_t.
`true` if the sphere intersects the frustum
a #graphene_frustum_t
a #graphene_sphere_t
A structure capable of holding a 4x4 matrix.
The contents of the #graphene_matrix_t structure are private and
should never be accessed directly.
Allocates a new #graphene_matrix_t.
the newly allocated matrix
Computes the determinant of the given matrix.
the value of the determinant
a #graphene_matrix_t
Checks whether the two given #graphene_matrix_t matrices are equal.
`true` if the two matrices are equal, and `false` otherwise
a #graphene_matrix_t
a #graphene_matrix_t
Checks whether the two given #graphene_matrix_t matrices are
byte-by-byte equal.
While this function is faster than graphene_matrix_equal(), it
can also return false negatives, so it should be used in
conjuction with either graphene_matrix_equal() or
graphene_matrix_near(). For instance:
|[<!-- language="C" -->
if (graphene_matrix_equal_fast (a, b))
{
// matrices are definitely the same
}
else
{
if (graphene_matrix_equal (a, b))
// matrices contain the same values within an epsilon of FLT_EPSILON
else if (graphene_matrix_near (a, b, 0.0001))
// matrices contain the same values within an epsilon of 0.0001
else
// matrices are not equal
}
]|
`true` if the matrices are equal. and `false` otherwise
a #graphene_matrix_t
a #graphene_matrix_t
Frees the resources allocated by graphene_matrix_alloc().
a #graphene_matrix_t
Retrieves the given row vector at @index_ inside a matrix.
a #graphene_matrix_t
the index of the row vector, between 0 and 3
return location for the #graphene_vec4_t
that is used to store the row vector
Retrieves the value at the given @row and @col index.
the value at the given indices
a #graphene_matrix_t
the row index
the column index
Retrieves the scaling factor on the X axis in @m.
the value of the scaling factor
a #graphene_matrix_t
Retrieves the translation component on the X axis from @m.
the translation component
a #graphene_matrix_t
Retrieves the scaling factor on the Y axis in @m.
the value of the scaling factor
a #graphene_matrix_t
Retrieves the translation component on the Y axis from @m.
the translation component
a #graphene_matrix_t
Retrieves the scaling factor on the Z axis in @m.
the value of the scaling factor
a #graphene_matrix_t
Retrieves the translation component on the Z axis from @m.
the translation component
a #graphene_matrix_t
Initializes a #graphene_matrix_t from the values of an affine
transformation matrix.
The arguments map to the following matrix layout:
|[<!-- language="plain" -->
⎛ xx yx ⎞ ⎛ a b 0 ⎞
⎜ xy yy ⎟ = ⎜ c d 0 ⎟
⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
]|
This function can be used to convert between an affine matrix type
from other libraries and a #graphene_matrix_t.
the initialized matrix
a #graphene_matrix_t
the xx member
the yx member
the xy member
the yy member
the x0 member
the y0 member
Initializes a #graphene_matrix_t with the given array of floating
point values.
the initialized matrix
a #graphene_matrix_t
an array of at least 16 floating
point values
Initializes a #graphene_matrix_t using the values of the
given matrix.
the initialized matrix
a #graphene_matrix_t
a #graphene_matrix_t
Initializes a #graphene_matrix_t with the given four row
vectors.
the initialized matrix
a #graphene_matrix_t
the first row vector
the second row vector
the third row vector
the fourth row vector
Initializes a #graphene_matrix_t compatible with #graphene_frustum_t.
See also: graphene_frustum_init_from_matrix()
the initialized matrix
a #graphene_matrix_t
distance of the left clipping plane
distance of the right clipping plane
distance of the bottom clipping plane
distance of the top clipping plane
distance of the near clipping plane
distance of the far clipping plane
Initializes a #graphene_matrix_t with the identity matrix.
the initialized matrix
a #graphene_matrix_t
Initializes a #graphene_matrix_t so that it positions the "camera"
at the given @eye coordinates towards an object at the @center
coordinates. The top of the camera is aligned to the direction
of the @up vector.
the initialized matrix
a #graphene_matrix_t
the vector describing the position to look from
the vector describing the position to look at
the vector describing the world's upward direction; usually,
this is the graphene_vec3_y_axis() vector
Initializes a #graphene_matrix_t with an orthographic projection.
the initialized matrix
a #graphene_matrix_t
the left edge of the clipping plane
the right edge of the clipping plane
the top edge of the clipping plane
the bottom edge of the clipping plane
the distance of the near clipping plane
the distance of the far clipping plane
Initializes a #graphene_matrix_t with a perspective projection.
the initialized matrix
a #graphene_matrix_t
the field of view angle, in degrees
the aspect value
the near Z plane
the far Z plane
Initializes @m to represent a rotation of @angle degrees on
the axis represented by the @axis vector.
the initialized matrix
a #graphene_matrix_t
the rotation angle, in degrees
the axis vector as a #graphene_vec3_t
Initializes a #graphene_matrix_t with the given scaling factors.
the initialized matrix
a #graphene_matrix_t
the scale factor on the X axis
the scale factor on the Y axis
the scale factor on the Z axis
Initializes a #graphene_matrix_t with a skew transformation
with the given factors.
the initialized matrix
a #graphene_matrix_t
skew factor, in radians, on the X axis
skew factor, in radians, on the Y axis
Initializes a #graphene_matrix_t with a translation to the
given coordinates.
the initialized matrix
a #graphene_matrix_t
the translation coordinates
Linearly interpolates the two given #graphene_matrix_t by
interpolating the decomposed transformations separately.
If either matrix cannot be reduced to their transformations
then the interpolation cannot be performed, and this function
will return an identity matrix.
a #graphene_matrix_t
a #graphene_matrix_t
the linear interpolation factor
return location for the
interpolated matrix
Inverts the given matrix.
`true` if the matrix is invertible
a #graphene_matrix_t
return location for the
inverse matrix
Checks whether the given #graphene_matrix_t is compatible with an
a 2D affine transformation matrix.
`true` if the matrix is compatible with an affine
transformation matrix
a #graphene_matrix_t
Checks whether a #graphene_matrix_t has a visible back face.
`true` if the back face of the matrix is visible
a #graphene_matrix_t
Checks whether the given #graphene_matrix_t is the identity matrix.
`true` if the matrix is the identity matrix
a #graphene_matrix_t
Checks whether a matrix is singular.
`true` if the matrix is singular
a #graphene_matrix_t
Multiplies two #graphene_matrix_t.
Matrix multiplication is not commutative in general; the order of the factors matters.
The product of this multiplication is (@a × @b)
a #graphene_matrix_t
a #graphene_matrix_t
return location for the matrix
result
Compares the two given #graphene_matrix_t matrices and check
whether their values are within the given @epsilon of each
other.
`true` if the two matrices are near each other, and
`false` otherwise
a #graphene_matrix_t
a #graphene_matrix_t
Normalizes the given #graphene_matrix_t.
a #graphene_matrix_t
return location for the normalized matrix
Applies a perspective of @depth to the matrix.
a #graphene_matrix_t
the depth of the perspective
return location for the
perspective matrix
Prints the contents of a matrix.
The matrix to print
Projects a #graphene_point_t using the matrix @m.
a #graphene_matrix_t
a #graphene_point_t
return location for the projected
point
Projects a #graphene_rect_t using the given matrix.
a #graphene_matrix_t
a #graphene_rect_t
return location for the projected
rectangle
Projects a #graphene_rect_t using the given matrix.
The resulting rectangle is the axis aligned bounding rectangle capable
of containing fully the projected rectangle.
a #graphene_matrix_t
a #graphene_rect_t
return location for the projected
rectangle
Adds a rotation transformation to @m, using the given @angle
and @axis vector.
This is the equivalent of calling graphene_matrix_init_rotate() and
then multiplying the matrix @m with the rotation matrix.
a #graphene_matrix_t
the rotation angle, in degrees
the rotation axis, as a #graphene_vec3_t
Adds a rotation transformation to @m, using the given
#graphene_euler_t.
a #graphene_matrix_t
a rotation described by a #graphene_euler_t
Adds a rotation transformation to @m, using the given
#graphene_quaternion_t.
This is the equivalent of calling graphene_quaternion_to_matrix() and
then multiplying @m with the rotation matrix.
a #graphene_matrix_t
a rotation described by a #graphene_quaternion_t
Adds a rotation transformation around the X axis to @m, using
the given @angle.
See also: graphene_matrix_rotate()
a #graphene_matrix_t
the rotation angle, in degrees
Adds a rotation transformation around the Y axis to @m, using
the given @angle.
See also: graphene_matrix_rotate()
a #graphene_matrix_t
the rotation angle, in degrees
Adds a rotation transformation around the Z axis to @m, using
the given @angle.
See also: graphene_matrix_rotate()
a #graphene_matrix_t
the rotation angle, in degrees
Adds a scaling transformation to @m, using the three
given factors.
This is the equivalent of calling graphene_matrix_init_scale() and then
multiplying the matrix @m with the scale matrix.
a #graphene_matrix_t
scaling factor on the X axis
scaling factor on the Y axis
scaling factor on the Z axis
Adds a skew of @factor on the X and Y axis to the given matrix.
a #graphene_matrix_t
skew factor
Adds a skew of @factor on the X and Z axis to the given matrix.
a #graphene_matrix_t
skew factor
Adds a skew of @factor on the Y and Z axis to the given matrix.
a #graphene_matrix_t
skew factor
Converts a #graphene_matrix_t to an affine transformation
matrix, if the given matrix is compatible.
The returned values have the following layout:
|[<!-- language="plain" -->
⎛ xx yx ⎞ ⎛ a b 0 ⎞
⎜ xy yy ⎟ = ⎜ c d 0 ⎟
⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
]|
This function can be used to convert between a #graphene_matrix_t
and an affine matrix type from other libraries.
`true` if the matrix is compatible with an affine
transformation matrix
a #graphene_matrix_t
return location for the xx member
return location for the yx member
return location for the xy member
return location for the yy member
return location for the x0 member
return location for the y0 member
Converts a #graphene_matrix_t to an array of floating point
values.
a #graphene_matrix_t
return location
for an array of floating point values. The array must be capable
of holding at least 16 values.
Transforms each corner of a #graphene_rect_t using the given matrix @m.
The result is the axis aligned bounding rectangle containing the coplanar
quadrilateral.
a #graphene_matrix_t
a #graphene_rect_t
return location for the bounds
of the transformed rectangle
Transforms the vertices of a #graphene_box_t using the given matrix @m.
The result is the axis aligned bounding box containing the transformed
vertices.
a #graphene_matrix_t
a #graphene_box_t
return location for the bounds
of the transformed box
Transforms the given #graphene_point_t using the matrix @m.
Unlike graphene_matrix_transform_vec3(), this function will take into
account the fourth row vector of the #graphene_matrix_t when computing
the dot product of each row vector of the matrix.
See also: graphene_simd4x4f_point3_mul()
a #graphene_matrix_t
a #graphene_point_t
return location for the
transformed #graphene_point_t
Transforms the given #graphene_point3d_t using the matrix @m.
Unlike graphene_matrix_transform_vec3(), this function will take into
account the fourth row vector of the #graphene_matrix_t when computing
the dot product of each row vector of the matrix.
a #graphene_matrix_t
a #graphene_point3d_t
return location for the result
Transform a #graphene_ray_t using the given matrix @m.
a #graphene_matrix_t
a #graphene_ray_t
return location for the
transformed ray
Transforms each corner of a #graphene_rect_t using the given matrix @m.
The result is a coplanar quadrilateral.
a #graphene_matrix_t
a #graphene_rect_t
return location for the
transformed quad
Transforms a #graphene_sphere_t using the given matrix @m. The
result is the bounding sphere containing the transformed sphere.
a #graphene_matrix_t
a #graphene_sphere_t
return location for the bounds
of the transformed sphere
Transforms the given #graphene_vec3_t using the matrix @m.
This function will multiply the X, Y, and Z row vectors of the matrix @m
with the corresponding components of the vector @v. The W row vector will
be ignored.
See also: graphene_simd4x4f_vec3_mul()
a #graphene_matrix_t
a #graphene_vec3_t
return location for a #graphene_vec3_t
Transforms the given #graphene_vec4_t using the matrix @m.
See also: graphene_simd4x4f_vec4_mul()
a #graphene_matrix_t
a #graphene_vec4_t
return location for a #graphene_vec4_t
Adds a translation transformation to @m using the coordinates
of the given #graphene_point3d_t.
This is the equivalent of calling graphene_matrix_init_translate() and
then multiplying @m with the translation matrix.
a #graphene_matrix_t
a #graphene_point3d_t
Transposes the given matrix.
a #graphene_matrix_t
return location for the
transposed matrix
Unprojects the given @point using the @projection matrix and
a @modelview matrix.
a #graphene_matrix_t for the projection matrix
a #graphene_matrix_t for the modelview matrix; this is
the inverse of the modelview used when projecting the point
a #graphene_point3d_t with the coordinates of the point
return location for the unprojected
point
Undoes the transformation on the corners of a #graphene_rect_t using the
given matrix, within the given axis aligned rectangular @bounds.
a #graphene_matrix_t
a #graphene_rect_t
the bounds of the transformation
return location for the
untransformed rectangle
Undoes the transformation of a #graphene_point_t using the
given matrix, within the given axis aligned rectangular @bounds.
`true` if the point was successfully untransformed
a #graphene_matrix_t
a #graphene_point_t
the bounds of the transformation
return location for the
untransformed point
A 2D plane that extends infinitely in a 3D volume.
The contents of the `graphene_plane_t` are private, and should not be
modified directly.
Allocates a new #graphene_plane_t structure.
The contents of the returned structure are undefined.
the newly allocated #graphene_plane_t.
Use graphene_plane_free() to free the resources allocated by
this function
Computes the distance of @point from a #graphene_plane_t.
the distance of the given #graphene_point3d_t from the plane
a #graphene_plane_t
a #graphene_point3d_t
Checks whether the two given #graphene_plane_t are equal.
`true` if the given planes are equal
a #graphene_plane_t
a #graphene_plane_t
Frees the resources allocated by graphene_plane_alloc().
a #graphene_plane_t
Retrieves the distance along the normal vector of the
given #graphene_plane_t from the origin.
the constant value of the plane
a #graphene_plane_t
Retrieves the normal vector pointing towards the origin of the
given #graphene_plane_t.
a #graphene_plane_t
return location for the normal vector
Initializes the given #graphene_plane_t using the given @normal vector
and @constant values.
the initialized plane
the #graphene_plane_t to initialize
a unit length normal vector defining the plane
pointing towards the origin; if unset, we use the X axis by default
the distance from the origin to the plane along the
normal vector; the sign determines the half-space occupied by the
plane
Initializes the given #graphene_plane_t using the normal
vector and constant of another #graphene_plane_t.
the initialized plane
the #graphene_plane_t to initialize
a #graphene_plane_t
Initializes the given #graphene_plane_t using the given normal vector
and an arbitrary co-planar point.
the initialized plane
the #graphene_plane_t to initialize
a normal vector defining the plane pointing towards the origin
a #graphene_point3d_t
Initializes the given #graphene_plane_t using the 3 provided co-planar
points.
The winding order is counter-clockwise, and determines which direction
the normal vector will point.
the initialized plane
the #graphene_plane_t to initialize
a #graphene_point3d_t
a #graphene_point3d_t
a #graphene_point3d_t
Initializes the given #graphene_plane_t using the components of
the given #graphene_vec4_t vector.
the initialized plane
the #graphene_plane_t to initialize
a #graphene_vec4_t containing the normal vector in its first
three components, and the distance in its fourth component
Negates the normal vector and constant of a #graphene_plane_t, effectively
mirroring the plane across the origin.
a #graphene_plane_t
return location for the negated plane
Normalizes the vector of the given #graphene_plane_t,
and adjusts the constant accordingly.
a #graphene_plane_t
return location for the normalized plane
A point with two coordinates.
the X coordinate of the point
the Y coordinate of the point
Allocates a new #graphene_point_t structure.
The coordinates of the returned point are (0, 0).
It's possible to chain this function with graphene_point_init()
or graphene_point_init_from_point(), e.g.:
|[<!-- language="C" -->
graphene_point_t *
point_new (float x, float y)
{
return graphene_point_init (graphene_point_alloc (), x, y);
}
graphene_point_t *
point_copy (const graphene_point_t *p)
{
return graphene_point_init_from_point (graphene_point_alloc (), p);
}
]|
the newly allocated #graphene_point_t.
Use graphene_point_free() to free the resources allocated by
this function.
Computes the distance between @a and @b.
the distance between the two points
a #graphene_point_t
a #graphene_point_t
distance component on the X axis
distance component on the Y axis
Checks if the two points @a and @b point to the same
coordinates.
This function accounts for floating point fluctuations; if
you want to control the fuzziness of the match, you can use
graphene_point_near() instead.
`true` if the points have the same coordinates
a #graphene_point_t
a #graphene_point_t
Frees the resources allocated by graphene_point_alloc().
a #graphene_point_t
Initializes @p to the given @x and @y coordinates.
It's safe to call this function multiple times.
the initialized point
a #graphene_point_t
the X coordinate
the Y coordinate
Initializes @p with the same coordinates of @src.
the initialized point
a #graphene_point_t
the #graphene_point_t to use
Initializes @p with the coordinates inside the given #graphene_vec2_t.
the initialized point
the #graphene_point_t to initialize
a #graphene_vec2_t
Linearly interpolates the coordinates of @a and @b using the
given @factor.
a #graphene_point_t
a #graphene_point_t
the linear interpolation factor
return location for the interpolated
point
Checks whether the two points @a and @b are within
the threshold of @epsilon.
`true` if the distance is within @epsilon
a #graphene_point_t
a #graphene_point_t
threshold between the two points
Stores the coordinates of the given #graphene_point_t into a
#graphene_vec2_t.
a #graphene_point_t
return location for the vertex
Returns a point fixed at (0, 0).
a fixed point
A point with three components: X, Y, and Z.
the X coordinate
the Y coordinate
the Z coordinate
Allocates a #graphene_point3d_t structure.
the newly allocated structure.
Use graphene_point3d_free() to free the resources
allocated by this function.
Computes the cross product of the two given #graphene_point3d_t.
a #graphene_point3d_t
a #graphene_point3d_t
return location for the cross
product
Computes the distance between the two given #graphene_point3d_t.
the distance between two points
a #graphene_point3d_t
a #graphene_point3d_t
return location for the distance
components on the X, Y, and Z axis
Computes the dot product of the two given #graphene_point3d_t.
the value of the dot product
a #graphene_point3d_t
a #graphene_point3d_t
Checks whether two given points are equal.
`true` if the points are equal
a #graphene_point3d_t
a #graphene_point3d_t
Frees the resources allocated via graphene_point3d_alloc().
a #graphene_point3d_t
Initializes a #graphene_point3d_t with the given coordinates.
the initialized #graphene_point3d_t
the #graphene_point3d_t to initialize
the X coordinate of the point
the Y coordinate of the point
the Z coordinate of the point
Initializes a #graphene_point3d_t using the coordinates of
another #graphene_point3d_t.
the initialized point
a #graphene_point3d_t
a #graphene_point3d_t
Initializes a #graphene_point3d_t using the components
of a #graphene_vec3_t.
the initialized #graphene_point3d_t
a #graphene_point3d_t
a #graphene_vec3_t
Linearly interpolates each component of @a and @b using the
provided @factor, and places the result in @res.
a #graphene_point3d_t
a #graphene_point3d_t
the interpolation factor
the return location for the
interpolated #graphene_point3d_t
Computes the length of the vector represented by the
coordinates of the given #graphene_point3d_t.
the length of the vector represented by the point
a #graphene_point3d_t
Checks whether the two points are near each other, within
an @epsilon factor.
`true` if the points are near each other
a #graphene_point3d_t
a #graphene_point3d_t
fuzzyness factor
Computes the normalization of the vector represented by the
coordinates of the given #graphene_point3d_t.
a #graphene_point3d_t
return location for the normalized
#graphene_point3d_t
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.
a #graphene_point3d_t
a #graphene_rect_t representing a viewport
the coordinate of the near clipping plane, or 0 for
the default near clipping plane
the coordinate of the far clipping plane, or 1 for the
default far clipping plane
the return location for the
normalized #graphene_point3d_t
Scales the coordinates of the given #graphene_point3d_t by
the given @factor.
a #graphene_point3d_t
the scaling factor
return location for the scaled point
Stores the coordinates of a #graphene_point3d_t into a
#graphene_vec3_t.
a #graphene_point3d_t
return location for a #graphene_vec3_t
Retrieves a constant point with all three coordinates set to 0.
a zero point
A 4 vertex quadrilateral, as represented by four #graphene_point_t.
The contents of a #graphene_quad_t are private and should never be
accessed directly.
Allocates a new #graphene_quad_t instance.
The contents of the returned instance are undefined.
the newly created #graphene_quad_t instance
Computes the bounding rectangle of @q and places it into @r.
a #graphene_quad_t
return location for a #graphene_rect_t
Checks if the given #graphene_quad_t contains the given #graphene_point_t.
`true` if the point is inside the #graphene_quad_t
a #graphene_quad_t
a #graphene_point_t
Frees the resources allocated by graphene_quad_alloc()
a #graphene_quad_t
Retrieves the point of a #graphene_quad_t at the given index.
a #graphene_point_t
a #graphene_quad_t
the index of the point to retrieve
Initializes a #graphene_quad_t with the given points.
the initialized #graphene_quad_t
the #graphene_quad_t to initialize
the first point of the quadrilateral
the second point of the quadrilateral
the third point of the quadrilateral
the fourth point of the quadrilateral
Initializes a #graphene_quad_t using an array of points.
the initialized #graphene_quad_t
the #graphene_quad_t to initialize
an array of 4 #graphene_point_t
Initializes a #graphene_quad_t using the four corners of the
given #graphene_rect_t.
the initialized #graphene_quad_t
the #graphene_quad_t to initialize
a #graphene_rect_t
A quaternion.
The contents of the #graphene_quaternion_t structure are private
and should never be accessed directly.
Allocates a new #graphene_quaternion_t.
The contents of the returned value are undefined.
the newly allocated #graphene_quaternion_t
Computes the dot product of two #graphene_quaternion_t.
the value of the dot products
a #graphene_quaternion_t
a #graphene_quaternion_t
Checks whether the given quaternions are equal.
`true` if the quaternions are equal
a #graphene_quaternion_t
a #graphene_quaternion_t
Releases the resources allocated by graphene_quaternion_alloc().
a #graphene_quaternion_t
Initializes a #graphene_quaternion_t using the given four values.
the initialized quaternion
a #graphene_quaternion_t
the first component of the quaternion
the second component of the quaternion
the third component of the quaternion
the fourth component of the quaternion
Initializes a #graphene_quaternion_t using an @angle on a
specific @axis.
the initialized quaternion
a #graphene_quaternion_t
the rotation on a given axis, in degrees
the axis of rotation, expressed as a vector
Initializes a #graphene_quaternion_t using the values of
the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles)
on each axis.
See also: graphene_quaternion_init_from_euler()
the initialized quaternion
a #graphene_quaternion_t
rotation angle on the X axis (yaw), in degrees
rotation angle on the Y axis (pitch), in degrees
rotation angle on the Z axis (roll), in degrees
Initializes a #graphene_quaternion_t using the given #graphene_euler_t.
the initialized #graphene_quaternion_t
the #graphene_quaternion_t to initialize
a #graphene_euler_t
Initializes a #graphene_quaternion_t using the rotation components
of a transformation matrix.
the initialized quaternion
a #graphene_quaternion_t
a #graphene_matrix_t
Initializes a #graphene_quaternion_t with the values from @src.
the initialized quaternion
a #graphene_quaternion_t
a #graphene_quaternion_t
Initializes a #graphene_quaternion_t using the values of
the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles)
on each axis.
See also: graphene_quaternion_init_from_euler()
the initialized quaternion
a #graphene_quaternion_t
rotation angle on the X axis (yaw), in radians
rotation angle on the Y axis (pitch), in radians
rotation angle on the Z axis (roll), in radians
Initializes a #graphene_quaternion_t with the values from @src.
the initialized quaternion
a #graphene_quaternion_t
a #graphene_vec4_t
Initializes a #graphene_quaternion_t using the identity
transformation.
the initialized quaternion
a #graphene_quaternion_t
Inverts a #graphene_quaternion_t.
a #graphene_quaternion_t
return location for the inverted
quaternion
Normalizes a #graphene_quaternion_t.
a #graphene_quaternion_t
return location for the normalized
quaternion
Interpolates between the two given quaternions using a spherical
linear interpolation, or [SLERP](http://en.wikipedia.org/wiki/Slerp),
using the given interpolation @factor.
a #graphene_quaternion_t
a #graphene_quaternion_t
the linear interpolation factor
return location for the interpolated
quaternion
Converts a quaternion into an @angle, @axis pair.
a #graphene_quaternion_t
return location for the angle, in degrees
return location for the rotation axis
Converts a #graphene_quaternion_t to its corresponding rotations
on the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles)
on each axis.
a #graphene_quaternion_t
return location for the rotation angle on
the X axis (yaw), in degrees
return location for the rotation angle on
the Y axis (pitch), in degrees
return location for the rotation angle on
the Z axis (roll), in degrees
Converts a quaternion into a transformation matrix expressing
the rotation defined by the #graphene_quaternion_t.
a #graphene_quaternion_t
a #graphene_matrix_t
Converts a #graphene_quaternion_t to its corresponding rotations
on the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles)
on each axis.
a #graphene_quaternion_t
return location for the rotation angle on
the X axis (yaw), in radians
return location for the rotation angle on
the Y axis (pitch), in radians
return location for the rotation angle on
the Z axis (roll), in radians
Copies the components of a #graphene_quaternion_t into a
#graphene_vec4_t.
a #graphene_quaternion_t
return location for a
#graphene_vec4_t
A ray emitted from an origin in a given direction.
The contents of the `graphene_ray_t` structure are private, and should not
be modified directly.
Allocates a new #graphene_ray_t structure.
The contents of the returned structure are undefined.
the newly allocated #graphene_ray_t.
Use graphene_ray_free() to free the resources allocated by
this function
Checks whether the two given #graphene_ray_t are equal.
`true` if the given rays are equal
a #graphene_ray_t
a #graphene_ray_t
Frees the resources allocated by graphene_ray_alloc().
a #graphene_ray_t
Computes the point on the given #graphene_ray_t that is closest to the
given point @p.
a #graphene_ray_t
a #graphene_point3d_t
return location for the closest point3d
Retrieves the direction of the given #graphene_ray_t.
a #graphene_ray_t
return location for the direction
Computes the distance of the origin of the given #graphene_ray_t from the
given plane.
If the ray does not intersect the plane, this function returns `INFINITY`.
the distance of the origin of the ray from the plane
a #graphene_ray_t
a #graphene_plane_t
Computes the distance from the origin of the given ray to the given point.
the distance of the point
a #graphene_ray_t
a #graphene_point3d_t
Retrieves the origin of the given #graphene_ray_t.
a #graphene_ray_t
return location for the origin
Retrieves the coordinates of a point at the distance @t along the
given #graphene_ray_t.
a #graphene_ray_t
the distance along the ray
return location for the position
Initializes the given #graphene_ray_t using the given @origin
and @direction values.
the initialized ray
the #graphene_ray_t to initialize
the origin of the ray
the direction vector
Initializes the given #graphene_ray_t using the origin and direction
values of another #graphene_ray_t.
the initialized ray
the #graphene_ray_t to initialize
a #graphene_ray_t
Initializes the given #graphene_ray_t using the given vectors.
the initialized ray
the #graphene_ray_t to initialize
a #graphene_vec3_t
a #graphene_vec3_t
The location and size of a rectangle region.
The width and height of a #graphene_rect_t can be negative; for instance,
a #graphene_rect_t with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is
equivalent to a #graphene_rect_t with an origin of [ 10, 10 ] and a size
of [ -10, -10 ].
Application code can normalize rectangles using graphene_rect_normalize();
this function will ensure that the width and height of a rectangle are
positive values. All functions taking a #graphene_rect_t as an argument
will internally operate on a normalized copy; all functions returning a
#graphene_rect_t will always return a normalized rectangle.
the coordinates of the origin of the rectangle
the size of the rectangle
Checks whether a #graphene_rect_t contains the given coordinates.
`true` if the rectangle contains the point
a #graphene_rect_t
a #graphene_point_t
Checks whether a #graphene_rect_t fully contains the given
rectangle.
`true` if the rectangle @a fully contains @b
a #graphene_rect_t
a #graphene_rect_t
Checks whether the two given rectangle are equal.
`true` if the rectangles are equal
a #graphene_rect_t
a #graphene_rect_t
Expands a #graphene_rect_t to contain the given #graphene_point_t.
a #graphene_rect_t
a #graphene_point_t
return location for the expanded rectangle
Frees the resources allocated by graphene_rect_alloc().
a #graphene_rect_t
Retrieves the coordinates of the bottom-left corner of the given rectangle.
a #graphene_rect_t
return location for a #graphene_point_t
Retrieves the coordinates of the bottom-right corner of the given rectangle.
a #graphene_rect_t
return location for a #graphene_point_t
Retrieves the coordinates of the center of the given rectangle.
a #graphene_rect_t
return location for a #graphene_point_t
Retrieves the normalized height of the given rectangle.
the normalized height of the rectangle
a #graphene_rect_t
Retrieves the coordinates of the top-left corner of the given rectangle.
a #graphene_rect_t
return location for a #graphene_point_t
Retrieves the coordinates of the top-right corner of the given rectangle.
a #graphene_rect_t
return location for a #graphene_point_t
Computes the four vertices of a #graphene_rect_t.
a #graphene_rect_t
return location for an array
of 4 #graphene_vec2_t
Retrieves the normalized width of the given rectangle.
the normalized width of the rectangle
a #graphene_rect_t
Retrieves the normalized X coordinate of the origin of the given
rectangle.
the normalized X coordinate of the rectangle
a #graphene_rect_t
Retrieves the normalized Y coordinate of the origin of the given
rectangle.
the normalized Y coordinate of the rectangle
a #graphene_rect_t
Initializes the given #graphene_rect_t with the given values.
This function will implicitly normalize the #graphene_rect_t
before returning.
the initialized rectangle
a #graphene_rect_t
the X coordinate of the @graphene_rect_t.origin
the Y coordinate of the @graphene_rect_t.origin
the width of the @graphene_rect_t.size
the height of the @graphene_rect_t.size
Initializes @r using the given @src rectangle.
This function will implicitly normalize the #graphene_rect_t
before returning.
the initialized rectangle
a #graphene_rect_t
a #graphene_rect_t
Changes the given rectangle to be smaller, or larger depending on the
given inset parameters.
To create an inset rectangle, use positive @d_x or @d_y values; to
create a larger, encompassing rectangle, use negative @d_x or @d_y
values.
The origin of the rectangle is offset by @d_x and @d_y, while the size
is adjusted by `(2 * @d_x, 2 * @d_y)`. If @d_x and @d_y are positive
values, the size of the rectangle is decreased; if @d_x and @d_y are
negative values, the size of the rectangle is increased.
If the size of the resulting inset rectangle has a negative width or
height then the size will be set to zero.
the inset rectangle
a #graphene_rect_t
the horizontal inset
the vertical inset
Changes the given rectangle to be smaller, or larger depending on the
given inset parameters.
To create an inset rectangle, use positive @d_x or @d_y values; to
create a larger, encompassing rectangle, use negative @d_x or @d_y
values.
The origin of the rectangle is offset by @d_x and @d_y, while the size
is adjusted by `(2 * @d_x, 2 * @d_y)`. If @d_x and @d_y are positive
values, the size of the rectangle is decreased; if @d_x and @d_y are
negative values, the size of the rectangle is increased.
If the size of the resulting inset rectangle has a negative width or
height then the size will be set to zero.
a #graphene_rect_t
the horizontal inset
the vertical inset
return location for the inset rectangle
Linearly interpolates the origin and size of the two given
rectangles.
a #graphene_rect_t
a #graphene_rect_t
the linear interpolation factor
return location for the
interpolated rectangle
Computes the intersection of the two given rectangles.
![](rectangle-intersection.png)
The intersection in the image above is the blue outline.
If the two rectangles do not intersect, @res will contain
a degenerate rectangle with origin in (0, 0) and a size of 0.
`true` if the two rectangles intersect
a #graphene_rect_t
a #graphene_rect_t
return location for
a #graphene_rect_t
Normalizes the passed rectangle.
This function ensures that the size of the rectangle is made of
positive values, and that the origin is the top-left corner of
the rectangle.
the normalized rectangle
a #graphene_rect_t
Normalizes the passed rectangle.
This function ensures that the size of the rectangle is made of
positive values, and that the origin is in the top-left corner
of the rectangle.
a #graphene_rect_t
the return location for the
normalized rectangle
Offsets the origin by @d_x and @d_y.
The size of the rectangle is unchanged.
the offset rectangle
a #graphene_rect_t
the horizontal offset
the vertical offset
Offsets the origin of the given rectangle by @d_x and @d_y.
The size of the rectangle is left unchanged.
a #graphene_rect_t
the horizontal offset
the vertical offset
return location for the offset
rectangle
Rounds the origin and size of the given rectangle to
their nearest integer values; the rounding is guaranteed
to be large enough to contain the original rectangle.
This function is the equivalent of calling `floor` on
the coordinates of the origin, and `ceil` on the size.
a #graphene_rect_t
return location for the
rounded rectangle
Rounds the origin and the size of the given rectangle to
their nearest integer values; the rounding is guaranteed
to be large enough to contain the original rectangle.
Use graphene_rect_round() instead
the pixel-aligned rectangle.
a #graphene_rect_t
Scales the size and origin of a rectangle horizontaly by @s_h,
and vertically by @s_v. The result @res is normalized.
horizontal scale factor
vertical scale factor
return location for the
scaled rectangle
Computes the union of the two given rectangles.
![](rectangle-union.png)
The union in the image above is the blue outline.
a #graphene_rect_t
a #graphene_rect_t
return location for a #graphene_rect_t
Allocates a new #graphene_rect_t.
The contents of the returned rectangle are undefined.
the newly allocated rectangle
Returns a degenerate rectangle with origin fixed at (0, 0) and
a size of 0, 0.
a fixed rectangle
A size.
the width
the height
Allocates a new #graphene_size_t.
The contents of the returned value are undefined.
the newly allocated #graphene_size_t
Checks whether the two give #graphene_size_t are equal.
`true` if the sizes are equal
a #graphene_size_t
a #graphene_size_t
Frees the resources allocated by graphene_size_alloc().
a #graphene_size_t
Initializes a #graphene_size_t using the given @width and @height.
the initialized #graphene_size_t
a #graphene_size_t
the width
the height
Initializes a #graphene_size_t using the width and height of
the given @src.
the initialized #graphene_size_t
a #graphene_size_t
a #graphene_size_t
Linearly interpolates the two given #graphene_size_t using the given
interpolation @factor.
a #graphene_size_t
a #graphene_size_t
the linear interpolation factor
return location for the interpolated size
Scales the components of a #graphene_size_t using the given @factor.
a #graphene_size_t
the scaling factor
return location for the scaled size
A constant pointer to a zero #graphene_size_t, useful for
equality checks and interpolations.
a constant size
A sphere, represented by its center and radius.
Allocates a new #graphene_sphere_t.
The contents of the newly allocated structure are undefined.
the newly allocated #graphene_sphere_t. Use
graphene_sphere_free() to free the resources allocated by this function
Checks whether the given @point is contained in the volume
of a #graphene_sphere_t.
`true` if the sphere contains the point
a #graphene_sphere_t
a #graphene_point3d_t
Computes the distance of the given @point from the surface of
a #graphene_sphere_t.
the distance of the point
a #graphene_sphere_t
a #graphene_point3d_t
Checks whether two #graphene_sphere_t are equal.
`true` if the spheres are equal
a #graphene_sphere_t
a #graphene_sphere_t
Frees the resources allocated by graphene_sphere_alloc().
a #graphene_sphere_t
Computes the bounding box capable of containing the
given #graphene_sphere_t.
a #graphene_sphere_t
return location for the bounding box
Retrieves the coordinates of the center of a #graphene_sphere_t.
a #graphene_sphere_t
return location for the coordinates of
the center
Retrieves the radius of a #graphene_sphere_t.
a #graphene_sphere_t
Initializes the given #graphene_sphere_t with the given @center and @radius.
the initialized #graphene_sphere_t
the #graphene_sphere_t to initialize
the coordinates of the center of the sphere, or %NULL
for a center in (0, 0, 0)
the radius of the sphere
Initializes the given #graphene_sphere_t using the given array
of 3D coordinates so that the sphere includes them.
The center of the sphere can either be specified, or will be center
of the 3D volume that encompasses all @points.
the initialized #graphene_sphere_t
the #graphene_sphere_t to initialize
the number of #graphene_point3d_t in the @points array
an array of #graphene_point3d_t
the center of the sphere
Initializes the given #graphene_sphere_t using the given array
of 3D coordinates so that the sphere includes them.
The center of the sphere can either be specified, or will be center
of the 3D volume that encompasses all @vectors.
the initialized #graphene_sphere_t
the #graphene_sphere_t to initialize
the number of #graphene_vec3_t in the @vectors array
an array of #graphene_vec3_t
the center of the sphere
Checks whether the sphere has a zero radius.
`true` if the sphere is empty
a #graphene_sphere_t
Translates the center of the given #graphene_sphere_t using the @point
coordinates as the delta of the translation.
a #graphene_sphere_t
the coordinates of the translation
return location for the translated sphere
A triangle.
Allocates a new #graphene_triangle_t.
The contents of the returned structure are undefined.
the newly allocated #graphene_triangle_t
structure. Use graphene_triangle_free() to free the resources
allocated by this function
Checks whether the given triangle @t contains the point @p.
`true` if the point is inside the triangle
a #graphene_triangle_t
a #graphene_point3d_t
Checks whether the two given #graphene_triangle_t are equal.
`true` if the triangles are equal
a #graphene_triangle_t
a #graphene_triangle_t
Frees the resources allocated by graphene_triangle_alloc().
a #graphene_triangle_t
Computes the area of the given #graphene_triangle_t.
the area of the triangle
a #graphene_triangle_t
Computes the [barycentric coordinates](http://en.wikipedia.org/wiki/Barycentric_coordinate_system)
of the given point @p.
The point @p must lie on the same plane as the triangle @t; if the
point is not coplanar, the result of this function is undefined.
If we place the origin in the coordinates of the triangle's A point,
the barycentric coordinates are `u`, which is on the AC vector; and `v`
which is on the AB vector:
![](triangle-barycentric.png)
The returned #graphene_vec2_t contains the following values, in order:
- `res.x = u`
- `res.y = v`
`true` if the barycentric coordinates are valid
a #graphene_triangle_t
a #graphene_point3d_t
return location for the vector
with the barycentric coordinates
Computes the bounding box of the given #graphene_triangle_t.
a #graphene_triangle_t
return location for the box
Computes the coordinates of the midpoint of the given #graphene_triangle_t.
The midpoint G is the [centroid](https://en.wikipedia.org/wiki/Centroid#Triangle_centroid)
of the triangle, i.e. the intersection of its medians.
a #graphene_triangle_t
return location for the coordinates of
the midpoint
Computes the normal vector of the given #graphene_triangle_t.
a #graphene_triangle_t
return location for the normal vector
Computes the plane based on the vertices of the given #graphene_triangle_t.
a #graphene_triangle_t
return location for the plane
Retrieves the three vertices of the given #graphene_triangle_t and returns
their coordinates as #graphene_point3d_t.
a #graphene_triangle_t
return location for the coordinates
of the first vertex
return location for the coordinates
of the second vertex
return location for the coordinates
of the third vertex
Retrieves the three vertices of the given #graphene_triangle_t.
a #graphene_triangle_t
return location for the first vertex
return location for the second vertex
return location for the third vertex
Initializes a #graphene_triangle_t using the three given 3D points.
the initialized #graphene_triangle_t
the #graphene_triangle_t to initialize
a #graphene_point3d_t
a #graphene_point3d_t
a #graphene_point3d_t
Initializes a #graphene_triangle_t using the three given vectors.
the initialized #graphene_triangle_t
the #graphene_triangle_t to initialize
a #graphene_vec3_t
a #graphene_vec3_t
a #graphene_vec3_t
Evaluates to the number of components of a #graphene_vec2_t.
Evaluates to the number of components of a #graphene_vec3_t.
Evaluates to the number of components of a #graphene_vec4_t.
A structure capable of holding a vector with two dimensions, x and y.
The contents of the #graphene_vec2_t structure are private and should
never be accessed directly.
Allocates a new #graphene_vec2_t structure.
The contents of the returned structure are undefined.
Use graphene_vec2_init() to initialize the vector.
the newly allocated #graphene_vec2_t
structure. Use graphene_vec2_free() to free the resources allocated
by this function.
Adds each component of the two passed vectors and places
each result into the components of @res.
a #graphene_vec2_t
a #graphene_vec2_t
return location for the result
Divides each component of the first operand @a by the corresponding
component of the second operand @b, and places the results into the
vector @res.
a #graphene_vec2_t
a #graphene_vec2_t
return location for the result
Computes the dot product of the two given vectors.
the dot product of the vectors
a #graphene_vec2_t
a #graphene_vec2_t
Checks whether the two given #graphene_vec2_t are equal.
`true` if the two vectors are equal, and false otherwise
a #graphene_vec2_t
a #graphene_vec2_t
Frees the resources allocated by @v
a #graphene_vec2_t
Retrieves the X component of the #graphene_vec2_t.
the value of the X component
a #graphene_vec2_t
Retrieves the Y component of the #graphene_vec2_t.
the value of the Y component
a #graphene_vec2_t
Initializes a #graphene_vec2_t using the given values.
This function can be called multiple times.
the initialized vector
a #graphene_vec2_t
the X field of the vector
the Y field of the vector
Initializes @v with the contents of the given array.
the initialized vector
a #graphene_vec2_t
an array of floating point values
with at least two elements
Copies the contents of @src into @v.
the initialized vector
a #graphene_vec2_t
a #graphene_vec2_t
Computes the length of the given vector.
the length of the vector
a #graphene_vec2_t
Compares the two given vectors and places the maximum
values of each component into @res.
a #graphene_vec2_t
a #graphene_vec2_t
the resulting vector
Compares the two given vectors and places the minimum
values of each component into @res.
a #graphene_vec2_t
a #graphene_vec2_t
the resulting vector
Multiplies each component of the two passed vectors and places
each result into the components of @res.
a #graphene_vec2_t
a #graphene_vec2_t
return location for the result
Compares the two given #graphene_vec2_t vectors and checks
whether their values are within the given @epsilon.
`true` if the two vectors are near each other
a #graphene_vec2_t
a #graphene_vec2_t
the threshold between the two vectors
Negates the given #graphene_vec2_t.
a #graphene_vec2_t
return location for the result vector
Computes the normalized vector for the given vector @v.
a #graphene_vec2_t
return location for the
normalized vector
Multiplies all components of the given vector with the given scalar @factor.
a #graphene_vec2_t
the scalar factor
return location for the result vector
Subtracts from each component of the first operand @a the
corresponding component of the second operand @b and places
each result into the components of @res.
a #graphene_vec2_t
a #graphene_vec2_t
return location for the result
Stores the components of @v into an array.
a #graphene_vec2_t
return location
for an array of floating point values with at least 2 elements
Retrieves a constant vector with (1, 1) components.
the one vector
Retrieves a constant vector with (1, 0) components.
the X axis vector
Retrieves a constant vector with (0, 1) components.
the Y axis vector
Retrieves a constant vector with (0, 0) components.
the zero vector
A structure capable of holding a vector with three dimensions: x, y, and z.
The contents of the #graphene_vec3_t structure are private and should
never be accessed directly.
Allocates a new #graphene_vec3_t structure.
The contents of the returned structure are undefined.
Use graphene_vec3_init() to initialize the vector.
the newly allocated #graphene_vec3_t
structure. Use graphene_vec3_free() to free the resources allocated
by this function.
Adds each component of the two given vectors.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the resulting vector
Computes the cross product of the two given vectors.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the resulting vector
Divides each component of the first operand @a by the corresponding
component of the second operand @b, and places the results into the
vector @res.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the resulting vector
Computes the dot product of the two given vectors.
the value of the dot product
a #graphene_vec3_t
a #graphene_vec3_t
Checks whether the two given #graphene_vec3_t are equal.
`true` if the two vectors are equal, and false otherwise
a #graphene_vec3_t
a #graphene_vec3_t
Frees the resources allocated by @v
a #graphene_vec3_t
Retrieves the first component of the given vector @v.
the value of the first component of the vector
a #graphene_vec3_t
Creates a #graphene_vec2_t that contains the first and second
components of the given #graphene_vec3_t.
a #graphene_vec3_t
return location for a #graphene_vec2_t
Creates a #graphene_vec3_t that contains the first two components of
the given #graphene_vec3_t, and the third component set to 0.
a #graphene_vec3_t
return location for a #graphene_vec3_t
Converts a #graphene_vec3_t in a #graphene_vec4_t using 0.0
as the value for the fourth component of the resulting vector.
a #graphene_vec3_t
return location for the vector
Converts a #graphene_vec3_t in a #graphene_vec4_t using 1.0
as the value for the fourth component of the resulting vector.
a #graphene_vec3_t
return location for the vector
Converts a #graphene_vec3_t in a #graphene_vec4_t using @w as
the value of the fourth component of the resulting vector.
a #graphene_vec3_t
the value of the W component
return location for the vector
Retrieves the second component of the given vector @v.
the value of the second component of the vector
a #graphene_vec3_t
Retrieves the third component of the given vector @v.
the value of the third component of the vector
a #graphene_vec3_t
Initializes a #graphene_vec3_t using the given values.
This function can be called multiple times.
a pointer to the initialized
vector
a #graphene_vec3_t
the X field of the vector
the Y field of the vector
the Z field of the vector
Initializes a #graphene_vec3_t with the values from an array.
the initialized vector
a #graphene_vec3_t
an array of 3 floating point values
Initializes a #graphene_vec3_t with the values of another
#graphene_vec3_t.
the initialized vector
a #graphene_vec3_t
a #graphene_vec3_t
Retrieves the length of the given vector @v.
the value of the length of the vector
a #graphene_vec3_t
Compares each component of the two given vectors and creates a
vector that contains the maximum values.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the result vector
Compares each component of the two given vectors and creates a
vector that contains the minimum values.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the result vector
Multiplies each component of the two given vectors.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the resulting vector
Compares the two given #graphene_vec3_t vectors and checks
whether their values are within the given @epsilon.
`true` if the two vectors are near each other
a #graphene_vec3_t
a #graphene_vec3_t
the threshold between the two vectors
Negates the given #graphene_vec3_t.
a #graphene_vec3_t
return location for the result vector
Normalizes the given #graphene_vec3_t.
a #graphene_vec3_t
return location for the normalized vector
Multiplies all components of the given vector with the given scalar @factor.
a #graphene_vec3_t
the scalar factor
return location for the result vector
Subtracts from each component of the first operand @a the
corresponding component of the second operand @b and places
each result into the components of @res.
a #graphene_vec3_t
a #graphene_vec3_t
return location for the resulting vector
Copies the components of a #graphene_vec3_t into the given array.
a #graphene_vec3_t
return location for
an array of floating point values
Provides a constant pointer to a vector with three components,
all sets to 1.
a constant vector
Provides a constant pointer to a vector with three components
with values set to (1, 0, 0).
a constant vector
Provides a constant pointer to a vector with three components
with values set to (0, 1, 0).
a constant vector
Provides a constant pointer to a vector with three components
with values set to (0, 0, 1).
a constant vector
Provides a constant pointer to a vector with three components,
all sets to 0.
a constant vector
A structure capable of holding a vector with four dimensions: x, y, z, and w.
The contents of the #graphene_vec4_t structure are private and should
never be accessed directly.
Allocates a new #graphene_vec4_t structure.
The contents of the returned structure are undefined.
Use graphene_vec4_init() to initialize the vector.
the newly allocated #graphene_vec4_t
structure. Use graphene_vec4_free() to free the resources allocated
by this function.
Adds each component of the two given vectors.
a #graphene_vec4_t
a #graphene_vec4_t
return location for the resulting vector
Divides each component of the first operand @a by the corresponding
component of the second operand @b, and places the results into the
vector @res.
a #graphene_vec4_t
a #graphene_vec4_t
return location for the resulting vector
Computes the dot product of the two given vectors.
the value of the dot product
a #graphene_vec4_t
a #graphene_vec4_t
Checks whether the two given #graphene_vec4_t are equal.
`true` if the two vectors are equal, and false otherwise
a #graphene_vec4_t
a #graphene_vec4_t
Frees the resources allocated by @v
a #graphene_vec4_t
Retrieves the value of the fourth component of the given #graphene_vec4_t.
the value of the fourth component
a #graphene_vec4_t
Retrieves the value of the first component of the given #graphene_vec4_t.
the value of the first component
a #graphene_vec4_t
Creates a #graphene_vec2_t that contains the first two components
of the given #graphene_vec4_t.
a #graphene_vec4_t
return location for a #graphene_vec2_t
Creates a #graphene_vec3_t that contains the first three components
of the given #graphene_vec4_t.
a #graphene_vec4_t
return location for a graphene_vec3_t
Retrieves the value of the second component of the given #graphene_vec4_t.
the value of the second component
a #graphene_vec4_t
Retrieves the value of the third component of the given #graphene_vec4_t.
the value of the third component
a #graphene_vec4_t
Initializes a #graphene_vec4_t using the given values.
This function can be called multiple times.
a pointer to the initialized
vector
a #graphene_vec4_t
the X field of the vector
the Y field of the vector
the Z field of the vector
the W field of the vector
Initializes a #graphene_vec4_t with the values inside the given array.
the initialized vector
a #graphene_vec4_t
an array of four floating point values
Initializes a #graphene_vec4_t using the components of a
#graphene_vec2_t and the values of @z and @w.
the initialized vector
a #graphene_vec4_t
a #graphene_vec2_t
the value for the third component of @v
the value for the fourth component of @v
Initializes a #graphene_vec4_t using the components of a
#graphene_vec3_t and the value of @w.
the initialized vector
a #graphene_vec4_t
a #graphene_vec3_t
the value for the fourth component of @v
Initializes a #graphene_vec4_t using the components of
another #graphene_vec4_t.
the initialized vector
a #graphene_vec4_t
a #graphene_vec4_t
Computes the length of the given #graphene_vec4_t.
the length of the vector
a #graphene_vec4_t
Compares each component of the two given vectors and creates a
vector that contains the maximum values.
a #graphene_vec4_t
a #graphene_vec4_t
return location for the result vector
Compares each component of the two given vectors and creates a
vector that contains the minimum values.
a #graphene_vec4_t
a #graphene_vec4_t
return location for the result vector
Multiplies each component of the two given vectors.
a #graphene_vec4_t
a #graphene_vec4_t
return location for the resulting vector
Compares the two given #graphene_vec4_t vectors and checks
whether their values are within the given @epsilon.
`true` if the two vectors are near each other
a #graphene_vec4_t
a #graphene_vec4_t
the threshold between the two vectors
Negates the given #graphene_vec4_t.
a #graphene_vec4_t
return location for the result vector
Normalizes the given #graphene_vec4_t.
a #graphene_vec4_t
return location for the normalized
vector
Multiplies all components of the given vector with the given scalar @factor.
a #graphene_vec4_t
the scalar factor
return location for the result vector
Subtracts from each component of the first operand @a the
corresponding component of the second operand @b and places
each result into the components of @res.
a #graphene_vec4_t
a #graphene_vec4_t
return location for the resulting vector
Stores the components of the given #graphene_vec4_t into an array
of floating point values.
a #graphene_vec4_t
return location for
an array of floating point values
Retrieves a pointer to a #graphene_vec4_t with all its
components set to 1.
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (0, 0, 0, 1).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (1, 0, 0, 0).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (0, 1, 0, 0).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (0, 0, 1, 0).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with all its
components set to 0.
a constant vector
A degenerate #graphene_box_t that can only be expanded.
The returned value is owned by Graphene and should not be modified or freed.
a #graphene_box_t
A degenerate #graphene_box_t that cannot be expanded.
The returned value is owned by Graphene and should not be modified or freed.
a #graphene_box_t
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.
a #graphene_box_t
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.
a #graphene_box_t
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.
a #graphene_box_t
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.
a #graphene_box_t
Retrieves a constant point with all three coordinates set to 0.
a zero point
Returns a point fixed at (0, 0).
a fixed point
Allocates a new #graphene_rect_t.
The contents of the returned rectangle are undefined.
the newly allocated rectangle
Returns a degenerate rectangle with origin fixed at (0, 0) and
a size of 0, 0.
a fixed rectangle
A constant pointer to a zero #graphene_size_t, useful for
equality checks and interpolations.
a constant size
Retrieves a constant vector with (1, 1) components.
the one vector
Retrieves a constant vector with (1, 0) components.
the X axis vector
Retrieves a constant vector with (0, 1) components.
the Y axis vector
Retrieves a constant vector with (0, 0) components.
the zero vector
Provides a constant pointer to a vector with three components,
all sets to 1.
a constant vector
Provides a constant pointer to a vector with three components
with values set to (1, 0, 0).
a constant vector
Provides a constant pointer to a vector with three components
with values set to (0, 1, 0).
a constant vector
Provides a constant pointer to a vector with three components
with values set to (0, 0, 1).
a constant vector
Provides a constant pointer to a vector with three components,
all sets to 0.
a constant vector
Retrieves a pointer to a #graphene_vec4_t with all its
components set to 1.
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (0, 0, 0, 1).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (1, 0, 0, 0).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (0, 1, 0, 0).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with its
components set to (0, 0, 1, 0).
a constant vector
Retrieves a pointer to a #graphene_vec4_t with all its
components set to 0.
a constant vector