Bugzilla – Attachment 233 Details for
Bug 297
ParametrizedLine::intersection doesn't return intersection point
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
[patch]
Patch with adjusted naming based on comments by Benoit
intersection.patch (text/plain), 4.04 KB, created by
Andy Somerville
on 2011-12-10 08:12:54 UTC
(
hide
)
Description:
Patch with adjusted naming based on comments by Benoit
Filename:
MIME Type:
Creator:
Andy Somerville
Created:
2011-12-10 08:12:54 UTC
Size:
4.04 KB
patch
obsolete
>diff -r 5731dbe0ec5f Eigen/src/Geometry/ParametrizedLine.h >--- a/Eigen/src/Geometry/ParametrizedLine.h Fri Dec 09 23:38:41 2011 +0100 >+++ b/Eigen/src/Geometry/ParametrizedLine.h Sat Dec 10 02:04:27 2011 -0500 >@@ -99,22 +99,35 @@ > } > /** \returns the distance of a point \a p to its projection onto the line \c *this. > * \sa squaredDistance() > */ > RealScalar distance(const VectorType& p) const { return internal::sqrt(squaredDistance(p)); } > > /** \returns the projection of a point \a p onto the line \c *this. */ > VectorType projection(const VectorType& p) const > { return origin() + direction().dot(p-origin()) * direction(); } > >+ /** \rreturns the point at parameter t along the line */ >+ VectorType intersectionPoint( Scalar t ) const; >+ >+ /** \rreturns parameter t of the intersection of the line with hyperplane */ >+ template <int OtherOptions> >+ Scalar intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const; >+ >+ /** \rreturns parameter t of the intersection of the line with hyperplane. (maintained for API compatablity) */ > template <int OtherOptions> > Scalar intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const; >+ >+ /** \rreturns the intersection point of the line with hyperplane */ >+ template <int OtherOptions> >+ VectorType intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const; >+ > > /** \returns \c *this with scalar type casted to \a NewScalarType > * > * Note that if \a NewScalarType is equal to the current scalar type of \c *this > * then this function smartly returns a const reference to \c *this. > */ > template<typename NewScalarType> > inline typename internal::cast_return_type<ParametrizedLine, > ParametrizedLine<NewScalarType,AmbientDimAtCompileTime,Options> >::type cast() const > { >@@ -148,21 +161,50 @@ > */ > template <typename _Scalar, int _AmbientDim, int _Options> > template <int OtherOptions> > inline ParametrizedLine<_Scalar, _AmbientDim,_Options>::ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim,OtherOptions>& hyperplane) > { > EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2) > direction() = hyperplane.normal().unitOrthogonal(); > origin() = -hyperplane.normal()*hyperplane.offset(); > } > >+/** \returns the point at t along this line >+ */ >+template <typename _Scalar, int _AmbientDim, int _Options> >+inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType >+ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionPoint( _Scalar t ) const >+{ >+ return origin() + (direction()*t); >+} >+ >+/** \returns the parameter value of the intersection between \c *this and the given hyperplane >+ */ >+template <typename _Scalar, int _AmbientDim, int _Options> >+template <int OtherOptions> >+inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const >+{ >+ return -(hyperplane.offset()+hyperplane.normal().dot(origin())) >+ / hyperplane.normal().dot(direction()); >+} >+ >+ > /** \returns the parameter value of the intersection between \c *this and the given hyperplane > */ > template <typename _Scalar, int _AmbientDim, int _Options> > template <int OtherOptions> > inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const > { >- return -(hyperplane.offset()+hyperplane.normal().dot(origin())) >- / hyperplane.normal().dot(direction()); >+ return intersectionParameter(hyperplane); >+} >+ >+/** \returns the point of the intersection between \c *this and the given hyperplane >+ */ >+template <typename _Scalar, int _AmbientDim, int _Options> >+template <int OtherOptions> >+inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType >+ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const >+{ >+ return intersectionPoint(intersectionParameter(hyperplane)); > } > > #endif // EIGEN_PARAMETRIZEDLINE_H
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 297
:
183
|
184
|
187
|
188
|
193
|
233
|
234
|
235