pub fn try_orientation_2d(
a: Point2,
b: Point2,
c: Point2,
) -> Result<Orientation2, GeometryError>Expand description
Returns the winding order of three 2D points with finite coordinates.
ยงErrors
Returns GeometryError::NonFiniteComponent when any input point contains
a non-finite coordinate.
Examples found in repository?
examples/facade_validated_geometry.rs (line 16)
7fn main() -> Result<(), use_math::GeometryError> {
8 let a = Point2::try_new(0.0, 0.0)?;
9 let b = Point2::try_new(4.0, 0.0)?;
10 let c = Point2::try_new(0.0, 3.0)?;
11
12 let triangle = Triangle::try_new(a, b, c)?;
13
14 assert!(approx_eq(distance_2d(a, b), 4.0));
15 assert!(approx_eq(triangle.perimeter(), 12.0));
16 assert_eq!(try_orientation_2d(a, b, c)?, Orientation2::CounterClockwise);
17
18 Ok(())
19}