Struct graphene::Triangle[][src]

pub struct Triangle(_);
Expand description

A triangle.

Implementations

Checks whether the given triangle self contains the point p.

p

a Point3D

Returns

true if the point is inside the triangle

Computes the area of the given Triangle.

Returns

the area of the triangle

Computes the barycentric coordinates of the given point p.

The point p must lie on the same plane as the triangle self; 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 Vec2 contains the following values, in order:

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

p

a Point3D

Returns

true if the barycentric coordinates are valid

res

return location for the vector with the barycentric coordinates

Computes the bounding box of the given Triangle.

Returns

res

return location for the box

Computes the coordinates of the midpoint of the given Triangle.

The midpoint G is the centroid of the triangle, i.e. the intersection of its medians.

Returns

res

return location for the coordinates of the midpoint

Computes the normal vector of the given Triangle.

Returns

res

return location for the normal vector

Computes the plane based on the vertices of the given Triangle.

Returns

res

return location for the plane

Retrieves the three vertices of the given Triangle and returns their coordinates as Point3D.

Returns

a

return location for the coordinates of the first vertex

b

return location for the coordinates of the second vertex

c

return location for the coordinates of the third vertex

Computes the UV coordinates of the given point p.

The point p must lie on the same plane as the triangle self; if the point is not coplanar, the result of this function is undefined. If p is None, 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: barycoords()

p

a Point3D

uv_a

the UV coordinates of the first point

uv_b

the UV coordinates of the second point

uv_c

the UV coordinates of the third point

Returns

true if the coordinates are valid

res

a vector containing the UV coordinates of the given point p

Retrieves the three vertices of the given Triangle.

Returns

a

return location for the first vertex

b

return location for the second vertex

c

return location for the third vertex

Initializes a Triangle using the three given 3D points.

a

a Point3D

b

a Point3D

c

a Point3D

Returns

the initialized Triangle

Initializes a Triangle using the three given vectors.

a

a Vec3

b

a Vec3

c

a Vec3

Returns

the initialized Triangle

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.