OSG vector cross product

#include<osg/Vec3f>
#include<iostream>

int main()
{
	osg::Vec3f v1(1,2,3);
	osg::Vec3f v2(9,8,7);

	osg::Vec3f v3 = v1^v2;

	printf("%2.3f\t%2.3f\t%2.3f\n",v3.x(),v3.y(),v3.z());
}

ijk may be the vector of the current coordinate system, 

Use the ^ symbol for cross-multiplication in osg

The result of the cross product is a vector:

x=ay *bz - az*by

y = - (ax * bz - az * bx)

z=ax*by - ay*bx

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325482304&siteId=291194637