8 #ifndef IMPALGEBRA_PLANE_3D_H
9 #define IMPALGEBRA_PLANE_3D_H
11 #include <IMP/algebra/algebra_config.h>
16 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),
32 normal_(normal_to_plane){
34 "The normal vector must be normalized");
36 Vector3D get_point_on_plane()
const {
return normal_*distance_;}
37 const Vector3D &get_normal()
const {
return normal_;}
40 return p-normal_*(normal_*p-distance_);
44 return get_projected(p);
52 bool get_is_above(
const Vector3D &p)
const {
53 return get_height(p) > 0;
55 bool get_is_below(
const Vector3D &p)
const {
56 return get_height(p) < 0;
59 double get_height(
const Vector3D &p)
const {
60 return normal_*p-distance_;
63 out <<
"(" << distance_ <<
": " << spaces_io(normal_)
69 return Plane3D(-distance_, -normal_);
71 double get_distance_from_origin()
const {
83 return (pln.get_projection(p)-p).get_magnitude();
96 return std::numeric_limits<double>::infinity(),
100 = get_ones_vector_d<3>(
101 std::numeric_limits<double>::infinity());
104 IMPALGEBRA_END_NAMESPACE