Constructor
new Triangle(a=opt, b=opt, c=opt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
a= | t3d. | <optional> | the first corner of the triangle. Default is a Vector3 at (0, 0, 0). |
b= | t3d. | <optional> | the second corner of the triangle. Default is a Vector3 at (0, 0, 0). |
c= | t3d. | <optional> | the final corner of the triangle. Default is a Vector3 at (0, 0, 0). |
Methods
set(a, b, c) → {t3d.Triangle}
Sets the triangle's a, b and c properties to the passed vector3s.
Parameters:
Name | Type | Description |
---|---|---|
a | t3d. | |
b | t3d. | |
c | t3d. |
Returns:
- Type:
- t3d.
Triangle
(static) barycoordFromPoint(point, a, b, c, targetopt) → {t3d.Vector3}
static/instance method to calculate barycentric coordinates. based on: http://www.blackpawn.com/texts/pointinpoly/default.html
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
point | t3d. | Vector3 | |
a | t3d. | ||
b | t3d. | ||
c | t3d. | ||
target | t3d. | <optional> | the result will be copied into this Vector3. |
Returns:
- Type:
- t3d.
Vector3
(static) containsPoint(point, a, b, c) → {t3d.Vector3}
Returns true if the passed point, when projected onto the plane of the triangle, lies within the triangle.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | |
a | t3d. | |
b | t3d. | |
c | t3d. |
Returns:
- Type:
- t3d.
Vector3
(static) normal(a, b, c, optionalTargetopt) → {t3d.Vector3}
Calculate the normal vector of the triangle.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
a | t3d. | ||
b | t3d. | ||
c | t3d. | ||
optionalTarget | t3d. | <optional> |
Returns:
- Type:
- t3d.
Vector3