pub struct Triangle<F> {
pub a: Point<F>,
pub b: Point<F>,
pub c: Point<F>,
}Fields§
§a: Point<F>§b: Point<F>§c: Point<F>Implementations§
Source§impl<F: Float + FloatConst> Triangle<F>
impl<F: Float + FloatConst> Triangle<F>
Sourcepub fn from_array(points: [Point<F>; 3]) -> Triangle<F>
pub fn from_array(points: [Point<F>; 3]) -> Triangle<F>
Creates new Triangle from array of Points.
Sourcepub fn barycentric_to_cartesian(&self, pt: &Point<F>) -> Point<F>
pub fn barycentric_to_cartesian(&self, pt: &Point<F>) -> Point<F>
Converts barycentric coordinates of given point to cartesian coordinate system.
Sourcepub fn cartesian_to_barycentric(&self, pt: &Point<F>) -> Point<F>
pub fn cartesian_to_barycentric(&self, pt: &Point<F>) -> Point<F>
Converts cartesian coordinates of given point to barycentric coordinate system.
Sourcepub fn circumradius(&self) -> Option<F>
pub fn circumradius(&self) -> Option<F>
Gets radius of a circle that passes through all of the triangle’s vertices, so called circumradius.
Sourcepub fn has_point(&self, pt: Point<F>) -> bool
pub fn has_point(&self, pt: Point<F>) -> bool
Checks whether a given point lies inside the triangle.
Sourcepub fn inradius(&self) -> Option<F>
pub fn inradius(&self) -> Option<F>
Gets radius of a circle which is tangent to each side of the triangle, so called inradius.
Sourcepub fn is_collinear(&self) -> bool
pub fn is_collinear(&self) -> bool
Checks if points of triangle are collinear.
Sourcepub fn is_equilateral(&self) -> bool
pub fn is_equilateral(&self) -> bool
Checks if the triangle is equilateral.
Sourcepub fn is_isosceles(&self) -> bool
pub fn is_isosceles(&self) -> bool
Checks if the triangle is isosceles.
Sourcepub fn normal(&self) -> Option<Point<F>>
pub fn normal(&self) -> Option<Point<F>>
Gets normal of the triangle, depending on vertices order.
Sourcepub fn ray_intersection(
&self,
ray_orig: &Point<F>,
ray_dir: &Point<F>,
) -> Option<F>
pub fn ray_intersection( &self, ray_orig: &Point<F>, ray_dir: &Point<F>, ) -> Option<F>
Gets distance from ray origin to intersection with triangle. Möller & f64rumbore algorithm.
Sourcepub fn semiperimeter(&self) -> F
pub fn semiperimeter(&self) -> F
Gets semiperimeter of the triangle.
Sourcepub fn is_sorted_by(self, axis_name: char) -> bool
pub fn is_sorted_by(self, axis_name: char) -> bool
Checks if Triangle Points are sorted by axis.