Go to the documentation of this file.
36 #define BOOST_PARAMETER_MAX_ARITY 7
38 #include <jsk_topic_tools/log_utils.h>
43 Line::Line(
const Eigen::Vector3f& direction,
const Eigen::Vector3f& origin)
44 : direction_ (direction.normalized()), origin_(
origin)
69 void Line::foot(
const Eigen::Vector3f& point, Eigen::Vector3f& output)
const
76 const Eigen::Vector3f& from, Eigen::Vector3f& foot_point)
const
78 foot(from, foot_point);
79 return (from - foot_point).norm();
84 Eigen::Vector3f foot_point;
95 double theta = acos(
dot);
96 if (theta > M_PI / 2.0) {
97 return M_PI / 2.0 - theta;
107 return angle(other) < angle_threshold;
112 return (M_PI / 2.0 -
angle(other)) < angle_threshold;
129 Eigen::Vector3f new_origin;
138 Eigen::Vector3f foot_point;
145 Eigen::Vector3f
p(coefficients[0],
148 Eigen::Vector3f
d(coefficients[3],
159 return fabs(n.dot(v12)) / n.norm();
175 double min_alpha = DBL_MAX;
176 double max_alpha = - DBL_MAX;
177 Point min_alpha_point, max_alpha_point;
178 for (
size_t i = 0;
i < points.size();
i++) {
181 if (alpha > max_alpha) {
185 if (alpha < min_alpha) {
192 return boost::make_tuple<Point, Point>(min_alpha_point, max_alpha_point);
Line(const Eigen::Vector3f &direction, const Eigen::Vector3f &origin)
Construct a line from direction vector and a point on the line.
virtual bool isParallel(const Line &other, double angle_threshold=0.1) const
return true if given line is parallel. angle_threshold is error tolerance.
virtual double distance(const Line &other) const
compute a distance to line.
virtual bool isSameDirection(const Line &other) const
Eigen::Vector3f direction_
virtual void print()
Print Line information.
double dot(const double3 &a, const double3 &b)
virtual PointPair findEndPoints(const Vertices &points) const
Extract end points from the points on the lines.
static Ptr fromCoefficients(const std::vector< float > &coefficients)
Instantiate Line from array of float.
virtual Ptr parallelLineOnAPoint(const Eigen::Vector3f &p) const
compute a line on a point, whose direction is same to the current line.
virtual void parallelLineNormal(const Line &other, Eigen::Vector3f &output) const
compute a perpendicular line of two lines from origin_
virtual Eigen::Vector3f getOrigin() const
get origin of the line.
virtual double distanceToPoint(const Eigen::Vector3f &from) const
compute a distance to a point
virtual void foot(const Eigen::Vector3f &point, Eigen::Vector3f &output) const
compute a point which gives perpendicular projection.
virtual double angle(const Line &other) const
compute angle between a given line.
virtual double computeAlpha(const Point &p) const
virtual bool isPerpendicular(const Line &other, double angle_threshold=0.1) const
return true if given line is perpendicular. angle_threshold is error tolerance.
virtual void point(double alpha, Eigen::Vector3f &ouptut)
Compute a point on normal from alpha parameter.
Class to represent 3-D straight line.
virtual Eigen::Vector3f getDirection() const
get normalized direction vector of the line.
boost::tuple< Point, Point > PointPair
virtual Ptr midLine(const Line &other) const
compute a middle line between given line.
std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > Vertices