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.
Trait Implementations§
source§impl<F: Ord> Ord for Triangle<F>
impl<F: Ord> Ord for Triangle<F>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<F: PartialEq> PartialEq<Triangle<F>> for Triangle<F>
impl<F: PartialEq> PartialEq<Triangle<F>> for Triangle<F>
source§impl<F: PartialOrd> PartialOrd<Triangle<F>> for Triangle<F>
impl<F: PartialOrd> PartialOrd<Triangle<F>> for Triangle<F>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more