This project has retired. For details please refer to its Attic page.
ComplexRectangle xref

1   ////////////////////////////////////////////////////////////////////////////////
2   ////////////////////////////////////////////////////////////////////////////////
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  package org.apache.chemistry.opencmis.util.content.fractal;
23  
24  
25  public class ComplexRectangle {
26      private double iMin; // imaginary
27      private double iMax;
28      private double rMin; // real
29      private double rMax;
30  
31      public ComplexRectangle(double r1, double r2, double i1, double i2) {
32          set(r1, r2, i1, i2);
33      }
34  
35      public ComplexRectangle() {
36          set(0.0, 0.0, 0.0, 0.0);
37      }
38  
39      public ComplexRectangle(ComplexRectangle cr) {
40          set(cr);
41      }
42  
43      public double getIMin() {
44          return iMin;
45      }
46  
47      public double getIMax() {
48          return iMax;
49      }
50  
51      public double getRMin() {
52          return rMin;
53      }
54  
55      public double getRMax() {
56          return rMax;
57      }
58  
59      public double getHeight() {
60          return iMax - iMin;
61      }
62  
63      public double getWidth() {
64          return rMax - rMin;
65      }
66  
67      public void set(ComplexRectangle cr) {
68          set(cr.getRMin(), cr.getRMax(), cr.getIMin(), cr.getIMax());
69      }
70  
71      public void set(ComplexPoint p1, ComplexPoint p2) {
72          set(p1.getReal(), p2.getReal(), p1.getImaginary(), p2.getImaginary());
73      }
74  
75      public void set(double r1, double r2, double i1, double i2) {
76          if (r1 > r2) {
77              rMin = r2;
78              rMax = r1;
79          } else {
80              rMin = r1;
81              rMax = r2;
82          }
83          if (i1 > i2) {
84              iMin = i2;
85              iMax = i1;
86          } else {
87              iMin = i1;
88              iMax = i2;
89          }
90      }
91  }