some style correction

This commit is contained in:
Vovanium 2023-08-15 23:42:31 +03:00
parent dc9a8f5e01
commit 2fa036ac71
1 changed files with 24 additions and 24 deletions

View File

@ -71,17 +71,17 @@ package Video.Integer_Geometry with Pure is
subtype Nonempty_Interval is Interval with Dynamic_Predicate => not Is_Empty (Nonempty_Interval);
-- A type for an interval that is not empty
function Length (A : Interval) return Distance is
(if Is_Empty (A) then 0 else A.Last - A.First);
function Length (A : Interval) return Distance
is (if Is_Empty (A) then 0 else A.Last - A.First);
function Contains (A : Interval; X : Coordinate) return Boolean is
(X in A.First .. A.Last);
function Contains (A : Interval; X : Coordinate) return Boolean
is (X in A.First .. A.Last);
function Contains (Outer, Inner : Interval) return Boolean is
(Is_Empty (Inner) or else (Outer.First <= Inner.First and Inner.Last <= Outer.Last));
function Contains (Outer, Inner : Interval) return Boolean
is (Is_Empty (Inner) or else (Outer.First <= Inner.First and Inner.Last <= Outer.Last));
function Intersects (A, B : Interval) return Boolean is
((not Is_Empty (A)) and then (not Is_Empty (B)) and then (A.First <= B.Last and B.First <= A.Last));
function Intersects (A, B : Interval) return Boolean
is ((not Is_Empty (A)) and then (not Is_Empty (B)) and then (A.First <= B.Last and B.First <= A.Last));
function "+" (A : Interval) return Interval is (A);
-- Identity function
@ -110,14 +110,14 @@ package Video.Integer_Geometry with Pure is
is (if Is_Empty (A) then Empty_Interval else (A.First - B.Last, A.Last - B.First));
-- Minkowski difference
function "and" (A, B : Interval) return Interval is
(Coordinate'Max (A.First, B.First), Coordinate'Min (A.Last, B.Last));
function "and" (A, B : Interval) return Interval
is (Coordinate'Max (A.First, B.First), Coordinate'Min (A.Last, B.Last));
-- Intersection
function "or" (A, B : Interval) return Interval is
(if Is_Empty (A) then B
elsif Is_Empty (B) then A
else (Coordinate'Min (A.First, B.First), Coordinate'Max (A.Last, B.Last)));
function "or" (A, B : Interval) return Interval
is (if Is_Empty (A) then B
elsif Is_Empty (B) then A
else (Coordinate'Min (A.First, B.First), Coordinate'Max (A.Last, B.Last)));
-- Minimal interval enclosing both arguments
function Center (A : Nonempty_Interval) return Coordinate
@ -149,16 +149,16 @@ package Video.Integer_Geometry with Pure is
function Area (B : Box) return Coordinate_Product
is (Coordinate_Product (Length (B.X)) * Coordinate_Product (Length (B.Y)));
function Contains (B : Box; Q : Point) return Boolean is
(Contains (B.X, Q.X) and then Contains (B.Y, Q.Y));
function Contains (B : Box; P : Point) return Boolean
is (Contains (B.X, P.X) and then Contains (B.Y, P.Y));
-- Test is point is inside or on the edge of a box
function Contains (Outer, Inner : Box) return Boolean is
(Contains (Outer.X, Inner.X) and then Contains (Outer.Y, Inner.Y));
function Contains (Outer, Inner : Box) return Boolean
is (Contains (Outer.X, Inner.X) and then Contains (Outer.Y, Inner.Y));
-- Test if Inner is inside Outer
function Intersects (A, B : Box) return Boolean is
(Intersects (A.X, B.X) and then Intersects (A.Y, B.Y));
function Intersects (A, B : Box) return Boolean
is (Intersects (A.X, B.X) and then Intersects (A.Y, B.Y));
-- Test if two boxes have common area
function "+" (B : Box) return Box is (B);
@ -188,12 +188,12 @@ package Video.Integer_Geometry with Pure is
is (if Is_Empty (A) then Empty_Box else (A.X - B.X, A.Y - B.Y));
-- Minkowski difference
function "and" (P, Q : Box) return Box is
(P.X and Q.X, P.Y and Q.Y);
function "and" (A, B : Box) return Box
is (A.X and B.X, A.Y and B.Y);
-- Intersection (like in sets)
function "or" (P, Q : Box) return Box is
(P.X or Q.X, P.Y or Q.Y);
function "or" (A, B : Box) return Box
is (A.X or B.X, A.Y or B.Y);
-- Minimal box enclosing both arguments
-- Note: contrary to "and" it is not an set union