#include <Square.hpp>
Public Methods | |
| JSquare () JSquare(double X) | |
| JSquare (double X, double Y) | |
| JSquare (double X, double Y, double length) | |
| double | getLength () const |
| double | area () const |
| JSquare & | setJSquare (double X, double Y, double Length) |
| JSquare & | setLength (double Length) |
| void | check () |
| JSquare & | setPoint (double X, double Y) |
| JSquare & | setPolar (double X, double Y) |
| JSquare & | setX (double X) |
| JSquare & | setY (double Y) |
| JSquare & | setR (double R) |
| JSquare & | setAngle (double Theta) |
| double | getX () const |
| double | getY () const |
| double | getR () const |
| double | getAngle () const |
Protected Attributes | |
| JPoint & | p |
| double | length |
| double | area_cache |
Friends | |
| ostream & | operator<< (ostream &output, const JSquare &sq) |
|
|
Definition at line 9 of file Square.cpp. 00010 : p( 0.0, 0.0 ), length( 0.0 ), area_cache( 0.0 ) { } |
|
||||||||||||
|
Definition at line 15 of file Square.cpp. 00016 : p( X, Y ), length( 0.0 ), area_cache( 0.0 ) { } |
|
||||||||||||||||
|
Definition at line 18 of file Square.cpp. 00019 : p( X, Y ), length( Length ), area_cache( -1.0 ) { check(); } |
|
|
Definition at line 52 of file Square.cpp. Referenced by JCube::area().
00052 {
00053 if ( area_cache < 0.0 ) {
00054 area_cache = Length * Length;
00055 }
00056 return area_cache;
00057 }
|
|
|
Definition at line 59 of file Square.cpp. Referenced by JSquare(), and setLength().
00059 {
00060 if ( length <= 0 ) {
00061 length = 0;
00062 }
00063 }
|
|
|
|
|
|
Definition at line 38 of file Square.cpp. Referenced by JCube::volume().
00038 {
00039 return length;
00040 }
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 90 of file Square.cpp. 00090 {
00091 p.setAngle( Theta );
00092 return *this;
00093 }
|
|
||||||||||||||||
|
|
|
|
JSquare related functions. ////////////////////////////////////////////////////////////////////////////.
Definition at line 32 of file Square.cpp. 00032 {
00033 length = Length;
00034 check();
00035 }
|
|
||||||||||||
|
Definition at line 22 of file Square.cpp. 00022 {
00023 p.setPoint( X, Y );
00024 return *this;
00025 }
|
|
||||||||||||
|
Point related functions. ////////////////////////////////////////////////////////////////////////////.
Definition at line 70 of file Square.cpp. 00070 {
00071 p.setPolar( R, Theta );
00072 return *this;
00073 }
|
|
|
Definition at line 85 of file Square.cpp. 00085 {
00086 p.setR( R );
00087 return *this;
00088 }
|
|
|
Definition at line 75 of file Square.cpp. 00075 {
00076 p.setX( X );
00077 return *this;
00078 }
|
|
|
Definition at line 80 of file Square.cpp. 00080 {
00081 p.setY( Y );
00082 return *this;
00083 }
|
|
||||||||||||
|
Definition at line 44 of file Square.hpp. 00045 {
00046 output << "Position = " << sq.p
00047 << "; Length = "
00048 << setiosflags( ios::fixed | ios::showpoint )
00049 << setprecision( 2 ) << sq.Length;
00050 return output; // Enable cascaded calls
00051 }
|
|
|
Definition at line 56 of file Square.hpp. |
|
|
Definition at line 55 of file Square.hpp. |
|
|
Definition at line 54 of file Square.hpp. Referenced by operator<<().
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001