2 #ifndef vgl_sphere_3d_h 3 #define vgl_sphere_3d_h 11 # include <vcl_msvc_warnings.h> 71 Type& x, Type& y, Type& z)
const;
81 std::ostream&
print(std::ostream& os)
const;
88 std::istream&
read(std::istream& is);
100 template <
class Type>
104 #define VGL_SPHERE_3D_INSTANTIATE(T) extern "please include vgl/vgl_sphere_3d.hxx first" 106 #endif // vgl_sphere_3d_h vgl_sphere_3d(Type px, Type py, Type pz, Type rad)
Construct from four scalars: centre and radius.
bool operator==(const vgl_sphere_3d< Type > &s) const
Test for equality.
bool is_empty() const
Return true if this sphere is empty.
Represents a cartesian 3D point.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
void set_empty()
Make the sphere empty.
A class to hold a non-homogeneous representation of a 3D line.
vgl_point_3d< Type > c_
centre
std::ostream & print(std::ostream &os) const
Writes "<vgl_sphere_3d centre=vgl_point_3d<x,y,z> radius=r)>" to stream.
a point in 3D nonhomogeneous space
Represents a cartesian 3D point.
vgl_sphere_3d(vgl_point_3d< Type > const &cntr, Type rad)
Construct from centre point and radius.
void cartesian_to_spherical(Type x, Type y, Type z, Type &elevation_rad, Type &azimuth_rad) const
find elevation and azimuth of closest point on the sphere to x,y,z.
std::istream & read(std::istream &is)
Read from stream, possibly with formatting.
void set_radius(Type r)
Set radius r of this sphere (while centre unchanged).
const vgl_point_3d< Type > & centre() const
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
bool clip(const vgl_line_3d_2_points< Type > &line, vgl_point_3d< Type > &p1, vgl_point_3d< Type > &p2) const
Calculate the end points of a line clipped by this sphere.
vgl_sphere_3d()
Default constructor.
bool operator!=(vgl_sphere_3d< Type >const &s) const
Test for inequality.
void spherical_to_cartesian(Type elevation_rad, Type azimuth_rad, Type &x, Type &y, Type &z) const
convert point on sphere to Cartesian coordinates, angles in radians.
void set_centre(const vgl_point_3d< Type > &c)
Set centre of this sphere to c (while radius unchanged).
bool contains(vgl_point_3d< Type > const &p) const
Return true iff the point p is inside (or on) this sphere.
vgl_sphere_3d(const Type v[4])
Construct from a 4-array, representing centre and radius.