8 #ifndef IMPALGEBRA_PLANE_3D_H
9 #define IMPALGEBRA_PLANE_3D_H
11 #include <IMP/algebra/algebra_config.h>
16 IMPALGEBRA_BEGIN_NAMESPACE
24 : normal_(normal_to_plane) {
25 distance_ = normal_ * point_on_plane;
27 "The normal vector must be normalized");
30 : distance_(distance_to_plane), normal_(normal_to_plane) {
32 "The normal vector must be normalized");
34 Vector3D get_point_on_plane()
const {
return normal_ * distance_; }
35 const Vector3D &get_normal()
const {
return normal_; }
38 return p - normal_ * (normal_ * p - distance_);
45 bool get_is_above(
const Vector3D &p)
const {
return get_height(p) > 0; }
46 bool get_is_below(
const Vector3D &p)
const {
return get_height(p) < 0; }
48 double get_height(
const Vector3D &p)
const {
return normal_ * p - distance_; }
50 { out <<
"(" << distance_ <<
": " << spaces_io(normal_) <<
")"; });
54 double get_distance_from_origin()
const {
return distance_; }
70 return p + 2 * (proj - p);
74 return std::numeric_limits<double>::infinity(), {
76 Vector3D ip = get_ones_vector_d<3>(std::numeric_limits<double>::infinity());
79 IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
#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.