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_);
42 IMPALGEBRA_DEPRECATED_METHOD_DECL(2.3)
44 IMPALGEBRA_DEPRECATED_METHOD_DEF(2.3,
"Use get_projected() instead.");
45 return get_projected(p);
53 bool get_is_above(
const Vector3D &p)
const {
return get_height(p) > 0; }
54 bool get_is_below(
const Vector3D &p)
const {
return get_height(p) < 0; }
56 double get_height(
const Vector3D &p)
const {
return normal_ * p - distance_; }
58 { out <<
"(" << distance_ <<
": " << spaces_io(normal_) <<
")"; });
62 double get_distance_from_origin()
const {
return distance_; }
72 return (pln.get_projection(p) - p).get_magnitude();
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
#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)
void get_projection(em2d::Image *img, const kernel::ParticlesTemp &ps, const RegistrationResult ®, const ProjectingOptions &options, MasksManagerPtr masks=MasksManagerPtr(), String name="")
Generates a projection from particles.
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.