00001
00002 #ifndef __J2K__JPrism_HPP__
00003 #define __J2K__JPrism_HPP__
00004
00005 #include <j2k/Fred/Geometry/JPrism.hpp>
00006
00007 JPrism::JPrism()
00008 : rc( 0.0, 0.0, 0.0, 0.0 ), height( 0.0 ),
00009 area_cache( 0.0 ), volume_cache( 0.0 ) { }
00010
00011 JPrism::JPrism( double X )
00012 : rc( X, 0.0, 0.0, 0.0 ), height( 0.0 ),
00013 area_cache( 0.0 ), volume_cache( 0.0 ) { }
00014
00015 JPrism::JPrism( double X, double Y )
00016 : rc( X, Y, 0.0, 0.0 ), height( 0.0 ),
00017 area_cache( 0.0 ), volume_cache( 0.0 ) { }
00018
00019 JPrism::JPrism( double X, double Y, doubleLength )
00020 : rc( X, Y, Length, Length ), height( Length ),
00021 area_cache( -1.0 ), volume_cache( -1.0 ) { }
00022
00023 JPrism::JPrism( double X, double Y,
00024 double Length, double Width )
00025 : rc( X, Y, Length, Width ), height( Width ),
00026 area_cache( -1.0 ), volume_cache( -1.0 ) { }
00027
00028 JPrism::JPrism( double X, double Y,
00029 double Length, double Width, double Height )
00030 : rc( X, Y, Length, Width ), height( Height ),
00031 area_cache( -1.0 ), volume_cache( -1.0 ) { }
00032
00033
00034
00035
00036
00037
00038
00039 JPrism& JPrism::setHeight( double Height ) {
00040 height = Height;
00041 return *this;
00042 }
00043
00044
00045 double JPrism::getHeight() const {
00046 return height;
00047 }
00048
00049
00050 double JPrism::area() const {
00051 if ( area_cache < 0.0 ) {
00052 area_cache = 2 * rc.area()
00053 + 2 * rc.getLength() * height
00054 + 2 * rc.getWidth() * height;
00055 }
00056 return area_cache;
00057 }
00058
00059
00060 double JPrism::volume() const {
00061 if ( volume_cache < 0.0 ) {
00062 volume_cache = rc.area() * height;
00063 }
00064 return volume_cache;
00065 }
00066
00067
00068
00069
00070
00071 inline JPrism& JPrism::setLength( double Length ) {
00072 rc.setLength();
00073 return *this;
00074 }
00075
00076 inline JPrism& JPrism::setWidth( double Width ) {
00077 rc.setWidth();
00078 return *this;
00079 }
00080
00081 inline double JPrism::getLength() {
00082 return rc.getLength();
00083 }
00084
00085 inline double JPrism::getWidth() {
00086 return rc.getWidth();
00087 }
00088
00089 inline JPrism& JPrism::setJSquare( double X, double Y,
00090 double Length )
00091 {
00092 p.setPoint( X, Y );
00093 length = Length;
00094 return *this;
00095 }
00096 inline JPrism& JPrism::setJRectangle( double X, double Y,
00097 double Length, double Width )
00098 {
00099 p.setPoint( X, Y );
00100 length = Length;
00101 width = Width;
00102 return *this;
00103 }
00104
00105
00106 inline double JPrism::area() const {
00107 if ( area_cache < 0.0 ) {
00108 area_cache = Length * Width;
00109 }
00110 return area_cache;
00111 }
00112
00113
00114
00115
00116
00117
00118 inline JPrism& JPrism::setPoint( double X, double Y ) {
00119 c.setPoint( X, Y );
00120 return *this;
00121 }
00122
00123
00124 inline JPrism& JPrism::setPolar( double R, double Theta ) {
00125 c.setPolar( R, Theta );
00126 return *this;
00127 }
00128
00129 inline JPrism& JPrism::setJSquare( double X, double Y,
00130 double Length )
00131 {
00132 rc.setJSquare( X, Y, Length );
00133 return *this;
00134 }
00135
00136 inline JPrism& JPrism::setJRectangle( double X, double Y,
00137 double Length, double Width )
00138 {
00139 rc.setJRectangle( X, Y, Length, Width );
00140 return *this;
00141 }
00142
00143 inline JPrism& JPrism::setJCube( double X, double Y,
00144 double Length )
00145 {
00146 rc.setJRectangle( X, Y, Length, Length );
00147 height = Length;
00148 return *this;
00149 }
00150
00151 inline JPrism& JPrism::setJPrism( double X, double Y,
00152 double Length, double Width, double Height )
00153 {
00154 rc.setJRectangle( X, Y, Length, Width );
00155 height = Height;
00156 return *this;
00157 }
00158
00159
00160 inline JPrism& JPrism::setX( double X ) {
00161 rc.setX( X );
00162 return *this;
00163 }
00164
00165 inline JPrism& JPrism::setY( double Y ) {
00166 rc.setY( Y );
00167 return *this;
00168 }
00169
00170 inline JPrism& JPrism::setR( double R ) {
00171 rc.setR( R );
00172 return *this;
00173 }
00174
00175 inline JPrism& JPrism::setAngle( double Theta ) {
00176 rc.setAngle( Theta );
00177 return *this;
00178 }
00179
00180
00181 inline double getX() const {
00182 return rc.getX();
00183 }
00184
00185
00186 inline double getY() const {
00187 return rc.getY();
00188 }
00189
00190
00191 inline double getR() const {
00192 return rc.getR();
00193 }
00194
00195
00196 inline double getAngle() const {
00197 return rc.getAngle();
00198 }
00199
00200 #endif