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

Function tri_area

splashsurf_lib/src/mesh.rs:34–45  ·  view source on GitHub ↗

Computes the unsigned area of the given triangle

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

Source from the content-addressed store, hash-verified

32
33/// Computes the unsigned area of the given triangle
34pub fn tri_area<RIn: Real, RComp: Real>(
35 a: &Vector3<RIn>,
36 b: &Vector3<RIn>,
37 c: &Vector3<RIn>,
38) -> RComp {
39 let a = a.convert::<RComp>();
40 let b = b.convert::<RComp>();
41 let c = c.convert::<RComp>();
42 ((b - a).cross(&(c - a)))
43 .norm()
44 .unscale(RComp::one() + RComp::one())
45}
46
47/// Computes the face normal of the given triangle
48pub fn tri_normal<RIn: Real, RComp: Real>(

Callers 2

tri_aspect_ratioFunction · 0.85
tri_area_ijkMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected