FUNCTION compatible_complex_number_regions

(* SCHEMA step_merged_ap_schema; *)
-- IN AP242
FUNCTION compatible_complex_number_regions
      (sp1 : maths_space;
       sp2 : maths_space ) : BOOLEAN;
   LOCAL
      typenames : SET OF STRING := stripped_typeof(sp1);
      crgn1 : cartesian_complex_number_region;
      crgn2 : cartesian_complex_number_region;
      prgn1 : polar_complex_number_region;
      prgn2 : polar_complex_number_region;
      prgn1c2 : polar_complex_number_region;
      prgn2c1 : polar_complex_number_region;
      sp1_is_crgn : BOOLEAN;
      sp2_is_crgn : BOOLEAN;
   END_LOCAL;
      IF 'CARTESIAN_COMPLEX_NUMBER_REGION' IN typenames THEN
         sp1_is_crgn := TRUE;
         crgn1 := sp1;
      ELSE
         IF 'POLAR_COMPLEX_NUMBER_REGION' IN typenames THEN
            sp1_is_crgn := FALSE;
            prgn1 := sp1;
         ELSE
            RETURN (TRUE);
         END_IF;
      END_IF;
      typenames := stripped_typeof(sp2);
      IF 'CARTESIAN_COMPLEX_NUMBER_REGION' IN typenames THEN
         sp2_is_crgn := TRUE;
         crgn2 := sp2;
      ELSE
         IF 'POLAR_COMPLEX_NUMBER_REGION' IN typenames THEN
            sp2_is_crgn := FALSE;
            prgn2 := sp2;
         ELSE
            RETURN (TRUE);
         END_IF;
      END_IF;
      IF sp1_is_crgn AND sp2_is_crgn THEN
         RETURN (compatible_intervals(crgn1.real_constraint, crgn2.real_constraint) AND compatible_intervals(crgn1.imag_constraint, crgn2.imag_constraint));
      END_IF;
      IF ((NOT sp1_is_crgn AND NOT sp2_is_crgn) AND (prgn1.centre.real_part = prgn2.centre.real_part)) AND (prgn1.centre.imag_part = prgn2.centre.imag_part) THEN
         IF NOT compatible_intervals(prgn1.distance_constraint, prgn2.distance_constraint) THEN
            RETURN (FALSE);
         END_IF;
         IF compatible_intervals(prgn1.direction_constraint, prgn2.direction_constraint) THEN
            RETURN (TRUE);
         END_IF;
         IF (prgn1.direction_constraint.max > 3.14159) AND (prgn2.direction_constraint.max < 3.14159) THEN
            RETURN (compatible_intervals(prgn2.direction_constraint, make_finite_real_interval(-3.14159, open, prgn1.direction_constraint.max - 2 * 3.14159, prgn1.direction_constraint.max_closure)));
         END_IF;
         IF (prgn2.direction_constraint.max > 3.14159) AND (prgn1.direction_constraint.max < 3.14159) THEN
            RETURN (compatible_intervals(prgn1.direction_constraint, make_finite_real_interval(-3.14159, open, prgn2.direction_constraint.max - 2 * 3.14159, prgn2.direction_constraint.max_closure)));
         END_IF;
         RETURN (FALSE);
      END_IF;
      IF sp1_is_crgn AND NOT sp2_is_crgn THEN
         crgn2 := enclose_pregion_in_cregion(prgn2);
         prgn1 := enclose_cregion_in_pregion(crgn1, prgn2.centre);
         RETURN (compatible_complex_number_regions(crgn1, crgn2) AND compatible_complex_number_regions(prgn1, prgn2));
      END_IF;
      IF NOT sp1_is_crgn AND sp2_is_crgn THEN
         crgn1 := enclose_pregion_in_cregion(prgn1);
         prgn2 := enclose_cregion_in_pregion(crgn2, prgn1.centre);
         RETURN (compatible_complex_number_regions(crgn1, crgn2) AND compatible_complex_number_regions(prgn1, prgn2));
      END_IF;
      prgn1c2 := enclose_pregion_in_pregion(prgn1, prgn2.centre);
      prgn2c1 := enclose_pregion_in_pregion(prgn2, prgn1.centre);
      RETURN (compatible_complex_number_regions(prgn1, prgn2c1) AND compatible_complex_number_regions(prgn1c2, prgn2));
END_FUNCTION;

Referenced By

Defintion compatible_complex_number_regions is references by the following definitions:
DefinitionType
 compatible_spaces FUNCTION


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2017-01-19T11:17:24-05:00