2 #ifndef vgl_infinite_line_3d_hxx_ 3 #define vgl_infinite_line_3d_hxx_ 11 # include <vcl_msvc_warnings.h> 32 Type vmag = static_cast<Type>(
v.length());
33 double vmagd = static_cast<double>(vmag);
37 vmag = static_cast<Type>(
v.length());
44 Type umag = static_cast<Type>(u.
length());
54 double ttx = std::fabs(static_cast<double>(dir.
x()));
55 double tty = std::fabs(static_cast<double>(dir.
y()));
56 double ttz = std::fabs(static_cast<double>(dir.
z()));
57 double max_comp = ttx;
58 double sign = static_cast<double>(dir.
x());
61 sign = static_cast<double>(dir.
y());
65 sign = static_cast<double>(dir.
z());
68 Type sense = static_cast<Type>(sign/max_comp);
74 Type mag = static_cast<Type>(t_.length());
78 Type k = -dp/(mag*mag);
81 this->compute_uv_vectors(u,
v);
93 this->compute_uv_vectors(u,
v);
94 pv = x0_.
x()*u + x0_.
y()*
v;
104 double len1 = static_cast<double>((point1 - p).
length());
105 double len2 = static_cast<double>((point2 - p).
length());
108 double r = seg -(len1 + len2);
109 if (len1>seg||len2>seg)
110 r = seg - std::fabs(len1-len2);
111 return r < 1e-8 && r > -1e-8;
115 template <
class Type>
118 return s <<
"<vgl_infinite_line_3d: origin " << p.
x0() <<
" dir " << p.
direction() <<
" >";
121 template <
class Type>
134 s >> dir >> std::ws >> temp;
139 #undef VGL_INFINITE_LINE_3D_INSTANTIATE 140 #define VGL_INFINITE_LINE_3D_INSTANTIATE(Type) \ 141 template class vgl_infinite_line_3d<Type >;\ 142 template std::istream& operator>>(std::istream&, vgl_infinite_line_3d<Type >&);\ 143 template std::ostream& operator<<(std::ostream&, vgl_infinite_line_3d<Type > const&) 145 #endif // vgl_infinite_line_3d_hxx_ v normalized(v const &a)
Return a normalised version of a.
T dot_product(v const &a, v const &b)
dot product or inner product of two vectors.
vgl_vector_2d< Type > x0() const
Accessors.
vgl_vector_3d< Type > direction() const
Represents a cartesian 3D point.
bool contains(const vgl_point_3d< Type > &p) const
Check if point p is on the line.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
double length(v const &a)
Return the length of a vector.
double length() const
Return the length of this vector.
T cross_product(v const &a, v const &b)
cross product of two vectors (area of enclosed parallellogram).
void set(vgl_vector_2d< Type > const &x_0, vgl_vector_3d< Type > const &direction)
Assignment.
Represents a 3-d line with position defined in the orthogonal plane passing through the origin.
vgl_infinite_line_3d()=default
Default constructor - does not initialise!.
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
A 3-d infinite line with position parameterized by orthogonal plane coordinates.
void compute_uv_vectors(vgl_vector_3d< Type > &u, vgl_vector_3d< Type > &v) const
The unit vectors perpendicular to the line direction.
vgl_point_3d< Type > point() const
Return the point on the line closest to the origin.