Class (GI Struct)

Graphene-1.0GrapheneTriangleSince 1.2

A triangle.

1.2

Index

Constructors

Properties

$gtype: GType<Triangle>

Methods

  • Computes the barycentric 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 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:

    The returned Graphene.Vec2 contains the following values, in order:

    • res.x = u
    • res.y = v

    Parameters

    Returns [boolean, Vec2]

    true if the barycentric coordinates are valid

  • Computes 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:

    • res.x = u
    • res.y = v

    See also: graphene_triangle_get_barycoords()

    Parameters

    Returns [boolean, Vec2]

    true if the coordinates are valid

  • Initializes a Graphene.Triangle using the three given arrays of floating point values, each representing the coordinates of a point in 3D space.

    Parameters

    • a: number[]

      an array of 3 floating point values

    • b: number[]

      an array of 3 floating point values

    • c: number[]

      an array of 3 floating point values

    Returns Triangle

    the initialized Graphene.Triangle