MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/splashsurf / tri_min_max_angles

Function tri_min_max_angles

splashsurf_lib/src/mesh.rs:72–88  ·  view source on GitHub ↗

Computes the minimum and maximum angle in the given triangle

(
    a: &Vector3<RIn>,
    b: &Vector3<RIn>,
    c: &Vector3<RIn>,
)

Source from the content-addressed store, hash-verified

70
71/// Computes the minimum and maximum angle in the given triangle
72pub fn tri_min_max_angles<RIn: Real, RComp: Real>(
73 a: &Vector3<RIn>,
74 b: &Vector3<RIn>,
75 c: &Vector3<RIn>,
76) -> (RComp, RComp) {
77 let a = a.convert::<RComp>();
78 let b = b.convert::<RComp>();
79 let c = c.convert::<RComp>();
80 let alpha1: RComp = angle_between(&a, &b, &c);
81 let alpha2: RComp = angle_between(&b, &c, &a);
82 let alpha3 = RComp::pi() - alpha1 - alpha2;
83
84 (
85 alpha1.min(alpha2.min(alpha3)),
86 alpha1.max(alpha2.max(alpha3)),
87 )
88}
89
90/// Computes the aspect ratio of the given triangle
91///

Callers 1

Calls 3

angle_betweenFunction · 0.85
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected