1
2
3
4
5
6
7
8 package org.lcsim.geometry.compact.converter.lcdd.util;
9
10
11
12
13
14
15
16
17 public class PolyhedraRegular extends Solid
18 {
19 double rmin;
20 double rmax;
21
22 public PolyhedraRegular(String name, int nsides, double rmin, double rmax, double zlength)
23 {
24 super("polyhedra", name);
25
26 setAttribute("startphi", String.valueOf(0));
27 setAttribute("deltaphi", String.valueOf(Math.PI * 2) );
28 setAttribute("numsides", String.valueOf(nsides));
29
30 if ( rmin < 0 || rmin > rmax )
31 {
32 throw new IllegalArgumentException("rmin <" + rmin + "> is invalid.");
33 }
34
35 if ( rmax < 0 )
36 {
37 throw new IllegalArgumentException("rmax <" + rmax + "> is invalid.");
38 }
39
40 ZPlane zplane1 = new ZPlane(rmin, rmax, -zlength/2);
41 ZPlane zplane2 = new ZPlane(rmin, rmax, zlength/2);
42
43 addContent(zplane1);
44 addContent(zplane2);
45 }
46 }