 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
13 #include <Eigen/Geometry>
49 class Line3D :
protected Eigen::ParametrizedLine<double, 3> {
55 const Eigen::Vector3d& p1) {
56 return {p0, (p1 - p0).normalized()};
76 Line3D(
const Eigen::Vector3d&
origin,
const Eigen::Vector3d& direction);
84 const Eigen::Vector3d&
Origin()
const {
return m_origin; }
87 const Eigen::Vector3d&
Direction()
const {
return m_direction; }
92 return std::numeric_limits<double>::infinity();
96 virtual void Transform(
const Eigen::Transform<double, 3, Eigen::Affine>& t);
100 const Eigen::ParametrizedLine<double, 3>&
Line()
const {
return *
this; }
107 const Eigen::Hyperplane<double, 3>& plane)
const;
130 virtual Eigen::Vector3d
Projection(
const Eigen::Vector3d& point)
const;
190 const Line3D& other)
const;
214 const Eigen::Vector3d& direction,
243 static Ray3D Through(
const Eigen::Vector3d& p0,
const Eigen::Vector3d& p1) {
244 return {p0, (p1 - p0).normalized()};
248 Ray3D(
const Eigen::Vector3d&
origin,
const Eigen::Vector3d& direction);
253 return std::numeric_limits<double>::infinity();
262 const Eigen::Hyperplane<double, 3>& plane)
const override;
285 const ccBBox& box)
const override;
293 return std::max(parameter, 0.);
301 return parameter >= 0;
325 const Eigen::Vector3d& p1) {
331 Segment3D(
const Eigen::Vector3d& start_point,
332 const Eigen::Vector3d& end_point);
336 explicit Segment3D(
const std::pair<Eigen::Vector3d, Eigen::Vector3d>& pair);
340 double Length()
const override {
return length_; }
346 const Eigen::Vector3d&
EndPoint()
const {
return end_point_; }
350 const Eigen::Transform<double, 3, Eigen::Affine>& t)
override;
361 const Eigen::Hyperplane<double, 3>& plane)
const override;
386 const ccBBox& box)
const override;
408 const ccBBox& box)
const override;
416 return std::max(std::min(parameter, length_), 0.);
424 return parameter >= 0 && parameter <= length_;
428 Eigen::Vector3d end_point_;
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
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 ...
Definition: Line3D.h:54
virtual double Length() const
Gets the length of the line, which for lines and rays will return positive infinity,...
Definition: Line3D.h:91
A segment is a semantic interpretation of Eigen::ParametrizedLine which has an origin and an endpoint...
Definition: Line3D.h:319
Simple Ray structure.
Definition: RayAndBox.h:14
virtual Eigen::Vector3d Projection(const Eigen::Vector3d &point) const
Calculates a point projected onto the line, taking into account special semantics.
Definition: Line3D.cpp:168
cloudViewer::utility::optional< double > ExactAABB(const ccBBox &box) const override
Returns the lower intersection parameter for a segment with an axis aligned bounding box or empty if ...
Definition: Line3D.cpp:361
const Eigen::Vector3d & Origin() const
Gets the line's origin point.
Definition: Line3D.h:84
Bounding box structure.
Definition: ecvBBox.h:25
cloudViewer::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 segment semant...
Definition: Line3D.cpp:381
double ClampParameter(double parameter) const override
Clamps/bounds a parameter value to the closest valid place where the entity exists....
Definition: Line3D.h:415
Eigen::Vector3d MidPoint() const
Calculates the midpoint of the segment.
Definition: Line3D.h:343
A ray is a semantic interpretation of Eigen::ParametrizedLine which has an origin and a direction and...
Definition: Line3D.h:239
static Segment3D Through(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1)
Creates a Segment3D through two points. The origin will take the value of p0, and the endpoint be p1....
Definition: Line3D.h:324
void Transform(const Eigen::Transform< double, 3, Eigen::Affine > &t) override
Transform the segment by the given matrix.
Definition: Line3D.cpp:334
Segment3D(const Eigen::Vector3d &start_point, const Eigen::Vector3d &end_point)
Default constructor for Segment3D takes the start and end points of the segment.
Definition: Line3D.cpp:323
virtual cloudViewer::utility::optional< double > SlabAABB(const ccBBox &box) const
Returns the lower intersection parameter for a line with an axis aligned bounding box or empty if no ...
Definition: Line3D.cpp:142
std::pair< double, double > ClosestParameters(const Line3D &other) const
Computes the two corresponding parameters of the closest distance between two Line3D objects,...
Definition: Line3D.cpp:176
cloudViewer::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....
Definition: Line3D.cpp:309
cloudViewer::utility::optional< double > SlabAABB(const ccBBox &box) const override
Returns the lower intersection parameter for a segment with an axis aligned bounding box or empty if ...
Definition: Line3D.cpp:339
const Eigen::Vector3d & EndPoint() const
Get the end point of the segment.
Definition: Line3D.h:346
virtual cloudViewer::utility::optional< double > ExactAABB(const ccBBox &box) const
Returns the lower intersection parameter for a line with an axis aligned bounding box or empty if no ...
Definition: Line3D.cpp:79
Line3D(const Eigen::Vector3d &origin, const Eigen::Vector3d &direction)
Default user constructor.
Definition: Line3D.cpp:19
std::pair< double, double > SlabAABBBase(const ccBBox &box) const
Calculates the common t_min and t_max values of the slab AABB intersection method....
Definition: Line3D.cpp:42
virtual double ClampParameter(double parameter) const
Clamps/bounds a parameter value to the closest valid place where the entity exists....
Definition: Line3D.h:202
ccBBox GetBoundingBox() const
Get an axis-aligned bounding box representing the enclosed volume of the line segment.
Definition: Line3D.cpp:370
cloudViewer::utility::optional< double > SlabAABB(const ccBBox &box) const override
Returns the lower intersection parameter for a ray with an axis aligned bounding box or empty if no i...
Definition: Line3D.cpp:289
virtual void Transform(const Eigen::Transform< double, 3, Eigen::Affine > &t)
Transform the Line3D by the given matrix.
Definition: Line3D.cpp:38
bool IsParameterValid(double parameter) const override
Verifies that a given parameter value is valid for the semantics of the line object....
Definition: Line3D.h:300
double ClampParameter(double parameter) const override
Clamps/bounds a parameter value to the closest valid place where the entity exists....
Definition: Line3D.h:292
LineType GetLineType() const
Gets the semantic type of the line.
Definition: Line3D.h:81
@ Line
Lines extend infinitely in both directions.
bool IsParameterValid(double parameter) const override
Verifies that a given parameter value is valid for the semantics of the line object....
Definition: Line3D.h:423
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 ...
Definition: Line3D.cpp:265
Eigen::Vector3d origin
Definition: VoxelGridIO.cpp:26
Definition: Optional.h:44
double ProjectionParameter(const Eigen::Vector3d &point) const
Calculates the parameter of a point projected onto the line taking into account special semantics.
Definition: Line3D.cpp:172
double Length() const override
Get the scalar length of the segment as the distance between the start point (origin) and the end poi...
Definition: Line3D.h:340
double DistanceTo(const Line3D &other) const
Gets the closest distance between two Line3D objects, including derived types Ray3D and Segment3D,...
Definition: Line3D.cpp:275
LineType
Specifies different semantic interpretations of 3d lines.
Definition: Line3D.h:62
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 ...
Definition: Line3D.h:243
const Eigen::ParametrizedLine< double, 3 > & Line() const
Returns a const reference to the underlying Eigen::ParametrizedLine object.
Definition: Line3D.h:100
double Length() const override
Gets the length of the line, which for lines and rays will return positive infinity,...
Definition: Line3D.h:252
virtual bool IsParameterValid(double parameter) const
Verifies that a given parameter value is valid for the semantics of the line object....
Definition: Line3D.h:208
virtual ~Line3D()=default
virtual cloudViewer::utility::optional< double > IntersectionParameter(const Eigen::Hyperplane< double, 3 > &plane) const
Calculates the intersection parameter between the line and a plane taking into account line semantics...
Definition: Line3D.cpp:158
Ray3D(const Eigen::Vector3d &origin, const Eigen::Vector3d &direction)
Default constructor, requires point and direction.
Definition: Line3D.cpp:286
const Eigen::Vector3d & Direction() const
Gets the line's direction vector.
Definition: Line3D.h:87
char type
Definition: FileIOFactory.cpp:131
Line3D is a class which derives from Eigen::ParametrizedLine<double, 3> in order to capture the seman...
Definition: Line3D.h:49