Wrappers.Triangletype t = [ `triangle ] Gobject.objval alloc : unit -> tCreate a new Triangle
val init_from_vec3 :
t ->
[ `vec3 ] Gobject.obj option ->
[ `vec3 ] Gobject.obj option ->
[ `vec3 ] Gobject.obj option ->
tInitializes a #graphene_triangle_t using the three given vectors.
val init_from_point3d :
t ->
[ `point3_d ] Gobject.obj option ->
[ `point3_d ] Gobject.obj option ->
[ `point3_d ] Gobject.obj option ->
tInitializes a #graphene_triangle_t using the three given 3D points.
Initializes a #graphene_triangle_t using the three given arrays of floating point values, each representing the coordinates of a point in 3D space.
val get_vertices :
t ->
[ `vec3 ] Gobject.obj * [ `vec3 ] Gobject.obj * [ `vec3 ] Gobject.objRetrieves the three vertices of the given #graphene_triangle_t.
val get_uv :
t ->
[ `point3_d ] Gobject.obj option ->
[ `vec2 ] Gobject.obj ->
[ `vec2 ] Gobject.obj ->
[ `vec2 ] Gobject.obj ->
bool * [ `vec2 ] Gobject.objComputes the UV coordinates 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 @p is %NULL, the point will be set in (0, 0, 0).
The UV coordinates will be placed in the @res vector:
See also: graphene_triangle_get_barycoords()
val get_points :
t ->
[ `point3_d ] Gobject.obj
* [ `point3_d ] Gobject.obj
* [ `point3_d ] Gobject.objRetrieves the three vertices of the given #graphene_triangle_t and returns their coordinates as #graphene_point3d_t.
val get_plane : t -> [ `plane ] Gobject.objComputes the plane based on the vertices of the given #graphene_triangle_t.
val get_normal : t -> [ `vec3 ] Gobject.objComputes the normal vector of the given #graphene_triangle_t.
val get_midpoint : t -> [ `point3_d ] Gobject.objComputes 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.
val get_bounding_box : t -> [ `box ] Gobject.objComputes the bounding box of the given #graphene_triangle_t.
val get_barycoords :
t ->
[ `point3_d ] Gobject.obj option ->
bool * [ `vec2 ] Gobject.objComputes 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:
val get_area : t -> floatComputes the area of the given #graphene_triangle_t.
val contains_point : t -> [ `point3_d ] Gobject.obj -> boolChecks whether the given triangle @t contains the point @p.