Closed eryar closed 3 years ago
On Mon, Dec 14, 2020 at 6:52 AM Shing Liu notifications@github.com wrote:
Hello, I find that the cross operation only for 3d vector:
namespace boost { namespace qvm {
//Only enabled if: // is_vec<A>::value && is_vec<B>::value && // vec_traits<A>::dim==3 && vec_traits<B>::dim==3 template <class A,class B> typename deduce_vec2<A,B,3>::type cross( A const & a, B const & b );
} }
cross for 2d vector is also useful for check parallel.
I thought that in math cross product is only defined for 3D vectors, but today I learned ( https://www.gamedev.net/forums/topic/289972-cross-product-of-2d-vectors/2828289/) that there are "analogs" for other dimensions, e.g. for 2D we could use (U.xV.y-U.yV.x). Is this what you had in mind?
Yes, I mean the "analogs" for 2d vector, use (U.xV.y-U.yV.x). The cross product result of two 3d vector is a vector, but the "analogs" for 2d vector is a scalar type.
Great! Thank you.
Hello, I find that the cross operation only for 3d vector:
cross for 2d vector is also useful for check parallel.
Best Regards,