Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GrapheneTriangleLayout

[12:14] static extends: object

Generated struct layout helper for GIR record Triangle.

Methods

  • layout ()

    Returns the Panama struct layout for Triangle.

class: GrapheneTriangle

[29:7] extends: object

A triangle.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GrapheneTriangle (Handle = null)

    Allocates a new #graphene_triangle_t. The contents of the returned structure are undefined.

    • @p Handle is an optional native handle or wrapper whose handle to adopt; when the native constructor is called.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • contains_point (object p)

    Checks whether the given triangle @t contains the point @p.

    • @p p is a #graphene_point3d_t.
    • @r true if the point is inside the triangle.
  • equal (object b)

    Checks whether the two given #graphene_triangle_t are equal.

    • @p b is a #graphene_triangle_t.
    • @r true if the triangles are equal.
  • free ()

    Frees the resources allocated by graphene_triangle_alloc().

    • @r None.
  • get_area ()

    Computes the area of the given #graphene_triangle_t.

    • @r the area of the triangle.
  • get_barycoords (object p)

    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_t contains the following values, in order: - res.x = u - res.y = v

    • @p p is a #graphene_point3d_t.
    • @p res is return location for the vector with the barycentric coordinates.
    • @r true if the barycentric coordinates are valid.
  • get_bounding_box ()

    Computes the bounding box of the given #graphene_triangle_t.

    • @p res is return location for the box.
    • @r None.
  • get_midpoint ()

    Computes the coordinates of the midpoint of the given #graphene_triangle_t. The midpoint G is the centroid of the triangle, i.e. the intersection of its medians.

    • @p res is return location for the coordinates of the midpoint.
    • @r None.
  • get_normal ()

    Computes the normal vector of the given #graphene_triangle_t.

    • @p res is return location for the normal vector.
    • @r None.
  • get_plane ()

    Computes the plane based on the vertices of the given #graphene_triangle_t.

    • @p res is return location for the plane.
    • @r None.
  • get_points ()

    Retrieves the three vertices of the given #graphene_triangle_t and returns their coordinates as #graphene_point3d_t.

    • @p a is return location for the coordinates of the first vertex.
    • @p b is return location for the coordinates of the second vertex.
    • @p c is return location for the coordinates of the third vertex.
    • @r None.
  • get_uv (object p, object uv_a, object uv_b, object uv_c)

    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()

    • @p p is a #graphene_point3d_t.
    • @p uv_a is the UV coordinates of the first point.
    • @p uv_b is the UV coordinates of the second point.
    • @p uv_c is the UV coordinates of the third point.
    • @p res is a vector containing the UV coordinates of the given point @p.
    • @r true if the coordinates are valid.
  • get_vertices ()

    Retrieves the three vertices of the given #graphene_triangle_t.

    • @p a is return location for the first vertex.
    • @p b is return location for the second vertex.
    • @p c is return location for the third vertex.
    • @r None.
  • init_from_float (list a, list b, list c)

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

    • @p a is an array of 3 floating point values.
    • @p b is an array of 3 floating point values.
    • @p c is an array of 3 floating point values.
    • @r the initialized #graphene_triangle_t.
  • init_from_point3d (object a, object b, object c)

    Initializes a #graphene_triangle_t using the three given 3D points.

    • @p a is a #graphene_point3d_t.
    • @p b is a #graphene_point3d_t.
    • @p c is a #graphene_point3d_t.
    • @r the initialized #graphene_triangle_t.
  • init_from_vec3 (object a, object b, object c)

    Initializes a #graphene_triangle_t using the three given vectors.

    • @p a is a #graphene_vec3_t.
    • @p b is a #graphene_vec3_t.
    • @p c is a #graphene_vec3_t.
    • @r the initialized #graphene_triangle_t.