00001 /** 00002 * \file Cone3D.h 00003 * \brief stores a cone 00004 * 00005 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00006 */ 00007 00008 #ifndef IMPALGEBRA_CONE_3D_H 00009 #define IMPALGEBRA_CONE_3D_H 00010 00011 #include "Vector3D.h" 00012 #include "Sphere3D.h" 00013 #include "SpherePatch3D.h" 00014 #include "Plane3D.h" 00015 #include "Segment3D.h" 00016 #include <iostream> 00017 #include <IMP/constants.h> 00018 00019 00020 IMPALGEBRA_BEGIN_NAMESPACE 00021 /** 00022 In general, a cone is a pyramid with a circular cross section. 00023 A right cone is a cone with its vertex above the center of its base. 00024 However, when used without qualification, the term "cone" often means 00025 "right cone." We have implemented a "right cone". 00026 \geometry 00027 */ 00028 class IMPALGEBRAEXPORT Cone3D 00029 { 00030 public: 00031 Cone3D(){} 00032 // A cone with a top at s.get_point(0) and the given base radius 00033 Cone3D(const Segment3D &s,double radius); 00034 //!Get the vertex of the cone 00035 VectorD<3> get_tip() const {return seg_.get_point(0);} 00036 //!Get the direction of the axis of the cone 00037 /** This vector points from the tip into the occupied volume. 00038 */ 00039 VectorD<3> get_direction() const {return seg_.get_direction();} 00040 double get_height() const {return seg_.get_length();} 00041 /** The opening angle of a cone is the vertex angle made by a cross section 00042 through the apex and center of the base.*/ 00043 double get_angle() const { 00044 return 2.*std::atan(radius_ / get_height()); 00045 } 00046 //! get the radius of the base circle 00047 double get_radius() const {return radius_;} 00048 bool get_contains(const VectorD<3> &v) const; 00049 //! Get the plane supporting the base of the cone 00050 /** The cone is on the positive side of the plane. 00051 */ 00052 Plane3D get_base_plane() const; 00053 void show(std::ostream &out) const { 00054 out << seg_ << ": " << radius_; 00055 } 00056 private: 00057 Segment3D seg_; 00058 double radius_; 00059 }; 00060 00061 IMP_VOLUME_GEOMETRY_METHODS(Cone3D, IMP_NOT_IMPLEMENTED, 00062 IMP_NOT_IMPLEMENTED, 00063 IMP_NOT_IMPLEMENTED); 00064 IMPALGEBRA_END_NAMESPACE 00065 00066 #endif /* IMPALGEBRA_CONE_3D_H */