10 #ifndef INCLUDED_IMATHLINE_H
11 #define INCLUDED_IMATHLINE_H
17 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
116 return pos + dir * parameter;
123 return (closestPointTo (point) - point).length ();
130 return ((point - pos) ^ dir) * dir + pos;
137 T d = (dir % line.dir) ^ (line.pos - pos);
138 return (d >= 0) ? d : -d;
147 Vec3<T> posLpos = pos - line.pos;
149 T a = line.dir ^ dir;
150 T f = line.dir ^ posLpos;
155 T absDenom = ((denom >= 0) ? denom : -denom);
159 T absNum = ((num >= 0) ? num : -num);
164 return pos + dir * (num / denom);
170 operator<< (std::ostream& o, const Line3<T>& line)
172 return o <<
"(" << line.pos <<
", " << line.dir <<
")";
176 template <
class S,
class T>
180 return Line3<S> (line.pos * M, (line.pos + line.dir) * M);
183 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
185 #endif // INCLUDED_IMATHLINE_H
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
Vec3< T > pos
A point on the line.
GLboolean GLboolean GLboolean GLboolean a
IMATH_HOSTDEVICE constexpr Vec3< T > operator()(T parameter) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr Line3() IMATH_NOEXCEPT
Uninitialized by default.
constexpr auto set(type rhs) -> int
Vec3< T > dir
The direction of the line.
Line3< double > Line3d
Line of type double.
IMATH_HOSTDEVICE void set(const Vec3< T > &point1, const Vec3< T > &point2) IMATH_NOEXCEPT
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE constexpr T distanceTo(const Vec3< T > &point) const IMATH_NOEXCEPT
Return the distance to the given point.
Line3< float > Line3f
Line of type float.
IMATH_HOSTDEVICE constexpr Vec3< T > closestPointTo(const Vec3< T > &point) const IMATH_NOEXCEPT
Return the point on the line closest to the given point.