View Javadoc

1   /**
2    * File: 	GenericCirculinearDomain2D.java
3    * Project: javaGeom
4    * 
5    * Distributed under the LGPL License.
6    *
7    * Created: 11 mai 09
8    */
9   package math.geom2d.circulinear;
10  
11  import math.geom2d.domain.GenericDomain2D;
12  import math.geom2d.transform.CircleInversion2D;
13  
14  
15  /**
16   * A specialization of GenericDomain2D, whose boundary is constrained to be
17   * circulinear.
18   * @author dlegland
19   *
20   */
21  public class GenericCirculinearDomain2D extends GenericDomain2D 
22  implements CirculinearDomain2D {
23  
24      // ===================================================================
25      // constructors
26  
27  	public GenericCirculinearDomain2D(CirculinearBoundary2D boundary) {
28  		super(boundary);
29  	}
30  	
31  	@Override
32  	public CirculinearBoundary2D getBoundary() {
33  		return (CirculinearBoundary2D) boundary;
34  	}
35  
36  	/* (non-Javadoc)
37  	 * @see math.geom2d.circulinear.CirculinearShape2D#getBuffer(double)
38  	 */
39  	public CirculinearDomain2D getBuffer(double dist) {
40  		return new GenericCirculinearDomain2D(
41  				new CirculinearBoundarySet2D(
42  						CirculinearCurve2DUtils.splitIntersectingContours(
43  								this.getBoundary().getContinuousCurves())));
44  	}
45  
46  	/* (non-Javadoc)
47  	 * @see math.geom2d.circulinear.CirculinearDomain2D#transform(math.geom2d.transform.CircleInversion2D)
48  	 */
49  	public CirculinearDomain2D transform(CircleInversion2D inv) {
50  		// class cast
51  		CirculinearBoundary2D boundary2 = (CirculinearBoundary2D) boundary;
52  		
53  		// transform and reverse
54  		boundary2 = (CirculinearBoundary2D)boundary2.transform(inv).getReverseCurve();
55  		
56  		// create the result domain
57  		return new GenericCirculinearDomain2D(boundary2);
58  	}
59  }