8 #ifndef IMPALGEBRA_SEGMENT_3D_H
9 #define IMPALGEBRA_SEGMENT_3D_H
11 #include <IMP/algebra/algebra_config.h>
17 #include <cereal/access.hpp>
20 IMPALGEBRA_BEGIN_NAMESPACE
34 Vector3D get_middle_point()
const {
return .5 * p_[0] + .5 * p_[1]; }
37 double get_length()
const;
39 { out << spaces_io(p_[0]) <<
": " << spaces_io(p_[1]); });
44 friend class cereal::access;
46 template<
class Archive>
void serialize(Archive &ar) {
52 return BoundingBoxD<3>(g.get_point(0)) +
75 IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
double get_distance(const Segment3D &a, const Segment3D &b)
Get the distance between two segments.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_LINEAR_GEOMETRY_METHODS(Name, name, bounding_box)
Implement the needed namespace methods for a geometry type.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Base class for geometric types.
Vector3D get_direction() const
Get a normalized direction vector from get_point(0) to get_point(1).
A bounding box in D dimensions.
Various useful constants.
Simple implementation of segments in 3D.
double get_relative_projection_on_segment(const Segment3D &s, const algebra::Vector3D &p)
Return the 'relative' projection of a point p onto the line that contains s.
const Vector3D & get_point(unsigned int i) const
Get the start (i==0) or end (i==1) point of the segment.