Professional Documents
Culture Documents
Ellipse Overlaps
Ellipse Overlaps
Ellipse Overlaps
Abstract We present an approach for finding the overlap two ellipses. In one case, the design for a solar calibrator
area between two ellipses that does not rely on proxy curves. onboard an orbiting satellite required an efficient routine for
The Gauss-Green formula is used to determine a segment finding ellipse overlap areas. In a more down-to-earth set-
area between two points on an ellipse. Overlap between two ting, calculating ellipse overlap areas is useful for model-
ellipses is calculated by combining the areas of appropri- ing pedestrian dynamics. The approach described in [4] sur-
ate segments and polygons in each ellipse. For four of the rounds each pedestrian by an elliptical footprint area that
ten possible orientations of two ellipses, the method requires the model uses to anticipate obstacles and other pedestrians
numerical determination of transverse intersection points. in or near the intended path. A force-based model produces
Approximate intersection points can be determined by solv- a repulsive force between ellipses, causing the pedestrians
ing the two implicit ellipse equations simultaneously. Alter- to slow down or change course when the exclusion force
native approaches for finding transverse intersection points becomes large. To calibrate the strength of the repulsive force
are available using tools from algebraic geometry, e.g., based a quantity describing the amount of overlapping between two
on solving an Eigen-problem that is related to companion ellipses was defined, which requires calculating the overlap
matrices of the two implicit ellipse curves. Implementations area between many different ellipses in general orientations
in C of several algorithm options are analyzed for accuracy, and the overlap algorithm must be efficient, so as not to bog
precision and robustness with a range of input ellipses. down the simulation.
Overlap area between two ellipses can be determined with
Keywords Ellipse segment · Ellipse sector · Ellipse area · high accuracy and precision by Monte Carlo integration (e.g.,
Ellipse overlap · Quartic formula · Ellipse · Algorithm [17]), but the method is numerically intensive. More efficient
approaches for determining ellipse areas based on approx-
imating the ellipse curves with polygons [9,11], adaptive
1 Introduction polygons [10], polytopes [1], and polyarcs [8] have also been
described. For these methods, accuracy of the overlap area
Ellipses are useful in many applied scenarios, and in widely value is governed by the number of sample points used to rep-
disparate fields. In our research, we have encountered a com- resent the original curve with a polygon or other proxy curve.
mon need for efficiently calculating the overlap area between Other than Monte Carlo integration, we have yet to find any
ellipse overlap area algorithms in the peer-reviewed litera-
ture that do not rely on use of proxy curves. An un-published
algorithm that does not use proxy curves is available online
G. B. Hughes (B)
California Polytechnic State University, San Luis Obispo, CA, USA [5].
e-mail: gbhughes@calpoly.edu
– In this paper, we provide an algorithm that determines the
M. Chraibi
overlap area between two general ellipses without using
Forschungszentrum JüLich, JüLich Supercomputing Centre,
Jülich, Germany proxy curves. We first find the area of an ellipse segment,
e-mail: m.chraibi@fz-juelich.de which is the area between a secant line and the ellipse
boundary. The segment algorithm then forms the basis of ellipses is generally accomplished by implicitizing the para-
an application for calculating the overlap area between two metric form. For a general ellipse that may be rotated and
general ellipses, using points of intersection between the translated, the implicit polynomial form is written in the con-
two ellipses to identify appropriate segment areas. Inter- ventional way as:
section points can be found by solving the two implicit
ellipse equations simultaneously. Alternative methods for
determining intersection points can be adopted from Alge- A A · x 2 + B B · x · y + CC · y 2 + D D · x
braic Geometry, such as solving an Eigen-problem that + EE · y + FF = 0 (4a)
is formed from companion matrices of the two implicit
ellipse curves. Accuracy of the area estimate is deter-
Equation (4a) can also be written as the matrix equation XT ·
mined by accuracy and precision of calculated intersec-
A · X = 0, where XT = [x, y, 1] and A is the symmetric
tion points. The algorithm is implemented in C and tested
matrix of coefficients [(ai, j )]:
with a range of input ellipses.
An algorithm for ellipse overlap area benefits from first 3. Interpret Coefficients of λ3 + a · λ2 + b · λ + c
determining relative ellipse positions. A robust approach for
characterizing the relative positions of two ellipses with- s4 = −27 · c3 + 18 · c · a · b + a 2 · b2
out knowledge of intersection points is described by [7]. −4 · a 3 · c − 4 · b3
For two ellipses with coefficient matrices A = [(ai, j )] and
B = [(bi, j )] as annotated in Eq. (4b), the characteristic poly-
nomial of the pencil λA + B is defined as:
f (λ) = det (λ · A + B) = λ3 + a · λ2 + b · λ + c (11)
To summarize results from [7], it is not necessary to deter-
mine roots of the characteristic polynomial. Cases shown in
Fig. 3 can be discerned by evaluating inequalities of algebraic
combinations of the characteristic polynomial coefficients.
In the context of calculating ellipse area overlap, six of
the 10 possible relative positions of two ellipses can be dis-
pensed before attempting to determine points of intersection.
Determining relative position reduces the overall calculations
required by an overlap area routine that is called many times,
as in a simulation. The approach may also avoid sending some
ill-conditioned cases to the intersection routine. On the other
hand, some ill-conditioned cases may be mis-classified by
the relative position algorithm, leading to erroneous overlap
area results; difficult cases are discussed in Sect. 3.6.
An algorithm adapted from [7] for determining the rel-
ative position of two general ellipses defined implicitly as
(A A1 , B B1 , CC1 , D D1 , E E 1 , F F1 ) and (A A2 , B B2 , CC2 ,
D D2 , E E 2 , F F2 ) called ELLIPSE_CASE is outlined below.
1. {A A1 , B B1 , CC1 , D D1 , E E 1 , F F1 } , { A A2 , B B2 , CC2 ,
D D2 , E E 2 , F F2 } Inputs to the algorithm
2. Calculate coefficients of det (λ · [A] + [B]) = λ3 + a ·
λ2 + b · λ + c
d = A A1 · CC1 · F F1 − E E 12
− CC1 · D D12 − 2 · B B1 · D D1 · E E 1 + F F1 · B B12
1
a= · [A A1 · (CC1 · F F2 − 2 · E E 1 · E E 2 + F F1 · CC2 )
d
+ 2 · B B1 · (E E 1 · D D2 − F F1 · B B2 + D D1 · E E 2 )
Fig. 3 Classification of the
relative positions of two ellipses
from [7]. A tenth possible
configuration is represented by
coincident ellipses, i.e., the two
ellipses are the same. Overlap
area for cases 3, 4, 6, 7, 8 and 10
can be calculated directly from
1: Transversal 2: Transversal at 2 Points 3: Separated
Eq. (7). For the remaining four
at 4 Points
cases, overlap area is
determined by combining the
areas of appropriate segments
and polygons in each ellipse,
based on the position of
transverse intersection points
3.2 Determining transverse intersection points I: a direct whenever their Bézout determinant is zero:
approach
(u 1 · v0 − u 0 · v1 ) · (u 2 · v1 − u 1 · v2 )
A direct approach for finding intersection points, discussed in − (u 2 · v0 − u 0 · v2 )2 = 0 (14)
[5], seeks to solve the two implicit ellipse equations simulta-
Using the definitions from Eq. (13) and substituting into
neously. The two polynomials, in the form of Eq. (4a), can be
Eq. (14) produces a quartic polynomial in y with the fol-
re-written as quadratic polynomials in x whose coefficients
lowing coefficients:
are functions of y:
cy[4] · y 4 + cy[3] · y 3 + cy[2] · y 2
(A A1 ) · x 2 + (B B1 · y + D D1 ) · x + CC1 · y 2
+ cy[1] · y 1 + cy[0] = 0 (15)
+E E 1 · y + F F1 ) = 0 (12a)
where:
(A A2 ) · x 2 + (B B2 · y + D D2 ) · x + CC2 · y 2
+E E 2 · y + F F2 ) = 0 (12b) cy[4] = (B B1 · CC2 − CC1 · B B2 ) · (A A1 · B B2 − B B1 · A A2 )
− (A A1 · CC2 − CC1 · A A2 )2
Any points of intersection (x, y) for the two ellipses will
cy[3] = 2 · (E E 1 · A A2 − A A1 · E E 2 ) · (A A1 · CC2 − CC1 · A A2 )
satisfy Eqs. (12a) and (12b) simultaneously. For convenience,
+ (D D1 · CC2 + B B1 · E E 2 − E E 1 · B B2 − CC1 · D D2 )
the coefficients can be substituted:
· (A A1 · B B2 − B B1 · A A2 ) + (B B1 · CC2 − CC1 · B B2 )
u2 · x 2 + u1 · x + u0 = 0 · (A A1 · D D2 − D D1 · A A2 )
u 2 = (A A1 ), u 1 = (B B1 · y + D D1 ) , cy[2] = 2 · (F F1 · A A2 − A A1 · F F2 ) · (A A1 · CC2 − CC1 · A A2 )
+ (D D1 · E E 2 + B B1 · F F2 − F F1 · B B2
u 0 = CC1 · y 2 + E E 1 · y + F F1 (13a)
−E E 1 · D D2 ) · (A A1 · B B2 − B B1 · A A2 )
v2 · x 2 + v1 · x + v0 = 0 + (D D1 · CC2 + B B1 · E E 2 − E E 1 · B B2 − CC1 · D D2 )
v2 = (A A2 ), v1 = (B B2 · y + D D2 ) , · (A A1 · D D2 − D D1 · A A2 ) − (A A1 · E E 2 − E E 1 · A A2 )2
cy[1] = 2 · (F F1 · A A2 − A A1 · F F2 ) · (A A1 · E E 2 − E E 1 · A A2 )
v0 = CC2 · y 2 + E E 2 · y + F F2 (13b)
+ (D D1 · E E 2 + B B1 · F F2 − F F1 · B B2 − E E 1 · D D2 )
Using a standard approach (developed in the nineteenth cen- · (A A1 · D D2 − D D1 · A A2 )
tury), the two polynomials of Eq. (13) have a common root + (D D1 · F F2 − F F1 · D D2 ) · (A A1 · B B2 − B B1 · A A2 )
cy[0] = (D D1 · F F2 − F F1 · D D2 ) · (A A1 · D D2 − D D1 · A A2 ) and QUADROOTS to handle all the possible polynomial
− (A A1 · F F2 − F F1 · A A2 )2 cases that arise when seeking points of intersection for two
ellipses.
When roots of Eq. (15) are found, y-values where the poly-
nomials of Eq. (12) intersect can be determined by: 3.3 Determining transverse intersection points II: tools
A A1 · (CC2 · ȳ 2 +E E
from algebraic geometry
2 · ȳ+F F2 )−A A2 · (CC 1 · ȳ 2 +E E
1 · ȳ + F F1 )
ȳ =
A A2 · (B B1 · ȳ + D D1 ) − A A1 · (B B2 · ȳ + D D2 )
(16) To identify intersection points, the direct approach of solv-
ing the two implicit ellipse equations simultaneously is eas-
To find points of intersection, substitute each ȳ back into Eq. ily implemented. However, even with accurate root-finding
(12a) (or Eq. (12b)), and solve for two x̄ values, using the algorithms, the direct approach encounters difficulties with
quadratic formula: some ill-conditioned cases. The root-finding algorithms in
− (B B1 · ȳ + D D1 ) ± A A2 · (B B1 · ȳ + D D1 )2 − 4 · A A1 · CC1 · ȳ 2 + E E 1 · ȳ + F F1
x̄ = (17)
2 · A A1
Pairs (x̄, ȳ) that satisfy both Eqs. (12a) and (12b) represent [15] and [19] are robust in general situations; even so, both
points of intersection of the two original ellipses. algorithms are still susceptible to error propagation from
Many options exist for numeric solution of the quartic inexact coefficients, particularly when there are multiple
polynomial in Eq. (15); see, e.g, [16] or [6] for a survey roots or roots that are clustered very close together. The direct
of modern methods, and [13] for a comprehensive list of approach calculates polynomial coefficients from Eq. (15),
root-finding references. However, polynomial root-finding and will send difficult polynomials to the root-finding routine
remains a challenging problem, and until recently the accu- in cases where the curves intersect at a shallow angle. Robust-
racy of most numerical implementations has been limited, ness of the area overlap algorithm can be improved using
particularly when multiple roots are present or when inex- methods from algebraic geometry that have been designed
act coefficients are supplied. Several algorithms have been specifically for identifying intersection points of implicitly
introduced recently that provide improved accuracy. One defined curves.
such algorithm is described in [15], based on recursive Several independent approaches are available for finding
numerical splitting of the input polynomial into the prod- intersection points of two implicit curves. [12] describe a
uct of factors. Another routine with improved accuracy is method for computing geometrically isolated higher order
gsl_poly_complex_solve from the GNU scientific intersections of curves. A similar method is described in
library (GSL), which is based on [19]. A custom GSL exten- [3]. Both of these methods are based on solving an Eigen-
sion specifically for quartic polynomials is also available problem that is related to companion matrices of the two
[18]. The algorithm in [19] first calculates the multiplicity implicit ellipse curves. In the context of finding intersection
structure for the roots, and computes an initial approxima- points, one advantage of the companion matrix approach is
tion to the roots; the initial approximation is then refined to that accuracy of numerical approaches for Eigen-problems
an optimal accuracy. is well-studied, and error bounds for intersection points can
In the context of determining ellipse area overlap for a sim- be established.
ulation, some benefit may be obtained from a non-iterative
solution of the quartic equation, even if results are less accu- 3.4 Overlap area determination
rate than iterative solvers can provide. An expedient (non-
iterative) method for determining roots of the polynomial In six of the 10 possible relative positions of two ellipses
in Eq. (15) can be accomplished using Ferrari’s quartic for- shown in Fig. 3, ellipse overlap area can be calculated
mula. A numerical implementation of Ferrari’s formula is directly. In relative positions 3 and 6, the ellipses are disjoint
given in [14]. Four complex roots are returned, and any roots and the overlap area is 0. In relative position 10 (coincident
whose imaginary part is returned as zero is a real root. When ellipses), the overlap area is π · A · B. For relative positions 4,
polynomial coefficients are constructed as in Eq. (15), the 7 and 8, the overlap area is the area of the contained ellipse,
general case of two distinct ellipses typically results in a which must be the smaller of the two ellipse areas.
quartic polynomial, i.e., the coefficient cy[4] of Eq. (15) Relative positions 2 and 9 each have two intersection
is non-zero. However, certain cases lead to polynomials of points. Overlap area is found by adding the area of two ellipse
lesser degree. The solver in [14] is conveniently modular, pro- segments, one from each ellipse, as shown in Fig. 4. The two
viding separate functions BIQUADROOTS, CUBICROOTS intersection points (x1 , y1 ) and (x2 , y2 ) must be passed to
Fig. 4 Relative Positions 2 and 9 have two transverse intersection Fig. 5 Relative position 5 (left) has three intersection points, but only
points. Overlap area is found by adding the area of two ellipse seg- two are transverse. Overlap area is found by determining which two
ments, one from each ellipse points are transverse, then adding the area of two ellipse segments,
one from each ellipse. Relative position 1 (right) has four transverse
intersection points. Overlap area is found by adding the area of four
the segment area algorithm in the order that will return the ellipse segments, two from each ellipse, and one quadrilateral
correct segment from each ellipse. Only one area from each
ellipse contributes to the overlap area. A check is made to
determine which point order will return the desired segment
point corresponds to a root of multiplicity 2. For ellipses
area for each ellipse. First, the parametric angles θ1 and θ2
in relative position 9, there are two transverse intersection
corresponding to (x1 , y1 ) and (x2 , y2 ) on the first ellipse are
points; one of the points corresponds to a root of multiplicity
determined, by the rules in Table 1. Then, a point midway
1, and the other corresponds to a root of multiplicity 3.
between (x1 , y1 ) and (x2 , y2 ) on the first ellipse is found
Relative position 1 consists four transverse intersection
using the parametric form:
points, shown in Fig. 5. The two ellipse curves must cross at
θ1 + θ2 all four of the intersection points, resulting in a partial over-
xmid = A · cos(ϕ1 ) · cos lap. The overlap area consists of two segments from each
2
ellipse, and a central convex quadrilateral. The four inter-
θ1 + θ2
−B · sin(ϕ1 ) · sin + h1 (18a) section points are sorted ascending in a counter-clockwise
2
order around the first ellipse. The ordered set of intersection
θ1 + θ2
ymid = A · sin(ϕ1 ) · cos points is (x1 , y1 ), (x2 , y2 ), (x3 , y3 ) and (x4 , y4 ). The order-
2 ing allows a direct calculation of the quadrilateral area. The
θ1 + θ2 standard formula uses the cross-product of the two diagonals:
+B · cos(ϕ1 ) · sin + k1 (18b)
2
The point (xmid , ymid ) is on the first ellipse between (x1 , y1 )
1
and (x2 , y2 ) when travelling counter- clockwise from (x1 , y1 ) area = x3 − x1 , y3 − y1 × x4 − x2 , y4 − y2
and (x2 , y2 ). If (xmid , ymid ) is inside the second ellipse, 2
1
then the desired segment of the first ellipse contains the = (x3 − x1 ) · y4 − y2 − (x4 − x2 ) · (x3 − x1 )
point (xmid , ymid ), and the segment algorithm should inte- 2
(20)
grate counterclockwise from (x1 , y1 ) to (x2 , y2 ), which
is the default order. Otherwise, the order of the points
should be reversed before calling the segment algorithm. The
implicit polynomial form can be used to determine whether The point ordering also simplifies the search for the appro-
(xmid , ymid ) is inside or outside the second ellipse: priate segments of each ellipse that contribute to the overlap
area. Suppose that the first two sorted points (x1 , y1 ) and
T = A A2 · xmid
2
+ B B2 · xmid · ymid + CC2 · ymid
2 (x2 , y2 ) demarcate a segment of the first ellipse that con-
+D D2 · xmid + E E 2 · ymid + F F2 (19) tributes to the overlap area. It follows that contributing seg-
ments from the first ellipse are between the points (x1 , y1 ) and
If T < 0 then the point (xmid , ymid ) is inside the second (x2 , y2 ), and also between the points (x3 , y3 ) and (x4 , y4 ). In
ellipse. The desired segment area from the second ellipse is this case, the contributing segments from the second ellipse
found in a manner similar to the first ellipse. are between the points (x2 , y2 ) and (x3 , y3 ), and between the
Relative position 5 has three intersection points, but only points (x4 , y4 ) and (x1 , y1 ). To determine which segments
two are transverse. Overlap area can be found by the same contribute to the overlap area, it suffices to test whether a
method as relative positions 2 and 9, if the two transverse point midway between the points (x1 , y1 ) and (x2 , y2 ) is
intersection points are used, as shown in Fig. 5. For ellipses inside or outside the second ellipse. The segment algorithm is
in relative position 5, the transverse intersection points corre- used for each of the four areas, and added to the quadrilateral
spond to roots of multiplicity 1. The tangential intersection to obtain the total overlap area.
3.5 General overlap area algorithm 3.6 Notes on accuracy, precision, and robustness
Combining the results presented above leads to an algo- The algorithms presented in this paper describe an approach
rithm for determining the overlap area between two general for determining the overlap area between two general
ellipses defined parametrically as (A1 , B1 , h 1 , k1 , ϕ1 ) and ellipses. Any numerical implementation of the algorithm is
(A2 , B2 , h 2 , k2 , ϕ2 ). The algorithm ELLIPSE_OVERLAP is susceptible to propagation of fixed-point round-off errors.
outlined below. Condition of the implicitization operation Round-off errors that arise during implicitization of the
can be improved for some difficult cases by translating both ellipse parameters using Eq. (5) can produce inexact poly-
ellipses to put the midpoint of the two ellipse centers at the nomial coefficients, leading to inaccurate roots. Inaccuracy
origin. Translation does not affect the relative position of the the polynomial roots produces perturbed intersection points,
two original ellipses. and the error propagates to the determination of polygon and
ellipse sector areas. Closed-form determination of overlap
areas is not available for all but the simplest cases, so absolute
accuracy of the algorithm is not obtainable. For ellipses that
1. A1 , B1 , h̄ 1 , k̄1 , ϕ1 , A2 , B2 , h̄ 2 , k̄2 , ϕ2 Inputs to the
are commonly encountered in applications, errors in the over-
algorithm
lap area algorithm are directly tied to root-finding, for which
h̄ i h i − h 1 +h 2
error bounds are available [15]. We have encountered some
2. = 2 , i = 1, 2
k̄i ki − k1 +k 2
2
‘odd’ cases, such as extremely eccentric ellipses, where the
algorithm returns the wrong polynomial case; in these situ-
A1 , B1 , h̄ 1 , k̄1 , ϕ1 →{A A1 ,B B1 ,CC1 ,D D1 ,E E 1 ,F F1 }
3. ations, the area returned by the algorithm is unrelated to the
A2 , B2 , h̄ 2 , k̄2 , ϕ2 →{A A2 ,B B2 ,CC2 ,D D2 ,E E 2 ,F F2 }
actual overlap area.
by Eq. (5) A relevant question is whether the algorithm as presented
4. Determine relative position of the two implicitly defined here will handle cases where one or both ellipses are circles.
ellipses by ELLIPSE_CASE algorithm adapted from [7], In such cases, inputs to the algorithm could include one or
as given in Sect. 3.1 two ellipses defined using the parametric definition for an
5. RELATIVE POSITION: ellipse as (A, A, h, k, 0), representing a circle of radius A
CASE10: one ellipse contained in the other centered at (h, k). The implicitization of Eq. (5) is still valid,
AREA = π · A1 · B1 = π · A2 · B2 : RETURN and simplifies to:
CASE 3, 6: no overlap area 1
AREA=0: RETURN A A = a1,1 = (21a)
A2
CASE 4, 7, 8: one ellipse contained in the other BB = 2 · a1,2 = 0 (21b)
AREA = min {π · A1 · B1 , π · A2 · B2 } : RETURN 1
CASE 1, 2, 5, 9: transverse intersections CC = a2,2 = 2 (21c)
A
Calculate coefficients cy[4], cy[3], cy[2], cy[1], −2 · h
cy[0] by Eq. (15) DD = 2 · a1,3 = (21d)
A2
Solve quartic cy[4] · y 4 + cy[3] · y 3 + cy[2] · −2 · k
y 2 + cy[1] · y 1 + cy[0] = 0 EE = 2 · a2,3 = (21e)
A2
Calculate intersection points (x̄, ȳ) by Eqs. (16) 2
h k2
and (17) FF = a3,3 = 2 + 2 − 1 (21f)
A A
CASE 2, 5, 9: two transverse intersections Following the algorithm by inputting circles as ellipses
Calculate segment area contributed by each with the appropriate features, the polynomial coefficients
ellipse using ELLIPSE_SEGMENT algo- of Eq. (15) are calculated, as shown in Eq. (21), and the
rithm, as given in Sect. 2.4 algorithm returns the correct overlap area where one or both
AREA = Segment 1 + Segment 2:RETURN curves are circles. The eccentricity of a circle is zero, so cir-
CASE 1: four transverse intersections cles do not result in eccentricity-related issues for the algo-
Calculate four segment areas contributed rithm. Circles that are very close in size and position can still
by each ellipse using ELLIPSE_SEGMENT lead to difficult root-finding cases.
algorithm, as given in Sect. 2.4 An implementation in C-code of the ELLIPSE_OVERLAP
Calculate quadrilateral area contributed by algorithm and all of its dependencies was compiled and run
each ellipse using Eq. (20) under Cygwin-1.7.7-1 and Debian 7.2 (Wheezy), and returns
AREA = Segment 1 + Segment 2 + Segment the following values for examples of the test cases presented
3 + Segment 4+Quadrilateral :RETURN in Fig. 3:
//-- CASE 1
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 3.; B2 = 1.; H2 = 1.; K2 = -0.5; PHI_2 = pi/4.;
//-- CASE 2
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 2.; B2 = 1.; H2 = -2.; K2 = -1.; PHI_2 = pi/4.;
//-- CASE 3
A1 = 2.; B1 = 1.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 1.5; B2 = 0.75; H2 = -2.5; K2 = 1.5; PHI_2 = pi/4.;
//-- CASE 4
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 2.; B2 = 1.; H2 = -.75; K2 = 0.25; PHI_2 = pi/4.;
//-- CASE 5
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 3.; B2 = 3.; H2 = 0.; K2 = 1.; PHI_2 = 0.;
//-- CASE 6
A1 = 2.; B1 = 1.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 2.; B2 = 1.; H2 = 0.; K2 = 2.; PHI_2 = 0.;
//-- CASE 7
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 2.; B2 = 1.; H2 = -1.0245209260022; K2 = 0.2 5; PHI_2 = pi/4.;
//-- CASE 8
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 1.; B2 = 2.; H2 = 0.; K2 = 0.; PHI_2 = 0.;
//-- CASE 9
AA1 = 9.; BB1 = 0.; CC1 = 100; DD1 = 0.; EE1 = 0.;
; FF1 = -81. ;
AA2 = 143.; BB2 = 0.; CC2 = 773; DD2 = -267.; EE2 = -155.; F F2 = -509.;
//-- CASE 10
A1 = 3.; B1 = 2.; H1 = 0.; K1 = 0.; PHI_1 = 0.;
A2 = 3.; B2 = 2.; H2 = 0.; K2 = 0.; PHI_2 = 0.;