Source code: rcs/posemath/PmCylindrical.java
1 /*
2 * New Java File starts here.
3 * This file should be named PmCylindrical.java
4 */
5
6
7 // Set Package Name
8 package rcs.posemath;
9
10 // Import all NML, CMS, and RCS classes and interfaces
11 import rcs.*;
12 import rcs.nml.*;
13 import rcs.utils.*;
14
15 /*
16 * Class definition for PmCylindrical
17 * Automatically generated by RCS Java Diagnostics Tool.
18 * on Wed Jan 07 10:53:44 EST 1998
19 */
20 public class PmCylindrical
21 {
22 public double theta = 0;
23 public double r = 0;
24 public double z = 0;
25
26 public void update(NMLFormatConverter nml_fc)
27 {
28 theta = nml_fc.update(theta);
29 r = nml_fc.update(r);
30 z = nml_fc.update(z);
31
32 }
33
34 PmCylindrical()
35 {
36 }
37
38 PmCylindrical(double starttheta, double startr, double startz) throws PmException
39 {
40 if(startr < -Posemath.V_FUZZ)
41 {
42 throw new PmException(Posemath.PM_ERR, "PmCylindrical radius is less than zero!");
43 }
44 if(startr < 0.0)
45 {
46 startr = 0.0;
47 }
48 if(starttheta > Math.PI)
49 {
50 starttheta = starttheta - 2*Math.PI*Math.ceil(starttheta/(Math.PI*2));
51 }
52 if(starttheta < -Math.PI)
53 {
54 starttheta = starttheta + 2*Math.PI*Math.ceil((-starttheta)/(Math.PI*2));
55 }
56 theta = starttheta;
57 r = startr;
58 z = startz;
59 }
60
61 public boolean equals(PmCylindrical c) throws PmException
62 {
63 if(null == c)
64 {
65 return false;
66 }
67 return Posemath.pmCylCylCompare(c,this);
68 }
69
70 public boolean equals(PmCartesian v) throws PmException
71 {
72 if(null == v)
73 {
74 return false;
75 }
76 PmCartesian thisv = new PmCartesian();
77 Posemath.pmCylCartConvert(this,thisv);
78 return Posemath.pmCartCartCompare(v,thisv);
79 }
80
81 public boolean equals(PmSpherical s) throws PmException
82 {
83 if(null == s)
84 {
85 return false;
86 }
87 PmCartesian thisv = new PmCartesian();
88 Posemath.pmCylCartConvert(this,thisv);
89 PmCartesian v = new PmCartesian();
90 Posemath.pmSphCartConvert(s,v);
91 return Posemath.pmCartCartCompare(v,thisv);
92 }
93
94 public String toString()
95 {
96 return " { theta ="+theta+", r = "+r+", z = "+z+" } ";
97 }
98 }
99