Open3D (C++ API)
0.11.0
|
A ray is a semantic interpretation of Eigen::ParametrizedLine which has an origin and a direction and extends infinitely only in that specific direction. More...
#include <Line3D.h>
Public Member Functions | |
Ray3D (const Eigen::Vector3d &origin, const Eigen::Vector3d &direction) | |
Default constructor, requires point and direction. More... | |
double | Length () const override |
Gets the length of the line, which for lines and rays will return positive infinity, but for segments will return a finite positive value. More... | |
utility::optional< double > | IntersectionParameter (const Eigen::Hyperplane< double, 3 > &plane) const override |
Calculates the intersection parameter between the line and a plane taking into account ray semantics. Returns an empty result if there is no intersection. On a Ray3D this means that intersections behind the origin are invalid, so the return value will always be positive. More... | |
utility::optional< double > | SlabAABB (const AxisAlignedBoundingBox &box) const override |
Returns the lower intersection parameter for a ray with an axis aligned bounding box or empty if no intersection. Uses the slab method, see warning below. More... | |
double | ClampParameter (double parameter) const override |
Clamps/bounds a parameter value to the closest valid place where the entity exists. On a Line3D, the value will be unchanged, on a Ray3D a negative value will be made 0, and on a Segment3D a negative value will be made 0 and a positive value greater than Length() will take the value of Length() More... | |
bool | IsParameterValid (double parameter) const override |
Verifies that a given parameter value is valid for the semantics of the line object. For lines, any parameter is valid, for rays any positive parameter is valid, and for segments any parameter between 0 and the segment length is valid. More... | |
Public Member Functions inherited from open3d::geometry::Line3D | |
Line3D (const Eigen::Vector3d &origin, const Eigen::Vector3d &direction) | |
Default user constructor. More... | |
virtual | ~Line3D ()=default |
LineType | GetLineType () const |
Gets the semantic type of the line. More... | |
const Eigen::Vector3d & | Origin () const |
Gets the line's origin point. More... | |
const Eigen::Vector3d & | Direction () const |
Gets the line's direction vector. More... | |
virtual void | Transform (const Eigen::Transform< double, 3, Eigen::Affine > &t) |
Transform the Line3D by the given matrix. More... | |
const Eigen::ParametrizedLine< double, 3 > & | Line () const |
Returns a const reference to the underlying Eigen::ParametrizedLine object. More... | |
double | ProjectionParameter (const Eigen::Vector3d &point) const |
Calculates the parameter of a point projected onto the line taking into account special semantics. More... | |
virtual Eigen::Vector3d | Projection (const Eigen::Vector3d &point) const |
Calculates a point projected onto the line, taking into account special semantics. More... | |
virtual utility::optional< double > | ExactAABB (const AxisAlignedBoundingBox &box) const |
Returns the lower intersection parameter for a line with an axis aligned bounding box or empty if no intersection. This method is about 20x slower than the slab method, see details to know when to use. More... | |
std::pair< double, double > | ClosestParameters (const Line3D &other) const |
Computes the two corresponding parameters of the closest distance between two Line3D objects, including derived types Ray3D and Segment3D, respecting the semantics of the line type. More... | |
std::pair< Eigen::Vector3d, Eigen::Vector3d > | ClosestPoints (const Line3D &other) const |
Computes the two closest points between this Line3D object and the other, including of derived types Ray3D and Segment3D, respecting the semantics of the line types. More... | |
double | DistanceTo (const Line3D &other) const |
Gets the closest distance between two Line3D objects, including derived types Ray3D and Segment3D, respecting the semantics of the line type. More... | |
Static Public Member Functions | |
static Ray3D | Through (const Eigen::Vector3d &p0, const Eigen::Vector3d &p1) |
Creates a Ray3D through two points. The ray origin will take the value of p0, and the direction will be a normalized vector from p0 to p1. More... | |
Static Public Member Functions inherited from open3d::geometry::Line3D | |
static Line3D | Through (const Eigen::Vector3d &p0, const Eigen::Vector3d &p1) |
Creates a line through two points. The line origin will take the value of p0, and the line direction will be a normalized vector from p0 to p1. More... | |
Additional Inherited Members | |
Public Types inherited from open3d::geometry::Line3D | |
enum | LineType { LineType::Line = 0, LineType::Ray = 1, LineType::Segment = 2 } |
Specifies different semantic interpretations of 3d lines. More... | |
Protected Member Functions inherited from open3d::geometry::Line3D | |
Line3D (const Eigen::Vector3d &origin, const Eigen::Vector3d &direction, LineType type) | |
Internal constructor for inherited classes that allows the setting of the LineType. More... | |
std::pair< double, double > | SlabAABBBase (const AxisAlignedBoundingBox &box) const |
Calculates the common t_min and t_max values of the slab AABB intersection method. These values are computed identically for any semantic interpretation of the line, it's up to the derived classes to use them in conjunction with other information to determine what the intersection parameter is. More... | |
A ray is a semantic interpretation of Eigen::ParametrizedLine which has an origin and a direction and extends infinitely only in that specific direction.
open3d::geometry::Ray3D::Ray3D | ( | const Eigen::Vector3d & | origin, |
const Eigen::Vector3d & | direction | ||
) |
Default constructor, requires point and direction.
|
inlineoverridevirtual |
Clamps/bounds a parameter value to the closest valid place where the entity exists. On a Line3D, the value will be unchanged, on a Ray3D a negative value will be made 0, and on a Segment3D a negative value will be made 0 and a positive value greater than Length() will take the value of Length()
Reimplemented from open3d::geometry::Line3D.
|
overridevirtual |
Calculates the intersection parameter between the line and a plane taking into account ray semantics. Returns an empty result if there is no intersection. On a Ray3D this means that intersections behind the origin are invalid, so the return value will always be positive.
Reimplemented from open3d::geometry::Line3D.
|
inlineoverridevirtual |
Verifies that a given parameter value is valid for the semantics of the line object. For lines, any parameter is valid, for rays any positive parameter is valid, and for segments any parameter between 0 and the segment length is valid.
Reimplemented from open3d::geometry::Line3D.
|
inlineoverridevirtual |
Gets the length of the line, which for lines and rays will return positive infinity, but for segments will return a finite positive value.
Reimplemented from open3d::geometry::Line3D.
|
overridevirtual |
Returns the lower intersection parameter for a ray with an axis aligned bounding box or empty if no intersection. Uses the slab method, see warning below.
Calculates the lower intersection parameter of a parameterized ray with an axis aligned bounding box. The intersection point can be recovered with .Line().pointAt(...). If the ray does not intersect the box the optional return value will be empty. No intersection behind the ray origin will be counted, and if the ray originates from within the bounding box the parameter value will be 0.
This implementation is based off of Tavian Barnes' optimized branchless slab method. https://tavianator.com/2011/ray_box.html. It runs in roughly 5% of the time as the the naive exact method, but can degenerate in specific conditions where a ray lies exactly in one of the AABB's planes.
Reimplemented from open3d::geometry::Line3D.
|
inlinestatic |
Creates a Ray3D through two points. The ray origin will take the value of p0, and the direction will be a normalized vector from p0 to p1.