00001 #ifndef vsol_cylinder_h_
00002 #define vsol_cylinder_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <vgl/vgl_cylinder.h>
00021 #include <vsol/vsol_spatial_object_3d.h>
00022 #include <vsol/vsol_cylinder_sptr.h>
00023 #include <vsl/vsl_binary_io.h>
00024
00025 class vsol_cylinder : public vsol_spatial_object_3d
00026 {
00027 vgl_cylinder<double> cyl_;
00028
00029 public:
00030 vsol_cylinder() {}
00031
00032 vsol_cylinder(vgl_point_3d<double> centre, double radius, double length)
00033 : cyl_(centre, radius, length) {}
00034
00035 vsol_cylinder(vgl_point_3d<double> centre, double radius, double length,
00036 vgl_vector_3d<double> orient)
00037 : cyl_(centre, radius, length){ cyl_.set_orientation(orient); }
00038
00039
00040 vsol_cylinder(vsol_cylinder const& cyl)
00041 : vsol_spatial_object_3d(cyl), cyl_(cyl.cyl_) {}
00042
00043
00044 bool contains(vgl_point_3d<double> const& p);
00045
00046
00047 vgl_point_3d<double> center() { return cyl_.center(); }
00048 double radius() {return cyl_.radius(); }
00049 double length() {return cyl_.length(); }
00050 vgl_vector_3d<double> orientation() { return cyl_.orientation(); }
00051
00052
00053 void set_orientation(vgl_vector_3d<double> orient) {cyl_.set_orientation(orient);
00054 }
00055
00056 void set_center(vgl_point_3d<double> const & c) {cyl_.set_center(c);}
00057
00058 void set_length(double l) {cyl_.set_length(l);}
00059
00060 void set_radius(double r) {cyl_.set_radius(r);}
00061
00062
00063
00064 void b_write(vsl_b_ostream &os) const;
00065
00066
00067 void b_read(vsl_b_istream &is);
00068
00069
00070 short version() const;
00071
00072
00073 void print_summary(vcl_ostream &os) const;
00074
00075 void describe(vcl_ostream &strm, int blanking) const;
00076
00077
00078 vcl_string is_a() const { return vcl_string("vsol_cylinder"); }
00079
00080
00081 bool is_class(const vcl_string& cls) const { return cls == is_a(); }
00082
00083
00084 vsol_spatial_object_3d_type spatial_type() const { return vsol_spatial_object_3d::VOLUME; }
00085
00086 vsol_spatial_object_3d* clone() const { return new vsol_cylinder(*this); }
00087
00088 virtual ~vsol_cylinder(void) {}
00089 };
00090
00091
00092 void vsl_b_write(vsl_b_ostream &os, const vsol_cylinder* p);
00093
00094
00095 void vsl_b_write(vsl_b_istream &is, vsol_cylinder_sptr &p);
00096
00097
00098 void vsl_b_read(vsl_b_istream &is, vsol_cylinder* &p);
00099
00100
00101 void vsl_b_read(vsl_b_istream &is, vsol_cylinder_sptr &p);
00102
00103 #endif // vsol_cylinder_h_