8 #ifndef IMPALGEBRA_PLANE_3D_H
9 #define IMPALGEBRA_PLANE_3D_H
11 #include <IMP/algebra/algebra_config.h>
15 #include <boost/serialization/access.hpp>
17 IMPALGEBRA_BEGIN_NAMESPACE
25 : normal_(normal_to_plane) {
26 distance_ = normal_ * point_on_plane;
28 "The normal vector must be normalized");
31 : distance_(distance_to_plane), normal_(normal_to_plane) {
33 "The normal vector must be normalized");
35 Vector3D get_point_on_plane()
const {
return normal_ * distance_; }
36 const Vector3D &get_normal()
const {
return normal_; }
39 return p - normal_ * (normal_ * p - distance_);
51 { out <<
"(" << distance_ <<
": " << spaces_io(normal_) <<
")"; });
55 double get_distance_from_origin()
const {
return distance_; }
61 friend class boost::serialization::access;
63 template<
class Archive>
void serialize(Archive &ar,
const unsigned int) {
64 ar & distance_ & normal_;
78 return p + 2 * (proj - p);
82 return std::numeric_limits<double>::infinity(), {
84 Vector3D ip = get_ones_vector_d<3>(std::numeric_limits<double>::infinity());
87 IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
double get_height(const Surface &s, const XYZR &d)
Get height of sphere above surface.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
BoundingBoxD< 3 > BoundingBox3D
Typedef for Python.
#define IMP_USAGE_CHECK_FLOAT_EQUAL(expra, exprb, message)
Vector3D get_reflected(const Plane3D &pln, const Vector3D &p)
Return the point reflected about the plane.
#define IMP_AREA_GEOMETRY_METHODS(Name, name, area, bounding_box)
Implement the needed namespace methods for a geometry type.
Base class for geometric types.
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
#define IMP_UNUSED(variable)
Plane3D get_opposite() const
Return the plane with the opposite normal.
A bounding box in D dimensions.
Vector3D get_projected(const Vector3D &p) const
Project the point onto the plane.